Regressor
Bases: TPOTEstimator
Source code in tpot2/tpot_estimator/templates/tpottemplates.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
__init__(search_space='linear', scorers=['neg_mean_squared_error'], scorers_weights=[1], cv=10, other_objective_functions=[], other_objective_functions_weights=[], objective_function_names=None, bigger_is_better=True, categorical_features=None, memory=None, preprocessing=False, max_time_mins=60, max_eval_time_mins=10, n_jobs=1, validation_strategy='none', validation_fraction=0.2, early_stop=None, warm_start=False, periodic_checkpoint_folder=None, verbose=2, memory_limit=None, client=None, random_state=None, allow_inner_regressors=None, **tpotestimator_kwargs)
¶
An sklearn baseestimator that uses genetic programming to optimize a regression pipeline. For more parameters, see the TPOTEstimator class.
Parameters:
Name | Type | Description | Default | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
search_space |
(String, SearchSpace)
|
Note that TPOT MDR may be slow to run because the feature selection routines are computationally expensive, especially on large datasets. | - SearchSpace : The search space to use for the optimization. This should be an instance of a SearchSpace. The search space to use for the optimization. This should be an instance of a SearchSpace. TPOT2 has groups of search spaces found in the following folders, tpot2.search_spaces.nodes for the nodes in the pipeline and tpot2.search_spaces.pipelines for the pipeline structure. |
'linear'
|
||||||||||||
scorers |
(list, scorer)
|
A scorer or list of scorers to be used in the cross-validation process. see https://scikit-learn.org/stable/modules/model_evaluation.html |
['neg_mean_squared_error']
|
||||||||||||
scorers_weights |
list
|
A list of weights to be applied to the scorers during the optimization process. |
[1]
|
||||||||||||
classification |
bool
|
If True, the problem is treated as a classification problem. If False, the problem is treated as a regression problem. Used to determine the CV strategy. |
required | ||||||||||||
cv |
(int, cross - validator)
|
|
10
|
||||||||||||
other_objective_functions |
list
|
A list of other objective functions to apply to the pipeline. The function takes a single parameter for the graphpipeline estimator and returns either a single score or a list of scores. |
[]
|
||||||||||||
other_objective_functions_weights |
list
|
A list of weights to be applied to the other objective functions. |
[]
|
||||||||||||
objective_function_names |
list
|
A list of names to be applied to the objective functions. If None, will use the names of the objective functions. |
None
|
||||||||||||
bigger_is_better |
bool
|
If True, the objective function is maximized. If False, the objective function is minimized. Use negative weights to reverse the direction. |
True
|
||||||||||||
categorical_features |
list or None
|
Categorical columns to inpute and/or one hot encode during the preprocessing step. Used only if preprocessing is not False. |
None
|
||||||||||||
categorical_features |
Categorical columns to inpute and/or one hot encode during the preprocessing step. Used only if preprocessing is not False. - None : If None, TPOT2 will automatically use object columns in pandas dataframes as objects for one hot encoding in preprocessing. - List of categorical features. If X is a dataframe, this should be a list of column names. If X is a numpy array, this should be a list of column indices |
None
|
|||||||||||||
memory |
If supplied, pipeline will cache each transformer after calling fit with joblib.Memory. This feature is used to avoid computing the fit transformers within a pipeline if the parameters and input data are identical with another fitted pipeline during optimization process. - String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown. - String path of a caching directory TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown. If the directory does not exist, TPOT will create it. - Memory object: TPOT uses the instance of joblib.Memory for memory caching, and TPOT does NOT clean the caching directory up upon shutdown. - None: TPOT does not use memory caching. |
None
|
|||||||||||||
preprocessing |
(bool or BaseEstimator / Pipeline)
|
EXPERIMENTAL A pipeline that will be used to preprocess the data before CV. Note that the parameters for these steps are not optimized. Add them to the search space to be optimized. - bool : If True, will use a default preprocessing pipeline which includes imputation followed by one hot encoding. - Pipeline : If an instance of a pipeline is given, will use that pipeline as the preprocessing pipeline. |
False
|
||||||||||||
max_time_mins |
float
|
Maximum time to run the optimization. If none or inf, will run until the end of the generations. |
float("inf")
|
||||||||||||
max_eval_time_mins |
float
|
Maximum time to evaluate a single individual. If none or inf, there will be no time limit per evaluation. |
60*5
|
||||||||||||
n_jobs |
int
|
Number of processes to run in parallel. |
1
|
||||||||||||
validation_strategy |
str
|
EXPERIMENTAL The validation strategy to use for selecting the final pipeline from the population. TPOT2 may overfit the cross validation score. A second validation set can be used to select the final pipeline. - 'auto' : Automatically determine the validation strategy based on the dataset shape. - 'reshuffled' : Use the same data for cross validation and final validation, but with different splits for the folds. This is the default for small datasets. - 'split' : Use a separate validation set for final validation. Data will be split according to validation_fraction. This is the default for medium datasets. - 'none' : Do not use a separate validation set for final validation. Select based on the original cross-validation score. This is the default for large datasets. |
'none'
|
||||||||||||
validation_fraction |
float
|
EXPERIMENTAL The fraction of the dataset to use for the validation set when validation_strategy is 'split'. Must be between 0 and 1. |
0.2
|
||||||||||||
early_stop |
int
|
Number of generations without improvement before early stopping. All objectives must have converged within the tolerance for this to be triggered. In general a value of around 5-20 is good. |
None
|
||||||||||||
warm_start |
bool
|
If True, will use the continue the evolutionary algorithm from the last generation of the previous run. |
False
|
||||||||||||
periodic_checkpoint_folder |
str
|
Folder to save the population to periodically. If None, no periodic saving will be done. If provided, training will resume from this checkpoint. |
None
|
||||||||||||
verbose |
int
|
How much information to print during the optimization process. Higher values include the information from lower values. 0. nothing 1. progress bar
|
1
|
||||||||||||
memory_limit |
str
|
Memory limit for each job. See Dask LocalCluster documentation for more information. |
None
|
||||||||||||
client |
Client
|
A dask client to use for parallelization. If not None, this will override the n_jobs and memory_limit parameters. If None, will create a new client with num_workers=n_jobs and memory_limit=memory_limit. |
None
|
||||||||||||
random_state |
(int, None)
|
A seed for reproducability of experiments. This value will be passed to numpy.random.default_rng() to create an instnce of the genrator to pass to other classes
|
None
|
||||||||||||
allow_inner_regressors |
bool
|
If True, the search space will include ensembled regressors. |
True
|
Attributes:
Name | Type | Description |
---|---|---|
fitted_pipeline_ |
GraphPipeline
|
A fitted instance of the GraphPipeline that inherits from sklearn BaseEstimator. This is fitted on the full X, y passed to fit. |
evaluated_individuals |
A pandas data frame containing data for all evaluated individuals in the run.
|
Columns: - objective functions : The first few columns correspond to the passed in scorers and objective functions - Parents : A tuple containing the indexes of the pipelines used to generate the pipeline of that row. If NaN, this pipeline was generated randomly in the initial population. - Variation_Function : Which variation function was used to mutate or crossover the parents. If NaN, this pipeline was generated randomly in the initial population. - Individual : The internal representation of the individual that is used during the evolutionary algorithm. This is not an sklearn BaseEstimator. - Generation : The generation the pipeline first appeared. - Pareto_Front : The nondominated front that this pipeline belongs to. 0 means that its scores is not strictly dominated by any other individual. To save on computational time, the best frontier is updated iteratively each generation. The pipelines with the 0th pareto front do represent the exact best frontier. However, the pipelines with pareto front >= 1 are only in reference to the other pipelines in the final population. All other pipelines are set to NaN. - Instance : The unfitted GraphPipeline BaseEstimator. - validation objective functions : Objective function scores evaluated on the validation set. - Validation_Pareto_Front : The full pareto front calculated on the validation set. This is calculated for all pipelines with Pareto_Front equal to 0. Unlike the Pareto_Front which only calculates the frontier and the final population, the Validation Pareto Front is calculated for all pipelines tested on the validation set. |
pareto_front |
The same pandas dataframe as evaluated individuals, but containing only the frontier pareto front pipelines.
|
|
Source code in tpot2/tpot_estimator/templates/tpottemplates.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|