Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search space api #140

Merged
merged 92 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
04886ad
new search space working with est
perib Mar 19, 2024
da1749e
edits
perib Mar 20, 2024
5b5b222
edits
perib Mar 22, 2024
a28b62f
tutorials fixes
perib Mar 27, 2024
974582c
edits to tutorials
perib Mar 27, 2024
496ad9b
Merge branch 'EpistasisLab:main' into new_search_space_def
perib Mar 27, 2024
ac0ba9d
Merge remote-tracking branch 'origin/dev' into new_search_space_def
perib Mar 27, 2024
22fd809
edit
perib Mar 27, 2024
68378bc
rng_ to rng
perib Mar 27, 2024
d5a27cc
Merge pull request #122 from perib/new_search_space_def
perib Mar 27, 2024
d806571
graph and tree random length initial pipeline
perib Mar 27, 2024
3e2a3c4
flatten pipelines to graph, graphpipe params
perib Mar 29, 2024
59dad61
flatten to graphpipeline, steadystate
perib Apr 10, 2024
d2dab4e
lots of edits to configuration spaces
perib Apr 18, 2024
a66ff10
edits
perib Apr 18, 2024
ca42398
edits
perib Apr 18, 2024
244e897
Merge pull request #123 from perib/new_search_space_def
perib Apr 18, 2024
a29a95d
fixes, passing tests
perib Apr 18, 2024
450a7e5
Merge pull request #124 from perib/new_search_space_def
perib Apr 18, 2024
ef42226
more fixes with search spaces - wrapper, make sure all supported modu…
perib Apr 18, 2024
b2a00ed
Merge pull request #126 from perib/new_search_space_def
perib Apr 18, 2024
d61cd29
added unique_id, fixed issue where graphpipeline not correctly identi…
perib Apr 19, 2024
5448a43
Merge pull request #127 from perib/new_search_space_def
perib Apr 19, 2024
7de26d0
number of nodes on pipelines,gp, recursive + merge graphpipeline node…
perib Apr 19, 2024
05c9ee5
added GaussianProcessClassifier, test for merge duplicate nodes,
perib Apr 19, 2024
1710152
Merge pull request #128 from perib/new_search_space_def
perib Apr 19, 2024
3ce0584
cleanup
perib Apr 23, 2024
0d63172
updated dask version dependency
perib Apr 23, 2024
2b44d0e
complexity objective for more classifiers, added regressors
perib Apr 24, 2024
58ef5a3
bug fixes with configs and wrapper params
perib Apr 24, 2024
bee43d2
tpotclassifier and tpotregressor now use data size for search spaces
perib Apr 24, 2024
e17ed2c
typo
perib Apr 24, 2024
4578b4f
typo
perib Apr 24, 2024
7a9c535
bump version
perib Apr 24, 2024
0c2fffb
update version
perib Apr 24, 2024
bb8a919
Merge pull request #129 from perib/new_search_space_def
perib Apr 24, 2024
4fa02cf
fix num_nodes test, add update checker, setup.py change
perib Apr 24, 2024
f5f466f
param_edits
perib Apr 24, 2024
79056bd
edit space
perib Apr 24, 2024
80525ce
optional inner classifiers/regressors
perib Apr 24, 2024
18346fc
edit
perib Apr 24, 2024
47b7fd0
edit version
perib Apr 24, 2024
8de41fb
Merge pull request #130 from perib/new_search_space_def
perib Apr 24, 2024
9b987e0
edit default space
perib Apr 25, 2024
dbba6ee
bug fixes, fixed unique_id type (non-iterable tuples), fixed graphpip…
perib May 3, 2024
3c6e8d2
make more mutation/cx functions available for gp
perib May 4, 2024
5b8f53f
fixed crossover between different node types causing a crash. now dif…
perib May 4, 2024
9338db7
unions, wrapping classifiers/regressors as transformers, multiple opt…
perib May 11, 2024
4cba717
functions to convert tpot1 config dicts to tpot2
perib May 15, 2024
d30c291
small note
perib May 15, 2024
8728fff
Merge pull request #131 from perib/new_search_space_def
perib May 15, 2024
1fecad6
bug fix
perib May 15, 2024
96e60d8
search_space fixes
perib May 16, 2024
0b1aa09
some bug fixes with configurations
perib May 16, 2024
2a3ee23
Merge pull request #132 from perib/new_search_space_def
perib May 16, 2024
5c634b3
remove hardcoded wrappers that are no longer needed
perib May 16, 2024
ecb4c10
Merge pull request #133 from perib/new_search_space_def
perib May 16, 2024
50fc0fe
passed rng to the sp generative functions, updated dynamic union to n…
perib May 16, 2024
3602956
map elites section functions
perib May 16, 2024
a007c13
import map elites selectors
perib May 16, 2024
bb94241
config updates
perib May 16, 2024
378149f
Merge pull request #134 from perib/new_search_space_def
perib May 17, 2024
445428c
gradientboosting invalid crossover parser fix
perib May 17, 2024
53c1019
one hot encoder no longer throws error by default on unknown categories
perib May 17, 2024
981d9d4
addded kbins dsitrcretizer with passthrough
perib May 18, 2024
ec9c3bb
make sure genetic feature selection always selects at least one column
perib May 18, 2024
ac79ed3
dyanmic_linear_fix
perib May 18, 2024
db0b132
fix bugs
perib May 20, 2024
8056594
catch dask error when closing, validation strategy now puts errors in…
perib May 23, 2024
fedc90d
Merge pull request #136 from perib/new_search_space_def
perib May 24, 2024
50d3eb2
removed a cx function in union pipeline so that we don't unintentiona…
perib Jun 7, 2024
326aae8
added skip
perib Jun 7, 2024
e69e8aa
imputer
perib Jun 14, 2024
5425ee4
added memory to sequential
perib Jun 14, 2024
bbef3e4
Merge pull request #137 from perib/new_search_space_def
perib Jun 19, 2024
64cfc2d
estimator with default search spaces. linear new default
perib Jun 29, 2024
9e7cef4
tutorials fixes
perib Jun 29, 2024
a1592e6
Merge pull request #138 from perib/new_search_space_def
perib Jun 29, 2024
102cdd5
removed unused files, passed rng into default_rng
perib Jul 9, 2024
2b59ec8
wrapper now crossover over hyperparametesr
perib Jul 9, 2024
1b63414
made naming clearer
perib Jul 9, 2024
e388651
wrapper for crossover functions so that subclasses can use crossover …
perib Jul 9, 2024
a250ed2
tpot estimator documentation edit
perib Jul 9, 2024
6905e6f
update documentation
perib Jul 9, 2024
f7b4b27
fixed imputation tutorial
perib Jul 9, 2024
76f76fa
fix
perib Jul 9, 2024
334ca58
wrap fix
perib Jul 9, 2024
8c0379c
added check for infinite max_eval_time_seconds
perib Jul 10, 2024
dc1fb8a
Print out package versions and make tests verbose
jay-m-dev Jul 10, 2024
76d3989
Pin numpy version
jay-m-dev Jul 10, 2024
93e709a
Merge pull request #139 from perib/new_search_space_def
jay-m-dev Jul 11, 2024
65b6760
Resolve version conflicts and test conflicts
jay-m-dev Jul 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ def calculate_version():
'lightgbm>=3.3.3',
'optuna>=3.0.5',
'baikal>=0.4.2',
'jupyter>=1.0.0',
'networkx>=3.0',
'dask>=2024.4.2',
'distributed>=2024.4.2',
'dask-expr>=1.0.12',
'dask-ml>=2023.4.20',
'dask-jobqueue>=0.8.5',
'func_timeout>=4.3.5',
'configspace>=0.7.1',
Expand Down
4 changes: 4 additions & 0 deletions tpot2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@


from .tpot_estimator import TPOTClassifier, TPOTRegressor, TPOTEstimator, TPOTEstimatorSteadyState

from update_checker import update_check
from ._version import __version__
update_check("tpot2",__version__)
2 changes: 1 addition & 1 deletion tpot2/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.5-alpha'
__version__ = '0.1.7-alpha'
18 changes: 10 additions & 8 deletions tpot2/config/classifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ def get_HistGradientBoostingClassifier_ConfigurationSpace(n_features, random_sta
validation_fraction_cond = EqualsCondition(validation_fraction, early_stop, "valid")

space = {
'loss': Categorical("loss", ['log_loss', 'exponential']),
'learning_rate': Float("learning_rate", bounds=(1e-3, 1), log=True),
'min_samples_leaf': Integer("min_samples_leaf", bounds=(1, 200)),
'max_features': Float("max_features", bounds=(0.1,1.0)),
Expand All @@ -432,7 +431,6 @@ def get_HistGradientBoostingClassifier_ConfigurationSpace(n_features, random_sta
def HistGradientBoostingClassifier_hyperparameter_parser(params):

final_params = {
'loss': params['loss'],
'learning_rate': params['learning_rate'],
'min_samples_leaf': params['min_samples_leaf'],
'max_features': params['max_features'],
Expand All @@ -447,7 +445,7 @@ def HistGradientBoostingClassifier_hyperparameter_parser(params):


if params['early_stop'] == 'off':
final_params['n_iter_no_change'] = None
final_params['n_iter_no_change'] = 0
final_params['validation_fraction'] = None
final_params['early_stopping'] = False
elif params['early_stop'] == 'valid':
Expand Down Expand Up @@ -477,12 +475,14 @@ def get_MLPClassifier_ConfigurationSpace(random_state):

n_hidden_layers = Integer("n_hidden_layers", bounds=(1, 3))
n_nodes_per_layer = Integer("n_nodes_per_layer", bounds=(16, 512))
activation = Categorical("activation", ['tanh', 'relu'])
alpha = Float("alpha", bounds=(1e-7, 1e-1), log=True)
learning_rate = Float("learning_rate", bounds=(1e-4, 1e-1), log=True)
activation = Categorical("activation", ["identity", "logistic",'tanh', 'relu'])
alpha = Float("alpha", bounds=(1e-4, 1e-1), log=True)
early_stopping = Categorical("early_stopping", [True,False])

cs.add_hyperparameters([n_hidden_layers, n_nodes_per_layer, activation, alpha, learning_rate, early_stopping])
learning_rate_init = Float("learning_rate_init", bounds=(1e-4, 1e-1), log=True)
learning_rate = Categorical("learning_rate", ['constant', 'invscaling', 'adaptive'])

cs.add_hyperparameters([n_hidden_layers, n_nodes_per_layer, activation, alpha, learning_rate, early_stopping, learning_rate_init])

return cs

Expand All @@ -492,8 +492,10 @@ def MLPClassifier_hyperparameter_parser(params):
'hidden_layer_sizes' : [params['n_nodes_per_layer']]*params['n_hidden_layers'],
'activation': params['activation'],
'alpha': params['alpha'],
'learning_rate': params['learning_rate'],
'early_stopping': params['early_stopping'],

'learning_rate_init': params['learning_rate_init'],
'learning_rate': params['learning_rate'],
}

if 'random_state' in params:
Expand Down
14 changes: 10 additions & 4 deletions tpot2/config/get_configspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@


# not including "PassiveAggressiveClassifier" in classifiers since it is mainly for larger than memory datasets/online use cases

# TODO need to subclass "GaussianProcessClassifier" and 'GaussianProcessRegressor'. These require n_features as a parameter for the kernel, but n_features may be different depending on selection functions or transformations previously in the pipeline.

GROUPNAMES = {
"selectors": ["SelectFwe", "SelectPercentile", "VarianceThreshold",],
"selectors_classification": ["SelectFwe", "SelectPercentile", "VarianceThreshold", "RFE_classification", "SelectFromModel_classification"],
"selectors_regression": ["SelectFwe", "SelectPercentile", "VarianceThreshold", "RFE_regression", "SelectFromModel_regression"],
"classifiers" : ["LGBMRegressor", "BaggingClassifier", "GaussianProcessClassifier", 'AdaBoostClassifier', 'BernoulliNB', 'DecisionTreeClassifier', 'ExtraTreesClassifier', 'GaussianNB', 'HistGradientBoostingClassifier', 'KNeighborsClassifier','LinearDiscriminantAnalysis', 'LogisticRegression', "LinearSVC", "SVC", 'MLPClassifier', 'MultinomialNB', "QuadraticDiscriminantAnalysis", 'RandomForestClassifier', 'SGDClassifier', 'XGBClassifier'],
"regressors" : ['AdaBoostRegressor', "ARDRegression", 'DecisionTreeRegressor', 'ExtraTreesRegressor', 'GaussianProcessRegressor', 'HistGradientBoostingRegressor', 'KNeighborsRegressor', 'LinearSVR', "MLPRegressor", 'RandomForestRegressor', 'SGDRegressor', 'SVR', 'XGBRegressor'],
"classifiers" : ["LGBMRegressor", "BaggingClassifier", 'AdaBoostClassifier', 'BernoulliNB', 'DecisionTreeClassifier', 'ExtraTreesClassifier', 'GaussianNB', 'HistGradientBoostingClassifier', 'KNeighborsClassifier','LinearDiscriminantAnalysis', 'LogisticRegression', "LinearSVC", "SVC", 'MLPClassifier', 'MultinomialNB', "QuadraticDiscriminantAnalysis", 'RandomForestClassifier', 'SGDClassifier', 'XGBClassifier'],
"regressors" : ['AdaBoostRegressor', "ARDRegression", 'DecisionTreeRegressor', 'ExtraTreesRegressor', 'HistGradientBoostingRegressor', 'KNeighborsRegressor', 'LinearSVR', "MLPRegressor", 'RandomForestRegressor', 'SGDRegressor', 'SVR', 'XGBRegressor'],


"transformers": ["Binarizer", "PCA", "ZeroCount", "ColumnOneHotEncoder", "FastICA", "FeatureAgglomeration", "Nystroem", "RBFSampler", "QuantileTransformer", "PowerTransformer"],
Expand Down Expand Up @@ -263,7 +266,7 @@ def get_configspace(name, n_classes=3, n_samples=100, n_features=100, random_sta
case "FastICA":
return transformers.get_FastICA_configspace(n_features=n_features, random_state=random_state)
case "FeatureAgglomeration":
return transformers.get_FeatureAgglomeration_configspace(n_features=n_features,)
return transformers.get_FeatureAgglomeration_configspace(n_samples=n_samples)
case "Nystroem":
return transformers.get_Nystroem_configspace(n_features=n_features, random_state=random_state)
case "RBFSampler":
Expand Down Expand Up @@ -435,9 +438,12 @@ def get_node(name, n_classes=3, n_samples=100, n_features=100, random_state=None
if name == "HistGradientBoostingClassifier":
configspace = get_configspace(name, n_classes=n_classes, n_samples=n_samples, random_state=random_state)
return EstimatorNode(STRING_TO_CLASS[name], configspace, hyperparameter_parser=classifiers.HistGradientBoostingClassifier_hyperparameter_parser)
if name == "GradientBoostingRegressor" or name == "HistGradientBoostingRegressor":
if name == "GradientBoostingRegressor":
configspace = get_configspace(name, n_classes=n_classes, n_samples=n_samples, random_state=random_state)
return EstimatorNode(STRING_TO_CLASS[name], configspace, hyperparameter_parser=regressors.GradientBoostingRegressor_hyperparameter_parser)
if name == "HistGradientBoostingRegressor":
configspace = get_configspace(name, n_classes=n_classes, n_samples=n_samples, random_state=random_state)
return EstimatorNode(STRING_TO_CLASS[name], configspace, hyperparameter_parser=regressors.HistGradientBoostingRegressor_hyperparameter_parser)
if name == "MLPClassifier":
configspace = get_configspace(name, n_classes=n_classes, n_samples=n_samples, random_state=random_state)
return EstimatorNode(STRING_TO_CLASS[name], configspace, hyperparameter_parser=classifiers.MLPClassifier_hyperparameter_parser)
Expand Down
53 changes: 44 additions & 9 deletions tpot2/config/regressors.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,36 @@ def get_GradientBoostingRegressor_ConfigurationSpace(n_features, random_state):
cs.add_conditions([validation_fraction_cond, n_iter_no_change_cond])
return cs

def GradientBoostingRegressor_hyperparameter_parser(params):

final_params = {
'loss': params['loss'],
'learning_rate': params['learning_rate'],
'min_samples_leaf': params['min_samples_leaf'],
'min_samples_split': params['min_samples_split'],
'max_features': params['max_features'],
'max_leaf_nodes': params['max_leaf_nodes'],
'max_depth': params['max_depth'],
'tol': params['tol'],
'subsample': params['subsample']
}

if 'random_state' in params:
final_params['random_state'] = params['random_state']

if params['early_stop'] == 'off':
final_params['n_iter_no_change'] = None
final_params['validation_fraction'] = None
elif params['early_stop'] == 'valid':
final_params['n_iter_no_change'] = params['n_iter_no_change']
final_params['validation_fraction'] = params['validation_fraction']
elif params['early_stop'] == 'train':
final_params['n_iter_no_change'] = params['n_iter_no_change']
final_params['validation_fraction'] = None


return final_params

#only difference is l2_regularization
def get_HistGradientBoostingRegressor_ConfigurationSpace(n_features, random_state):
early_stop = Categorical("early_stop", ["off", "valid", "train"])
Expand Down Expand Up @@ -443,39 +473,40 @@ def get_HistGradientBoostingRegressor_ConfigurationSpace(n_features, random_stat

return cs

def GradientBoostingRegressor_hyperparameter_parser(params):

def HistGradientBoostingRegressor_hyperparameter_parser(params):

final_params = {
'loss': params['loss'],
'learning_rate': params['learning_rate'],
'min_samples_leaf': params['min_samples_leaf'],
'max_features': params['max_features'],
'max_leaf_nodes': params['max_leaf_nodes'],
'max_depth': params['max_depth'],
'tol': params['tol'],
'l2_regularization': params['l2_regularization']
}

if "l2_regularization" in params:
final_params['l2_regularization'] = params['l2_regularization']

if 'random_state' in params:
final_params['random_state'] = params['random_state']


if params['early_stop'] == 'off':
final_params['n_iter_no_change'] = None
final_params['n_iter_no_change'] = 0
final_params['validation_fraction'] = None
final_params['early_stopping'] = False
elif params['early_stop'] == 'valid':
final_params['n_iter_no_change'] = params['n_iter_no_change']
final_params['validation_fraction'] = params['validation_fraction']
final_params['early_stopping'] = True
elif params['early_stop'] == 'train':
final_params['n_iter_no_change'] = params['n_iter_no_change']
final_params['validation_fraction'] = None
final_params['early_stopping'] = True


return final_params



###

def get_MLPRegressor_ConfigurationSpace(random_state):
Expand All @@ -495,7 +526,10 @@ def get_MLPRegressor_ConfigurationSpace(random_state):
learning_rate = Float("learning_rate", bounds=(1e-4, 1e-1), log=True)
early_stopping = Categorical("early_stopping", [True,False])

cs.add_hyperparameters([n_hidden_layers, n_nodes_per_layer, activation, alpha, learning_rate, early_stopping])
learning_rate_init = Float("learning_rate_init", bounds=(1e-4, 1e-1), log=True)
learning_rate = Categorical("learning_rate", ['constant', 'invscaling', 'adaptive'])

cs.add_hyperparameters([n_hidden_layers, n_nodes_per_layer, activation, alpha, learning_rate, early_stopping, learning_rate_init])

return cs

Expand All @@ -505,8 +539,9 @@ def MLPRegressor_hyperparameter_parser(params):
'hidden_layer_sizes' : [params['n_nodes_per_layer']]*params['n_hidden_layers'],
'activation': params['activation'],
'alpha': params['alpha'],
'learning_rate': params['learning_rate'],
'early_stopping': params['early_stopping'],
'learning_rate_init': params['learning_rate_init'],
'learning_rate': params['learning_rate'],
}

if 'random_state' in params:
Expand Down
4 changes: 2 additions & 2 deletions tpot2/config/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def get_FastICA_configspace(n_features=100, random_state=None):

)

def get_FeatureAgglomeration_configspace(n_features=100):
def get_FeatureAgglomeration_configspace(n_samples):

linkage = Categorical('linkage', ['ward', 'complete', 'average'])
metric = Categorical('metric', ['euclidean', 'l1', 'l2', 'manhattan', 'cosine'])
n_clusters = Integer('n_clusters', bounds=(2, 400))
n_clusters = Integer('n_clusters', bounds=(2, min(n_samples,400)))
pooling_func = Categorical('pooling_func', ['mean', 'median', 'max'])

metric_condition = NotEqualsCondition(metric, linkage, 'ward')
Expand Down
2 changes: 1 addition & 1 deletion tpot2/objectives/number_of_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def number_of_nodes_objective(est):
if isinstance(est, GraphPipeline):
return sum(node["instance"] for node in est.graph.nodes)
return sum(number_of_nodes_objective(est.graph.nodes[node]["instance"]) for node in est.graph.nodes)
if isinstance(est, Pipeline):
return sum(number_of_nodes_objective(estimator) for _,estimator in est.steps)
if isinstance(est, sklearn.pipeline.FeatureUnion):
Expand Down
1 change: 0 additions & 1 deletion tpot2/objectives/tests/test_complexity_objective.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from ..complexity import BernoulliNB_Complexity, GaussianNB_Complexity, MultinomialNB_Complexity
6 changes: 5 additions & 1 deletion tpot2/search_spaces/pipelines/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,11 @@ def generate(self, rng=None):
self.cross_val_predict_cv, self.method, self.memory, self.use_label_encoder, rng=rng)
# if user specified limit, grab a random number between that limit

n_nodes = min(rng.integers(1, self.max_size), 5)
if self.max_size is None or self.max_size == np.inf:
n_nodes = rng.integers(1, 5)
else:
n_nodes = min(rng.integers(1, self.max_size), 5)

starting_ops = []
if self.inner_search_space is not None:
starting_ops.append(ind._mutate_insert_inner_node)
Expand Down
41 changes: 28 additions & 13 deletions tpot2/tpot_estimator/templates/tpottemplates.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__( self,
memory_limit = "4GB",
client = None,
random_state=None,
allow_inner_regressors=True,
**tpotestimator_kwargs,
):
"""
Expand Down Expand Up @@ -58,6 +59,7 @@ def __init__( self,
self.memory_limit = memory_limit
self.client = client
self.random_state = random_state
self.allow_inner_regressors = allow_inner_regressors
self.tpotestimator_kwargs = tpotestimator_kwargs

self.initialized = False
Expand All @@ -71,13 +73,18 @@ def fit(self, X, y):
"n_features":X.shape[1],
"random_state":self.random_state}

search_space = tpot2.search_spaces.pipelines.GraphPipeline(
root_search_space= tpot2.config.get_search_space("regressors", **get_search_space_params),
leaf_search_space = None,
inner_search_space = tpot2.config.get_search_space(["selectors","transformers","regressors","scalers"],**get_search_space_params),
max_size = 10,
)

if self.allow_inner_regressors:
search_space = tpot2.search_spaces.pipelines.GraphPipeline(
root_search_space= tpot2.config.get_search_space("regressors", **get_search_space_params),
leaf_search_space = None,
inner_search_space = tpot2.config.get_search_space(["selectors","transformers","regressors","scalers"],**get_search_space_params),
)
else:
search_space = tpot2.search_spaces.pipelines.GraphPipeline(
root_search_space= tpot2.config.get_search_space("regressors", **get_search_space_params),
leaf_search_space = None,
inner_search_space = tpot2.config.get_search_space(["selectors","transformers","scalers"],**get_search_space_params),
)

super(TPOTRegressor,self).__init__(
search_space=search_space,
Expand Down Expand Up @@ -134,6 +141,7 @@ def __init__( self,
memory_limit = "4GB",
client = None,
random_state=None,
allow_inner_classifiers=True,
**tpotestimator_kwargs,

):
Expand Down Expand Up @@ -164,6 +172,7 @@ def __init__( self,
self.client = client
self.random_state = random_state
self.tpotestimator_kwargs = tpotestimator_kwargs
self.allow_inner_classifiers = allow_inner_classifiers

self.initialized = False

Expand All @@ -176,12 +185,18 @@ def fit(self, X, y):
"n_features":X.shape[1],
"random_state":self.random_state}

search_space = tpot2.search_spaces.pipelines.GraphPipeline(
root_search_space= tpot2.config.get_search_space("classifiers", **get_search_space_params),
leaf_search_space = None,
inner_search_space = tpot2.config.get_search_space(["selectors","transformers","classifiers", "scalers"], **get_search_space_params),
max_size = 10,
)
if self.allow_inner_classifiers:
search_space = tpot2.search_spaces.pipelines.GraphPipeline(
root_search_space= tpot2.config.get_search_space("classifiers", **get_search_space_params),
leaf_search_space = None,
inner_search_space = tpot2.config.get_search_space(["selectors","transformers","classifiers", "scalers"], **get_search_space_params),
)
else:
search_space = tpot2.search_spaces.pipelines.GraphPipeline(
root_search_space= tpot2.config.get_search_space("classifiers", **get_search_space_params),
leaf_search_space = None,
inner_search_space = tpot2.config.get_search_space(["selectors","transformers","scalers"], **get_search_space_params),
)


super(TPOTClassifier,self).__init__(
Expand Down
Loading