Skip to content

Commit 5b0661d

Browse files
committed
pylint
1 parent 5d915ed commit 5b0661d

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

causal_testing/estimation/gp.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,20 @@ def mut_insert(expression: gp.PrimitiveTree, pset: gp.PrimitiveSet):
7575
return (expression,)
7676

7777

78-
def create_power_function(power):
78+
def create_power_function(order: int):
79+
"""
80+
Creates a power operator and its corresponding sympy conversion.
81+
82+
:param order: The order of the power, e.g. `order=2` will give x^2.
83+
84+
:return: A pair consisting of the power function and the sympy conversion
85+
"""
86+
7987
def power_func(x):
80-
return power(x, power)
88+
return power(x, order)
8189

82-
def sympy_conversion(x1):
83-
return f"Pow({x1},{i})"
90+
def sympy_conversion(x):
91+
return f"Pow({x},{order})"
8492

8593
return power_func, sympy_conversion
8694

@@ -100,7 +108,8 @@ def __init__(
100108
sympy_conversions: dict = None,
101109
seed=0,
102110
):
103-
# pylint: disable=too-many-arguments,too-many-instance-attributes
111+
# pylint: disable=too-many-arguments
112+
# pylint: disable=too-many-instance-attributes
104113
random.seed(seed)
105114
self.df = df
106115
self.features = features

causal_testing/estimation/linear_regression_estimator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ def gp_formula(
7878
:param ngen: The maximum number of GP generations to run for.
7979
:param pop_size: The GP population size.
8080
:param num_offspring: The number of offspring per generation.
81-
:param max_order: The maximum polynomial order to use, e.g. `max_order=2` will give polynomials of the form `ax^2 + bx + c`.
82-
:param extra_operators: Additional operators for the GP (defaults are +, *, log(x), and 1/x). Operations should be of
83-
the form (fun, numArgs), e.g. (add, 2).
81+
:param max_order: The maximum polynomial order to use, e.g. `max_order=2` will give
82+
polynomials of the form `ax^2 + bx + c`.
83+
:param extra_operators: Additional operators for the GP (defaults are +, *, log(x), and 1/x).
84+
Operations should be of the form (fun, numArgs), e.g. (add, 2).
8485
:param sympy_conversions: Dictionary of conversions of extra_operators for sympy,
8586
e.g. `"mul": lambda *args_: "Mul({},{})".format(*args_)`.
8687
:param seeds: Seed individuals for the population (e.g. if you think that the relationship between X and Y is

0 commit comments

Comments
 (0)