From dae69dce9557aa56c95ff608dcab10d9b3af2e61 Mon Sep 17 00:00:00 2001 From: Weixuan Date: Tue, 21 Jul 2020 16:00:56 -0400 Subject: [PATCH 1/4] new install docs --- docs/index.html | 2 +- docs/installing/index.html | 2 +- docs/search/search_index.json | 2 +- docs/sitemap.xml | 20 ++++++++++---------- docs/sitemap.xml.gz | Bin 270 -> 269 bytes docs_sources/installing.md | 3 ++- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/index.html b/docs/index.html index cdcaac6e..b16f7491 100644 --- a/docs/index.html +++ b/docs/index.html @@ -204,5 +204,5 @@ diff --git a/docs/installing/index.html b/docs/installing/index.html index 9aef0257..b46a5b4e 100644 --- a/docs/installing/index.html +++ b/docs/installing/index.html @@ -161,7 +161,7 @@

Installation

joblib

-

Most of the necessary Python packages can be installed via the Anaconda Python distribution, which we strongly recommend that you use. We also strongly recommend that you use of Python 3 over Python 2 if you're given the choice.

+

Most of the necessary Python packages can be installed via the Anaconda Python distribution, which we strongly recommend that you use. Support for Python 3.4 and below has been officially dropped since version 0.11.0.

You can install TPOT using pip or conda-forge.

pip

NumPy, SciPy, scikit-learn, pandas, joblib, and PyTorch can be installed in Anaconda via the command:

diff --git a/docs/search/search_index.json b/docs/search/search_index.json index e252e748..96a967c0 100644 --- a/docs/search/search_index.json +++ b/docs/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Consider TPOT your Data Science Assistant . TPOT is a Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming. TPOT will automate the most tedious part of machine learning by intelligently exploring thousands of possible pipelines to find the best one for your data. An example machine learning pipeline Once TPOT is finished searching (or you get tired of waiting), it provides you with the Python code for the best pipeline it found so you can tinker with the pipeline from there. An example TPOT pipeline TPOT is built on top of scikit-learn, so all of the code it generates should look familiar... if you're familiar with scikit-learn, anyway. TPOT is still under active development and we encourage you to check back on this repository regularly for updates.","title":"Home"},{"location":"api/","text":"TPOT API Classification class tpot. TPOTClassifier ( generations =100, population_size =100, offspring_size =None, mutation_rate =0.9, crossover_rate =0.1, scoring ='accuracy', cv =5, subsample =1.0, n_jobs =1, max_time_mins =None, max_eval_time_mins =5, random_state =None, config_dict =None, template =None, warm_start =False, memory =None, use_dask =False, periodic_checkpoint_folder =None, early_stop =None, verbosity =0, disable_update_check =False, log_file =None ) source Automated machine learning for supervised classification tasks. The TPOTClassifier performs an intelligent search over machine learning pipelines that can contain supervised classification models, preprocessors, feature selection techniques, and any other estimator or transformer that follows the scikit-learn API . The TPOTClassifier will also search over the hyperparameters of all objects in the pipeline. By default, TPOTClassifier will search over a broad range of supervised classification algorithms, transformers, and their parameters. However, the algorithms, transformers, and hyperparameters that the TPOTClassifier searches over can be fully customized using the config_dict parameter. Read more in the User Guide . Parameters: generations : int or None optional (default=100) Number of iterations to the run pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate population_size + generations \u00d7 offspring_size pipelines in total. population_size : int, optional (default=100) Number of individuals to retain in the genetic programming population every generation. Must be a positive number. Generally, TPOT will work better when you give it more individuals with which to optimize the pipeline. offspring_size : int, optional (default=None) Number of offspring to produce in each genetic programming generation. Must be a positive number. By default, the number of offspring is equal to the number of population size. mutation_rate : float, optional (default=0.9) Mutation rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the GP algorithm how many pipelines to apply random changes to every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. crossover_rate : float, optional (default=0.1) Crossover rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the genetic programming algorithm how many pipelines to \"breed\" every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. scoring : string or callable, optional (default='accuracy') Function used to evaluate the quality of a given pipeline for the classification problem. The following built-in scoring functions can be used: 'accuracy', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'neg_log_loss', 'precision' etc. (suffixes apply as with \u2018f1\u2019), 'recall' etc. (suffixes apply as with \u2018f1\u2019), \u2018jaccard\u2019 etc. (suffixes apply as with \u2018f1\u2019), 'roc_auc', \u2018roc_auc_ovr\u2019, \u2018roc_auc_ovo\u2019, \u2018roc_auc_ovr_weighted\u2019, \u2018roc_auc_ovo_weighted\u2019 If you would like to use a custom scorer, you can pass the callable object/function with signature scorer(estimator, X, y) . See the section on scoring functions for more details. cv : int, cross-validation generator, or an iterable, optional (default=5) Cross-validation strategy used when evaluating pipelines. Possible inputs: integer, to specify the number of folds in a StratifiedKFold, An object to be used as a cross-validation generator, or An iterable yielding train/test splits. subsample : float, optional (default=1.0) Fraction of training samples that are used during the TPOT optimization process. Must be in the range (0.0, 1.0]. Setting subsample =0.5 tells TPOT to use a random subsample of half of the training data. This subsample will remain the same during the entire pipeline optimization process. n_jobs : integer, optional (default=1) Number of processes to use in parallel for evaluating pipelines during the TPOT optimization process. Setting n_jobs =-1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Beware that using multiple processes on the same machine may cause memory issues for large datasets. max_time_mins : integer or None, optional (default=None) How many minutes TPOT has to optimize the pipeline. If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generations is set and all generations are already evaluated. max_eval_time_mins : float, optional (default=5) How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to evaluate more complex pipelines, but will also allow TPOT to run longer. Use this parameter to help prevent TPOT from wasting time on evaluating time-consuming pipelines. random_state : integer or None, optional (default=None) The seed of the pseudo random number generator used in TPOT. Use this parameter to make sure that TPOT will give you the same results each time you run it against the same data set with that seed. config_dict : Python dictionary, string, or None, optional (default=None) A configuration dictionary for customizing the operators and parameters that TPOT searches in the optimization process. Possible inputs are: Python dictionary, TPOT will use your custom configuration, string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors, or string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies, or string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices, or None, TPOT will use the default TPOTClassifier configuration. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. template : string (default=None) Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer, Classifier) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html), [`ClassifierMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.ClassifierMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Classifier\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. warm_start : boolean, optional (default=False) Flag indicating whether the TPOT instance will reuse the population from previous calls to fit() . Setting warm_start =True can be useful for running TPOT for a short time on a dataset, checking the results, then resuming the TPOT run from where it left off. memory : a joblib.Memory object or string, optional (default=None) If supplied, pipeline will cache each transformer after calling fit. 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. More details about memory caching in scikit-learn documentation Possible inputs are: String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown, or Path of a caching directory, TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown, or Memory object, TPOT uses the instance of joblib.Memory for memory caching and TPOT does NOT clean the caching directory up upon shutdown, or None, TPOT does not use memory caching. use_dask : boolean, optional (default: False) Whether to use Dask-ML's pipeline optimiziations. This avoid re-fitting the same estimator on the same split of data multiple times. It will also provide more detailed diagnostics when using Dask's distributed scheduler. See avoid repeated work for more details. periodic_checkpoint_folder : path string, optional (default: None) If supplied, a folder in which TPOT will periodically save pipelines in pareto front so far while optimizing. Currently once per generation but not more often than once per 30 seconds. Useful in multiple cases: Sudden death before TPOT could save optimized pipeline Track its progress Grab pipelines while it's still optimizing early_stop : integer, optional (default: None) How many generations TPOT checks whether there is no improvement in optimization process. Ends the optimization process if there is no improvement in the given number of generations. verbosity : integer, optional (default=0) How much information TPOT communicates while it's running. Possible inputs are: 0, TPOT will print nothing, 1, TPOT will print minimal information, 2, TPOT will print more information and provide a progress bar, or 3, TPOT will print everything and provide a progress bar. disable_update_check : boolean, optional (default=False) Flag indicating whether the TPOT version checker should be disabled. The update checker will tell you when a new version of TPOT has been released. log_file : io.TextIOWrapper or io.StringIO, optional (defaul: sys.stdout) Save progress content to a file. Attributes: fitted_pipeline_ : scikit-learn Pipeline object The best pipeline that TPOT discovered during the pipeline optimization process, fitted on the entire training dataset. pareto_front_fitted_pipelines_ : Python dictionary Dictionary containing the all pipelines on the TPOT Pareto front, where the key is the string representation of the pipeline and the value is the corresponding pipeline fitted on the entire training dataset. The TPOT Pareto front provides a trade-off between pipeline complexity (i.e., the number of steps in the pipeline) and the predictive performance of the pipeline. Note: pareto_front_fitted_pipelines_ is only available when verbosity =3. evaluated_individuals_ : Python dictionary Dictionary containing all pipelines that were evaluated during the pipeline optimization process, where the key is the string representation of the pipeline and the value is a tuple containing (# of steps in pipeline, accuracy metric for the pipeline). This attribute is primarily for internal use, but may be useful for looking at the other pipelines that TPOT evaluated. Example from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Functions fit (features, classes[, sample_weight, groups]) Run the TPOT optimization process on the given training data. predict (features) Use the optimized pipeline to predict the classes for a feature set. predict_proba (features) Use the optimized pipeline to estimate the class probabilities for a feature set. score (testing_features, testing_classes) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. export (output_file_name) Export the optimized pipeline as Python code. fit(features, classes, sample_weight=None, groups=None) Run the TPOT optimization process on the given training data. Uses genetic programming to optimize a machine learning pipeline that maximizes the score on the provided features and target. This pipeline optimization procedure uses internal k-fold cross-validaton to avoid overfitting on the provided data. At the end of the pipeline optimization procedure, the best pipeline is then trained on the entire set of provided samples. Parameters: features : array-like {n_samples, n_features} Feature matrix TPOT and all scikit-learn algorithms assume that the features will be numerical and there will be no missing values. As such, when a feature matrix is provided to TPOT, all missing values will automatically be replaced (i.e., imputed) using median value imputation . If you wish to use a different imputation strategy than median imputation, please make sure to apply imputation to your feature set prior to passing it to TPOT. classes : array-like {n_samples} List of class labels for prediction sample_weight : array-like {n_samples}, optional Per-sample weights. Higher weights indicate more importance. If specified, sample_weight will be passed to any pipeline element whose fit() function accepts a sample_weight argument. By default, using sample_weight does not affect tpot's scoring functions, which determine preferences between pipelines. groups : array-like, with shape {n_samples, }, optional Group labels for the samples used when performing cross-validation. This parameter should only be used in conjunction with sklearn's Group cross-validation functions, such as sklearn.model_selection.GroupKFold . Returns: self : object Returns a copy of the fitted TPOT object predict(features) Use the optimized pipeline to predict the classes for a feature set. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples} Predicted classes for the samples in the feature matrix predict_proba(features) Use the optimized pipeline to estimate the class probabilities for a feature set. Note: This function will only work for pipelines whose final classifier supports the predict_proba function. TPOT will raise an error otherwise. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples, n_classes} The class probabilities of the input samples score(testing_features, testing_classes) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. The default scoring function for TPOTClassifier is 'accuracy'. Parameters: testing_features : array-like {n_samples, n_features} Feature matrix of the testing set testing_classes : array-like {n_samples} List of class labels for prediction in the testing set Returns: accuracy_score : float The estimated test set accuracy according to the user-specified scoring function. export(output_file_name, data_file_path) Export the optimized pipeline as Python code. See the usage documentation for example usage of the export function. Parameters: output_file_name : string String containing the path and file name of the desired output file data_file_path : string By default, the path of input dataset is 'PATH/TO/DATA/FILE' by default. If data_file_path is another string, the path will be replaced. Returns: exported_code_string : string The whole pipeline text as a string should be returned if output_file_name is not specified. Regression class tpot. TPOTRegressor ( generations =100, population_size =100, offspring_size =None, mutation_rate =0.9, crossover_rate =0.1, scoring ='neg_mean_squared_error', cv =5, subsample =1.0, n_jobs =1, max_time_mins =None, max_eval_time_mins =5, random_state =None, config_dict =None, template =None, warm_start =False, memory =None, use_dask =False, periodic_checkpoint_folder =None, early_stop =None, verbosity =0, disable_update_check =False ) source Automated machine learning for supervised regression tasks. The TPOTRegressor performs an intelligent search over machine learning pipelines that can contain supervised regression models, preprocessors, feature selection techniques, and any other estimator or transformer that follows the scikit-learn API . The TPOTRegressor will also search over the hyperparameters of all objects in the pipeline. By default, TPOTRegressor will search over a broad range of supervised regression models, transformers, and their hyperparameters. However, the models, transformers, and parameters that the TPOTRegressor searches over can be fully customized using the config_dict parameter. Read more in the User Guide . Parameters: generations : int or None, optional (default=100) Number of iterations to the run pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate population_size + generations \u00d7 offspring_size pipelines in total. population_size : int, optional (default=100) Number of individuals to retain in the genetic programming population every generation. Must be a positive number. Generally, TPOT will work better when you give it more individuals with which to optimize the pipeline. offspring_size : int, optional (default=None) Number of offspring to produce in each genetic programming generation. Must be a positive number. By default, the number of offspring is equal to the number of population size. mutation_rate : float, optional (default=0.9) Mutation rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the GP algorithm how many pipelines to apply random changes to every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. crossover_rate : float, optional (default=0.1) Crossover rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the genetic programming algorithm how many pipelines to \"breed\" every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. scoring : string or callable, optional (default='neg_mean_squared_error') Function used to evaluate the quality of a given pipeline for the regression problem. The following built-in scoring functions can be used: 'neg_median_absolute_error', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'r2' Note that we recommend using the neg version of mean squared error and related metrics so TPOT will minimize (instead of maximize) the metric. If you would like to use a custom scorer, you can pass the callable object/function with signature scorer(estimator, X, y) . See the section on scoring functions for more details. cv : int, cross-validation generator, or an iterable, optional (default=5) Cross-validation strategy used when evaluating pipelines. Possible inputs: integer, to specify the number of folds in a KFold, An object to be used as a cross-validation generator, or An iterable yielding train/test splits. subsample : float, optional (default=1.0) Fraction of training samples that are used during the TPOT optimization process. Must be in the range (0.0, 1.0]. Setting subsample =0.5 tells TPOT to use a random subsample of half of the training data. This subsample will remain the same during the entire pipeline optimization process. n_jobs : integer, optional (default=1) Number of processes to use in parallel for evaluating pipelines during the TPOT optimization process. Setting n_jobs =-1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Beware that using multiple processes on the same machine may cause memory issues for large datasets max_time_mins : integer or None, optional (default=None) How many minutes TPOT has to optimize the pipeline. If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generations is set and all generations are already evaluated. max_eval_time_mins : float, optional (default=5) How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to evaluate more complex pipelines, but will also allow TPOT to run longer. Use this parameter to help prevent TPOT from wasting time on evaluating time-consuming pipelines. random_state : integer or None, optional (default=None) The seed of the pseudo random number generator used in TPOT. Use this parameter to make sure that TPOT will give you the same results each time you run it against the same data set with that seed. config_dict : Python dictionary, string, or None, optional (default=None) A configuration dictionary for customizing the operators and parameters that TPOT searches in the optimization process. Possible inputs are: Python dictionary, TPOT will use your custom configuration, string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors, or string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies, or string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices, or None, TPOT will use the default TPOTRegressor configuration. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. template : string (default=None) Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer or Regressor) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html) or [`RegressorMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Regressor\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. warm_start : boolean, optional (default=False) Flag indicating whether the TPOT instance will reuse the population from previous calls to fit() . Setting warm_start =True can be useful for running TPOT for a short time on a dataset, checking the results, then resuming the TPOT run from where it left off. memory : a joblib.Memory object or string, optional (default=None) If supplied, pipeline will cache each transformer after calling fit. 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. More details about memory caching in scikit-learn documentation Possible inputs are: String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown, or Path of a caching directory, TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown, or Memory object, TPOT uses the instance of joblib.Memory for memory caching and TPOT does NOT clean the caching directory up upon shutdown, or None, TPOT does not use memory caching. use_dask : boolean, optional (default: False) Whether to use Dask-ML's pipeline optimiziations. This avoid re-fitting the same estimator on the same split of data multiple times. It will also provide more detailed diagnostics when using Dask's distributed scheduler. See avoid repeated work for more details. periodic_checkpoint_folder : path string, optional (default: None) If supplied, a folder in which TPOT will periodically save pipelines in pareto front so far while optimizing. Currently once per generation but not more often than once per 30 seconds. Useful in multiple cases: Sudden death before TPOT could save optimized pipeline Track its progress Grab pipelines while it's still optimizing early_stop : integer, optional (default: None) How many generations TPOT checks whether there is no improvement in optimization process. Ends the optimization process if there is no improvement in the given number of generations. verbosity : integer, optional (default=0) How much information TPOT communicates while it's running. Possible inputs are: 0, TPOT will print nothing, 1, TPOT will print minimal information, 2, TPOT will print more information and provide a progress bar, or 3, TPOT will print everything and provide a progress bar. disable_update_check : boolean, optional (default=False) Flag indicating whether the TPOT version checker should be disabled. The update checker will tell you when a new version of TPOT has been released. Attributes: fitted_pipeline_ : scikit-learn Pipeline object The best pipeline that TPOT discovered during the pipeline optimization process, fitted on the entire training dataset. pareto_front_fitted_pipelines_ : Python dictionary Dictionary containing the all pipelines on the TPOT Pareto front, where the key is the string representation of the pipeline and the value is the corresponding pipeline fitted on the entire training dataset. The TPOT Pareto front provides a trade-off between pipeline complexity (i.e., the number of steps in the pipeline) and the predictive performance of the pipeline. Note: _pareto_front_fitted_pipelines is only available when verbosity =3. evaluated_individuals_ : Python dictionary Dictionary containing all pipelines that were evaluated during the pipeline optimization process, where the key is the string representation of the pipeline and the value is a tuple containing (# of steps in pipeline, accuracy metric for the pipeline). This attribute is primarily for internal use, but may be useful for looking at the other pipelines that TPOT evaluated. Example from tpot import TPOTRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split digits = load_boston() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_boston_pipeline.py') Functions fit (features, target[, sample_weight, groups]) Run the TPOT optimization process on the given training data. predict (features) Use the optimized pipeline to predict the target values for a feature set. score (testing_features, testing_target) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. export (output_file_name) Export the optimized pipeline as Python code. fit(features, target, sample_weight=None, groups=None) Run the TPOT optimization process on the given training data. Uses genetic programming to optimize a machine learning pipeline that maximizes the score on the provided features and target. This pipeline optimization procedure uses internal k-fold cross-validaton to avoid overfitting on the provided data. At the end of the pipeline optimization procedure, the best pipeline is then trained on the entire set of provided samples. Parameters: features : array-like {n_samples, n_features} Feature matrix TPOT and all scikit-learn algorithms assume that the features will be numerical and there will be no missing values. As such, when a feature matrix is provided to TPOT, all missing values will automatically be replaced (i.e., imputed) using median value imputation . If you wish to use a different imputation strategy than median imputation, please make sure to apply imputation to your feature set prior to passing it to TPOT. target : array-like {n_samples} List of target labels for prediction sample_weight : array-like {n_samples}, optional Per-sample weights. Higher weights indicate more importance. If specified, sample_weight will be passed to any pipeline element whose fit() function accepts a sample_weight argument. By default, using sample_weight does not affect tpot's scoring functions, which determine preferences between pipelines. groups : array-like, with shape {n_samples, }, optional Group labels for the samples used when performing cross-validation. This parameter should only be used in conjunction with sklearn's Group cross-validation functions, such as sklearn.model_selection.GroupKFold . Returns: self : object Returns a copy of the fitted TPOT object predict(features) Use the optimized pipeline to predict the target values for a feature set. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples} Predicted target values for the samples in the feature matrix score(testing_features, testing_target) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. The default scoring function for TPOTRegressor is 'mean_squared_error'. Parameters: testing_features : array-like {n_samples, n_features} Feature matrix of the testing set testing_target : array-like {n_samples} List of target labels for prediction in the testing set Returns: accuracy_score : float The estimated test set accuracy according to the user-specified scoring function. export(output_file_name) Export the optimized pipeline as Python code. See the usage documentation for example usage of the export function. Parameters: output_file_name : string String containing the path and file name of the desired output file data_file_path : string By default, the path of input dataset is 'PATH/TO/DATA/FILE' by default. If data_file_path is another string, the path will be replaced. Returns: exported_code_string : string The whole pipeline text as a string should be returned if output_file_name is not specified.","title":"TPOT API"},{"location":"api/#tpot-api","text":"","title":"TPOT API"},{"location":"api/#classification","text":"class tpot. TPOTClassifier ( generations =100, population_size =100, offspring_size =None, mutation_rate =0.9, crossover_rate =0.1, scoring ='accuracy', cv =5, subsample =1.0, n_jobs =1, max_time_mins =None, max_eval_time_mins =5, random_state =None, config_dict =None, template =None, warm_start =False, memory =None, use_dask =False, periodic_checkpoint_folder =None, early_stop =None, verbosity =0, disable_update_check =False, log_file =None ) source Automated machine learning for supervised classification tasks. The TPOTClassifier performs an intelligent search over machine learning pipelines that can contain supervised classification models, preprocessors, feature selection techniques, and any other estimator or transformer that follows the scikit-learn API . The TPOTClassifier will also search over the hyperparameters of all objects in the pipeline. By default, TPOTClassifier will search over a broad range of supervised classification algorithms, transformers, and their parameters. However, the algorithms, transformers, and hyperparameters that the TPOTClassifier searches over can be fully customized using the config_dict parameter. Read more in the User Guide . Parameters: generations : int or None optional (default=100) Number of iterations to the run pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate population_size + generations \u00d7 offspring_size pipelines in total. population_size : int, optional (default=100) Number of individuals to retain in the genetic programming population every generation. Must be a positive number. Generally, TPOT will work better when you give it more individuals with which to optimize the pipeline. offspring_size : int, optional (default=None) Number of offspring to produce in each genetic programming generation. Must be a positive number. By default, the number of offspring is equal to the number of population size. mutation_rate : float, optional (default=0.9) Mutation rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the GP algorithm how many pipelines to apply random changes to every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. crossover_rate : float, optional (default=0.1) Crossover rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the genetic programming algorithm how many pipelines to \"breed\" every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. scoring : string or callable, optional (default='accuracy') Function used to evaluate the quality of a given pipeline for the classification problem. The following built-in scoring functions can be used: 'accuracy', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'neg_log_loss', 'precision' etc. (suffixes apply as with \u2018f1\u2019), 'recall' etc. (suffixes apply as with \u2018f1\u2019), \u2018jaccard\u2019 etc. (suffixes apply as with \u2018f1\u2019), 'roc_auc', \u2018roc_auc_ovr\u2019, \u2018roc_auc_ovo\u2019, \u2018roc_auc_ovr_weighted\u2019, \u2018roc_auc_ovo_weighted\u2019 If you would like to use a custom scorer, you can pass the callable object/function with signature scorer(estimator, X, y) . See the section on scoring functions for more details. cv : int, cross-validation generator, or an iterable, optional (default=5) Cross-validation strategy used when evaluating pipelines. Possible inputs: integer, to specify the number of folds in a StratifiedKFold, An object to be used as a cross-validation generator, or An iterable yielding train/test splits. subsample : float, optional (default=1.0) Fraction of training samples that are used during the TPOT optimization process. Must be in the range (0.0, 1.0]. Setting subsample =0.5 tells TPOT to use a random subsample of half of the training data. This subsample will remain the same during the entire pipeline optimization process. n_jobs : integer, optional (default=1) Number of processes to use in parallel for evaluating pipelines during the TPOT optimization process. Setting n_jobs =-1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Beware that using multiple processes on the same machine may cause memory issues for large datasets. max_time_mins : integer or None, optional (default=None) How many minutes TPOT has to optimize the pipeline. If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generations is set and all generations are already evaluated. max_eval_time_mins : float, optional (default=5) How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to evaluate more complex pipelines, but will also allow TPOT to run longer. Use this parameter to help prevent TPOT from wasting time on evaluating time-consuming pipelines. random_state : integer or None, optional (default=None) The seed of the pseudo random number generator used in TPOT. Use this parameter to make sure that TPOT will give you the same results each time you run it against the same data set with that seed. config_dict : Python dictionary, string, or None, optional (default=None) A configuration dictionary for customizing the operators and parameters that TPOT searches in the optimization process. Possible inputs are: Python dictionary, TPOT will use your custom configuration, string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors, or string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies, or string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices, or None, TPOT will use the default TPOTClassifier configuration. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. template : string (default=None) Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer, Classifier) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html), [`ClassifierMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.ClassifierMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Classifier\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. warm_start : boolean, optional (default=False) Flag indicating whether the TPOT instance will reuse the population from previous calls to fit() . Setting warm_start =True can be useful for running TPOT for a short time on a dataset, checking the results, then resuming the TPOT run from where it left off. memory : a joblib.Memory object or string, optional (default=None) If supplied, pipeline will cache each transformer after calling fit. 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. More details about memory caching in scikit-learn documentation Possible inputs are: String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown, or Path of a caching directory, TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown, or Memory object, TPOT uses the instance of joblib.Memory for memory caching and TPOT does NOT clean the caching directory up upon shutdown, or None, TPOT does not use memory caching. use_dask : boolean, optional (default: False) Whether to use Dask-ML's pipeline optimiziations. This avoid re-fitting the same estimator on the same split of data multiple times. It will also provide more detailed diagnostics when using Dask's distributed scheduler. See avoid repeated work for more details. periodic_checkpoint_folder : path string, optional (default: None) If supplied, a folder in which TPOT will periodically save pipelines in pareto front so far while optimizing. Currently once per generation but not more often than once per 30 seconds. Useful in multiple cases: Sudden death before TPOT could save optimized pipeline Track its progress Grab pipelines while it's still optimizing early_stop : integer, optional (default: None) How many generations TPOT checks whether there is no improvement in optimization process. Ends the optimization process if there is no improvement in the given number of generations. verbosity : integer, optional (default=0) How much information TPOT communicates while it's running. Possible inputs are: 0, TPOT will print nothing, 1, TPOT will print minimal information, 2, TPOT will print more information and provide a progress bar, or 3, TPOT will print everything and provide a progress bar. disable_update_check : boolean, optional (default=False) Flag indicating whether the TPOT version checker should be disabled. The update checker will tell you when a new version of TPOT has been released. log_file : io.TextIOWrapper or io.StringIO, optional (defaul: sys.stdout) Save progress content to a file. Attributes: fitted_pipeline_ : scikit-learn Pipeline object The best pipeline that TPOT discovered during the pipeline optimization process, fitted on the entire training dataset. pareto_front_fitted_pipelines_ : Python dictionary Dictionary containing the all pipelines on the TPOT Pareto front, where the key is the string representation of the pipeline and the value is the corresponding pipeline fitted on the entire training dataset. The TPOT Pareto front provides a trade-off between pipeline complexity (i.e., the number of steps in the pipeline) and the predictive performance of the pipeline. Note: pareto_front_fitted_pipelines_ is only available when verbosity =3. evaluated_individuals_ : Python dictionary Dictionary containing all pipelines that were evaluated during the pipeline optimization process, where the key is the string representation of the pipeline and the value is a tuple containing (# of steps in pipeline, accuracy metric for the pipeline). This attribute is primarily for internal use, but may be useful for looking at the other pipelines that TPOT evaluated. Example from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Functions fit (features, classes[, sample_weight, groups]) Run the TPOT optimization process on the given training data. predict (features) Use the optimized pipeline to predict the classes for a feature set. predict_proba (features) Use the optimized pipeline to estimate the class probabilities for a feature set. score (testing_features, testing_classes) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. export (output_file_name) Export the optimized pipeline as Python code. fit(features, classes, sample_weight=None, groups=None) Run the TPOT optimization process on the given training data. Uses genetic programming to optimize a machine learning pipeline that maximizes the score on the provided features and target. This pipeline optimization procedure uses internal k-fold cross-validaton to avoid overfitting on the provided data. At the end of the pipeline optimization procedure, the best pipeline is then trained on the entire set of provided samples. Parameters: features : array-like {n_samples, n_features} Feature matrix TPOT and all scikit-learn algorithms assume that the features will be numerical and there will be no missing values. As such, when a feature matrix is provided to TPOT, all missing values will automatically be replaced (i.e., imputed) using median value imputation . If you wish to use a different imputation strategy than median imputation, please make sure to apply imputation to your feature set prior to passing it to TPOT. classes : array-like {n_samples} List of class labels for prediction sample_weight : array-like {n_samples}, optional Per-sample weights. Higher weights indicate more importance. If specified, sample_weight will be passed to any pipeline element whose fit() function accepts a sample_weight argument. By default, using sample_weight does not affect tpot's scoring functions, which determine preferences between pipelines. groups : array-like, with shape {n_samples, }, optional Group labels for the samples used when performing cross-validation. This parameter should only be used in conjunction with sklearn's Group cross-validation functions, such as sklearn.model_selection.GroupKFold . Returns: self : object Returns a copy of the fitted TPOT object predict(features) Use the optimized pipeline to predict the classes for a feature set. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples} Predicted classes for the samples in the feature matrix predict_proba(features) Use the optimized pipeline to estimate the class probabilities for a feature set. Note: This function will only work for pipelines whose final classifier supports the predict_proba function. TPOT will raise an error otherwise. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples, n_classes} The class probabilities of the input samples score(testing_features, testing_classes) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. The default scoring function for TPOTClassifier is 'accuracy'. Parameters: testing_features : array-like {n_samples, n_features} Feature matrix of the testing set testing_classes : array-like {n_samples} List of class labels for prediction in the testing set Returns: accuracy_score : float The estimated test set accuracy according to the user-specified scoring function. export(output_file_name, data_file_path) Export the optimized pipeline as Python code. See the usage documentation for example usage of the export function. Parameters: output_file_name : string String containing the path and file name of the desired output file data_file_path : string By default, the path of input dataset is 'PATH/TO/DATA/FILE' by default. If data_file_path is another string, the path will be replaced. Returns: exported_code_string : string The whole pipeline text as a string should be returned if output_file_name is not specified.","title":"Classification"},{"location":"api/#regression","text":"class tpot. TPOTRegressor ( generations =100, population_size =100, offspring_size =None, mutation_rate =0.9, crossover_rate =0.1, scoring ='neg_mean_squared_error', cv =5, subsample =1.0, n_jobs =1, max_time_mins =None, max_eval_time_mins =5, random_state =None, config_dict =None, template =None, warm_start =False, memory =None, use_dask =False, periodic_checkpoint_folder =None, early_stop =None, verbosity =0, disable_update_check =False ) source Automated machine learning for supervised regression tasks. The TPOTRegressor performs an intelligent search over machine learning pipelines that can contain supervised regression models, preprocessors, feature selection techniques, and any other estimator or transformer that follows the scikit-learn API . The TPOTRegressor will also search over the hyperparameters of all objects in the pipeline. By default, TPOTRegressor will search over a broad range of supervised regression models, transformers, and their hyperparameters. However, the models, transformers, and parameters that the TPOTRegressor searches over can be fully customized using the config_dict parameter. Read more in the User Guide . Parameters: generations : int or None, optional (default=100) Number of iterations to the run pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate population_size + generations \u00d7 offspring_size pipelines in total. population_size : int, optional (default=100) Number of individuals to retain in the genetic programming population every generation. Must be a positive number. Generally, TPOT will work better when you give it more individuals with which to optimize the pipeline. offspring_size : int, optional (default=None) Number of offspring to produce in each genetic programming generation. Must be a positive number. By default, the number of offspring is equal to the number of population size. mutation_rate : float, optional (default=0.9) Mutation rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the GP algorithm how many pipelines to apply random changes to every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. crossover_rate : float, optional (default=0.1) Crossover rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the genetic programming algorithm how many pipelines to \"breed\" every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. scoring : string or callable, optional (default='neg_mean_squared_error') Function used to evaluate the quality of a given pipeline for the regression problem. The following built-in scoring functions can be used: 'neg_median_absolute_error', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'r2' Note that we recommend using the neg version of mean squared error and related metrics so TPOT will minimize (instead of maximize) the metric. If you would like to use a custom scorer, you can pass the callable object/function with signature scorer(estimator, X, y) . See the section on scoring functions for more details. cv : int, cross-validation generator, or an iterable, optional (default=5) Cross-validation strategy used when evaluating pipelines. Possible inputs: integer, to specify the number of folds in a KFold, An object to be used as a cross-validation generator, or An iterable yielding train/test splits. subsample : float, optional (default=1.0) Fraction of training samples that are used during the TPOT optimization process. Must be in the range (0.0, 1.0]. Setting subsample =0.5 tells TPOT to use a random subsample of half of the training data. This subsample will remain the same during the entire pipeline optimization process. n_jobs : integer, optional (default=1) Number of processes to use in parallel for evaluating pipelines during the TPOT optimization process. Setting n_jobs =-1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Beware that using multiple processes on the same machine may cause memory issues for large datasets max_time_mins : integer or None, optional (default=None) How many minutes TPOT has to optimize the pipeline. If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generations is set and all generations are already evaluated. max_eval_time_mins : float, optional (default=5) How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to evaluate more complex pipelines, but will also allow TPOT to run longer. Use this parameter to help prevent TPOT from wasting time on evaluating time-consuming pipelines. random_state : integer or None, optional (default=None) The seed of the pseudo random number generator used in TPOT. Use this parameter to make sure that TPOT will give you the same results each time you run it against the same data set with that seed. config_dict : Python dictionary, string, or None, optional (default=None) A configuration dictionary for customizing the operators and parameters that TPOT searches in the optimization process. Possible inputs are: Python dictionary, TPOT will use your custom configuration, string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors, or string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies, or string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices, or None, TPOT will use the default TPOTRegressor configuration. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. template : string (default=None) Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer or Regressor) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html) or [`RegressorMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Regressor\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. warm_start : boolean, optional (default=False) Flag indicating whether the TPOT instance will reuse the population from previous calls to fit() . Setting warm_start =True can be useful for running TPOT for a short time on a dataset, checking the results, then resuming the TPOT run from where it left off. memory : a joblib.Memory object or string, optional (default=None) If supplied, pipeline will cache each transformer after calling fit. 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. More details about memory caching in scikit-learn documentation Possible inputs are: String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown, or Path of a caching directory, TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown, or Memory object, TPOT uses the instance of joblib.Memory for memory caching and TPOT does NOT clean the caching directory up upon shutdown, or None, TPOT does not use memory caching. use_dask : boolean, optional (default: False) Whether to use Dask-ML's pipeline optimiziations. This avoid re-fitting the same estimator on the same split of data multiple times. It will also provide more detailed diagnostics when using Dask's distributed scheduler. See avoid repeated work for more details. periodic_checkpoint_folder : path string, optional (default: None) If supplied, a folder in which TPOT will periodically save pipelines in pareto front so far while optimizing. Currently once per generation but not more often than once per 30 seconds. Useful in multiple cases: Sudden death before TPOT could save optimized pipeline Track its progress Grab pipelines while it's still optimizing early_stop : integer, optional (default: None) How many generations TPOT checks whether there is no improvement in optimization process. Ends the optimization process if there is no improvement in the given number of generations. verbosity : integer, optional (default=0) How much information TPOT communicates while it's running. Possible inputs are: 0, TPOT will print nothing, 1, TPOT will print minimal information, 2, TPOT will print more information and provide a progress bar, or 3, TPOT will print everything and provide a progress bar. disable_update_check : boolean, optional (default=False) Flag indicating whether the TPOT version checker should be disabled. The update checker will tell you when a new version of TPOT has been released. Attributes: fitted_pipeline_ : scikit-learn Pipeline object The best pipeline that TPOT discovered during the pipeline optimization process, fitted on the entire training dataset. pareto_front_fitted_pipelines_ : Python dictionary Dictionary containing the all pipelines on the TPOT Pareto front, where the key is the string representation of the pipeline and the value is the corresponding pipeline fitted on the entire training dataset. The TPOT Pareto front provides a trade-off between pipeline complexity (i.e., the number of steps in the pipeline) and the predictive performance of the pipeline. Note: _pareto_front_fitted_pipelines is only available when verbosity =3. evaluated_individuals_ : Python dictionary Dictionary containing all pipelines that were evaluated during the pipeline optimization process, where the key is the string representation of the pipeline and the value is a tuple containing (# of steps in pipeline, accuracy metric for the pipeline). This attribute is primarily for internal use, but may be useful for looking at the other pipelines that TPOT evaluated. Example from tpot import TPOTRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split digits = load_boston() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_boston_pipeline.py') Functions fit (features, target[, sample_weight, groups]) Run the TPOT optimization process on the given training data. predict (features) Use the optimized pipeline to predict the target values for a feature set. score (testing_features, testing_target) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. export (output_file_name) Export the optimized pipeline as Python code. fit(features, target, sample_weight=None, groups=None) Run the TPOT optimization process on the given training data. Uses genetic programming to optimize a machine learning pipeline that maximizes the score on the provided features and target. This pipeline optimization procedure uses internal k-fold cross-validaton to avoid overfitting on the provided data. At the end of the pipeline optimization procedure, the best pipeline is then trained on the entire set of provided samples. Parameters: features : array-like {n_samples, n_features} Feature matrix TPOT and all scikit-learn algorithms assume that the features will be numerical and there will be no missing values. As such, when a feature matrix is provided to TPOT, all missing values will automatically be replaced (i.e., imputed) using median value imputation . If you wish to use a different imputation strategy than median imputation, please make sure to apply imputation to your feature set prior to passing it to TPOT. target : array-like {n_samples} List of target labels for prediction sample_weight : array-like {n_samples}, optional Per-sample weights. Higher weights indicate more importance. If specified, sample_weight will be passed to any pipeline element whose fit() function accepts a sample_weight argument. By default, using sample_weight does not affect tpot's scoring functions, which determine preferences between pipelines. groups : array-like, with shape {n_samples, }, optional Group labels for the samples used when performing cross-validation. This parameter should only be used in conjunction with sklearn's Group cross-validation functions, such as sklearn.model_selection.GroupKFold . Returns: self : object Returns a copy of the fitted TPOT object predict(features) Use the optimized pipeline to predict the target values for a feature set. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples} Predicted target values for the samples in the feature matrix score(testing_features, testing_target) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. The default scoring function for TPOTRegressor is 'mean_squared_error'. Parameters: testing_features : array-like {n_samples, n_features} Feature matrix of the testing set testing_target : array-like {n_samples} List of target labels for prediction in the testing set Returns: accuracy_score : float The estimated test set accuracy according to the user-specified scoring function. export(output_file_name) Export the optimized pipeline as Python code. See the usage documentation for example usage of the export function. Parameters: output_file_name : string String containing the path and file name of the desired output file data_file_path : string By default, the path of input dataset is 'PATH/TO/DATA/FILE' by default. If data_file_path is another string, the path will be replaced. Returns: exported_code_string : string The whole pipeline text as a string should be returned if output_file_name is not specified.","title":"Regression"},{"location":"citing/","text":"Citing TPOT If you use TPOT in a scientific publication, please consider citing at least one of the following papers: Trang T. Le, Weixuan Fu and Jason H. Moore (2020). Scaling tree-based automated machine learning to biomedical big data with a feature set selector . Bioinformatics .36(1): 250-256. BibTeX entry: @article{le2020scaling, title={Scaling tree-based automated machine learning to biomedical big data with a feature set selector}, author={Le, Trang T and Fu, Weixuan and Moore, Jason H}, journal={Bioinformatics}, volume={36}, number={1}, pages={250--256}, year={2020}, publisher={Oxford University Press} } Randal S. Olson, Ryan J. Urbanowicz, Peter C. Andrews, Nicole A. Lavender, La Creis Kidd, and Jason H. Moore (2016). Automating biomedical data science through tree-based pipeline optimization . Applications of Evolutionary Computation , pages 123-137. BibTeX entry: @inbook{Olson2016EvoBio, author={Olson, Randal S. and Urbanowicz, Ryan J. and Andrews, Peter C. and Lavender, Nicole A. and Kidd, La Creis and Moore, Jason H.}, editor={Squillero, Giovanni and Burelli, Paolo}, chapter={Automating Biomedical Data Science Through Tree-Based Pipeline Optimization}, title={Applications of Evolutionary Computation: 19th European Conference, EvoApplications 2016, Porto, Portugal, March 30 -- April 1, 2016, Proceedings, Part I}, year={2016}, publisher={Springer International Publishing}, pages={123--137}, isbn={978-3-319-31204-0}, doi={10.1007/978-3-319-31204-0_9}, url={http://dx.doi.org/10.1007/978-3-319-31204-0_9} } Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science Randal S. Olson, Nathan Bartley, Ryan J. Urbanowicz, and Jason H. Moore (2016). Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science . Proceedings of GECCO 2016 , pages 485-492. BibTeX entry: @inproceedings{OlsonGECCO2016, author = {Olson, Randal S. and Bartley, Nathan and Urbanowicz, Ryan J. and Moore, Jason H.}, title = {Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science}, booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference 2016}, series = {GECCO '16}, year = {2016}, isbn = {978-1-4503-4206-3}, location = {Denver, Colorado, USA}, pages = {485--492}, numpages = {8}, url = {http://doi.acm.org/10.1145/2908812.2908918}, doi = {10.1145/2908812.2908918}, acmid = {2908918}, publisher = {ACM}, address = {New York, NY, USA}, } Alternatively, you can cite the repository directly with the following DOI: DOI","title":"Citing TPOT"},{"location":"citing/#citing-tpot","text":"If you use TPOT in a scientific publication, please consider citing at least one of the following papers: Trang T. Le, Weixuan Fu and Jason H. Moore (2020). Scaling tree-based automated machine learning to biomedical big data with a feature set selector . Bioinformatics .36(1): 250-256. BibTeX entry: @article{le2020scaling, title={Scaling tree-based automated machine learning to biomedical big data with a feature set selector}, author={Le, Trang T and Fu, Weixuan and Moore, Jason H}, journal={Bioinformatics}, volume={36}, number={1}, pages={250--256}, year={2020}, publisher={Oxford University Press} } Randal S. Olson, Ryan J. Urbanowicz, Peter C. Andrews, Nicole A. Lavender, La Creis Kidd, and Jason H. Moore (2016). Automating biomedical data science through tree-based pipeline optimization . Applications of Evolutionary Computation , pages 123-137. BibTeX entry: @inbook{Olson2016EvoBio, author={Olson, Randal S. and Urbanowicz, Ryan J. and Andrews, Peter C. and Lavender, Nicole A. and Kidd, La Creis and Moore, Jason H.}, editor={Squillero, Giovanni and Burelli, Paolo}, chapter={Automating Biomedical Data Science Through Tree-Based Pipeline Optimization}, title={Applications of Evolutionary Computation: 19th European Conference, EvoApplications 2016, Porto, Portugal, March 30 -- April 1, 2016, Proceedings, Part I}, year={2016}, publisher={Springer International Publishing}, pages={123--137}, isbn={978-3-319-31204-0}, doi={10.1007/978-3-319-31204-0_9}, url={http://dx.doi.org/10.1007/978-3-319-31204-0_9} } Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science Randal S. Olson, Nathan Bartley, Ryan J. Urbanowicz, and Jason H. Moore (2016). Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science . Proceedings of GECCO 2016 , pages 485-492. BibTeX entry: @inproceedings{OlsonGECCO2016, author = {Olson, Randal S. and Bartley, Nathan and Urbanowicz, Ryan J. and Moore, Jason H.}, title = {Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science}, booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference 2016}, series = {GECCO '16}, year = {2016}, isbn = {978-1-4503-4206-3}, location = {Denver, Colorado, USA}, pages = {485--492}, numpages = {8}, url = {http://doi.acm.org/10.1145/2908812.2908918}, doi = {10.1145/2908812.2908918}, acmid = {2908918}, publisher = {ACM}, address = {New York, NY, USA}, } Alternatively, you can cite the repository directly with the following DOI: DOI","title":"Citing TPOT"},{"location":"contributing/","text":"Contribution Guide We welcome you to check the existing issues for bugs or enhancements to work on. If you have an idea for an extension to TPOT, please file a new issue so we can discuss it. Project layout The latest stable release of TPOT is on the master branch , whereas the latest version of TPOT in development is on the development branch . Make sure you are looking at and working on the correct branch if you're looking to contribute code. In terms of directory structure: All of TPOT's code sources are in the tpot directory The documentation sources are in the docs_sources directory Images in the documentation are in the images directory Tutorials for TPOT are in the tutorials directory Unit tests for TPOT are in the tests.py file Make sure to familiarize yourself with the project layout before making any major contributions, and especially make sure to send all code changes to the development branch. How to contribute The preferred way to contribute to TPOT is to fork the main repository on GitHub: Fork the project repository : click on the 'Fork' button near the top of the page. This creates a copy of the code under your account on the GitHub server. Clone this copy to your local disk: $ git clone git@github.com:YourUsername/tpot.git $ cd tpot Create a branch to hold your changes: $ git checkout -b my-contribution Make sure your local environment is setup correctly for development. Installation instructions are almost identical to the user instructions except that TPOT should not be installed. If you have TPOT installed on your computer then make sure you are using a virtual environment that does not have TPOT installed. Furthermore, you should make sure you have installed the nose package into your development environment so that you can test changes locally. $ conda install nose Start making changes on your newly created branch, remembering to never work on the master branch! Work on this copy on your computer using Git to do the version control. Once some changes are saved locally, you can use your tweaked version of TPOT by navigating to the project's base directory and running TPOT directly from the command line: $ python -m tpot.driver or by running script that imports and uses the TPOT module with code similar to from tpot import TPOTClassifier To check your changes haven't broken any existing tests and to check new tests you've added pass run the following (note, you must have the nose package installed within your dev environment for this to work): $ nosetests -s -v When you're done editing and local testing, run: $ git add modified_files $ git commit to record your changes in Git, then push them to GitHub with: $ git push -u origin my-contribution Finally, go to the web page of your fork of the TPOT repo, and click 'Pull Request' (PR) to send your changes to the maintainers for review. Make sure that you send your PR to the development branch, as the master branch is reserved for the latest stable release. This will start the CI server to check all the project's unit tests run and send an email to the maintainers. (If any of the above seems like magic to you, then look up the Git documentation on the web.) Before submitting your pull request Before you submit a pull request for your contribution, please work through this checklist to make sure that you have done everything necessary so we can efficiently review and accept your changes. If your contribution changes TPOT in any way: Update the documentation so all of your changes are reflected there. Update the README if anything there has changed. If your contribution involves any code changes: Update the project unit tests to test your code changes. Make sure that your code is properly commented with docstrings and comments explaining your rationale behind non-obvious coding practices. If your code affected any of the pipeline operators, make sure that the corresponding export functionality reflects those changes. If your contribution requires a new library dependency: Double-check that the new dependency is easy to install via pip or Anaconda and supports both Python 2 and 3. If the dependency requires a complicated installation, then we most likely won't merge your changes because we want to keep TPOT easy to install. Add the required version of the library to .travis.yml Add a line to pip install the library to .travis_install.sh Add a line to print the version of the library to .travis_install.sh Similarly add a line to print the version of the library to .travis_test.sh After submitting your pull request After submitting your pull request, Travis-CI will automatically run unit tests on your changes and make sure that your updated code builds and runs on Python 2 and 3. We also use services that automatically check code quality and test coverage. Check back shortly after submitting your pull request to make sure that your code passes these checks. If any of the checks come back with a red X, then do your best to address the errors.","title":"Contributing"},{"location":"contributing/#contribution-guide","text":"We welcome you to check the existing issues for bugs or enhancements to work on. If you have an idea for an extension to TPOT, please file a new issue so we can discuss it.","title":"Contribution Guide"},{"location":"contributing/#project-layout","text":"The latest stable release of TPOT is on the master branch , whereas the latest version of TPOT in development is on the development branch . Make sure you are looking at and working on the correct branch if you're looking to contribute code. In terms of directory structure: All of TPOT's code sources are in the tpot directory The documentation sources are in the docs_sources directory Images in the documentation are in the images directory Tutorials for TPOT are in the tutorials directory Unit tests for TPOT are in the tests.py file Make sure to familiarize yourself with the project layout before making any major contributions, and especially make sure to send all code changes to the development branch.","title":"Project layout"},{"location":"contributing/#how-to-contribute","text":"The preferred way to contribute to TPOT is to fork the main repository on GitHub: Fork the project repository : click on the 'Fork' button near the top of the page. This creates a copy of the code under your account on the GitHub server. Clone this copy to your local disk: $ git clone git@github.com:YourUsername/tpot.git $ cd tpot Create a branch to hold your changes: $ git checkout -b my-contribution Make sure your local environment is setup correctly for development. Installation instructions are almost identical to the user instructions except that TPOT should not be installed. If you have TPOT installed on your computer then make sure you are using a virtual environment that does not have TPOT installed. Furthermore, you should make sure you have installed the nose package into your development environment so that you can test changes locally. $ conda install nose Start making changes on your newly created branch, remembering to never work on the master branch! Work on this copy on your computer using Git to do the version control. Once some changes are saved locally, you can use your tweaked version of TPOT by navigating to the project's base directory and running TPOT directly from the command line: $ python -m tpot.driver or by running script that imports and uses the TPOT module with code similar to from tpot import TPOTClassifier To check your changes haven't broken any existing tests and to check new tests you've added pass run the following (note, you must have the nose package installed within your dev environment for this to work): $ nosetests -s -v When you're done editing and local testing, run: $ git add modified_files $ git commit to record your changes in Git, then push them to GitHub with: $ git push -u origin my-contribution Finally, go to the web page of your fork of the TPOT repo, and click 'Pull Request' (PR) to send your changes to the maintainers for review. Make sure that you send your PR to the development branch, as the master branch is reserved for the latest stable release. This will start the CI server to check all the project's unit tests run and send an email to the maintainers. (If any of the above seems like magic to you, then look up the Git documentation on the web.)","title":"How to contribute"},{"location":"contributing/#before-submitting-your-pull-request","text":"Before you submit a pull request for your contribution, please work through this checklist to make sure that you have done everything necessary so we can efficiently review and accept your changes. If your contribution changes TPOT in any way: Update the documentation so all of your changes are reflected there. Update the README if anything there has changed. If your contribution involves any code changes: Update the project unit tests to test your code changes. Make sure that your code is properly commented with docstrings and comments explaining your rationale behind non-obvious coding practices. If your code affected any of the pipeline operators, make sure that the corresponding export functionality reflects those changes. If your contribution requires a new library dependency: Double-check that the new dependency is easy to install via pip or Anaconda and supports both Python 2 and 3. If the dependency requires a complicated installation, then we most likely won't merge your changes because we want to keep TPOT easy to install. Add the required version of the library to .travis.yml Add a line to pip install the library to .travis_install.sh Add a line to print the version of the library to .travis_install.sh Similarly add a line to print the version of the library to .travis_test.sh","title":"Before submitting your pull request"},{"location":"contributing/#after-submitting-your-pull-request","text":"After submitting your pull request, Travis-CI will automatically run unit tests on your changes and make sure that your updated code builds and runs on Python 2 and 3. We also use services that automatically check code quality and test coverage. Check back shortly after submitting your pull request to make sure that your code passes these checks. If any of the checks come back with a red X, then do your best to address the errors.","title":"After submitting your pull request"},{"location":"examples/","text":"Overview The following sections illustrate the usage of TPOT with various datasets, each belonging to a typical class of machine learning tasks. Dataset Task Task class Dataset description Jupyter notebook Iris flower classification classification link link Optical Recognition of Handwritten Digits digit recognition (image) classification link link Boston housing prices modeling regression link N/A Titanic survival analysis classification link link Bank Marketing subscription prediction classification link link MAGIC Gamma Telescope event detection classification link link Notes: - For details on how the fit() , score() and export() methods work, refer to the usage documentation . - Upon re-running the experiments, your resulting pipelines may differ (to some extent) from the ones demonstrated here. Iris flower classification The following code illustrates how TPOT can be employed for performing a simple classification task over the Iris dataset. from tpot import TPOTClassifier from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import numpy as np iris = load_iris() X_train, X_test, y_train, y_test = train_test_split(iris.data.astype(np.float64), iris.target.astype(np.float64), train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_iris_pipeline.py') Running this code should discover a pipeline (exported as tpot_iris_pipeline.py ) that achieves about 97% test accuracy: import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.pipeline import make_pipeline from sklearn.preprocessing import Normalizer from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: 0.9826086956521738 exported_pipeline = make_pipeline( Normalizer(norm=\"l2\"), KNeighborsClassifier(n_neighbors=5, p=2, weights=\"distance\") ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features) Digits dataset Below is a minimal working example with the optical recognition of handwritten digits dataset, which is an image classification problem . from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Running this code should discover a pipeline (exported as tpot_digits_pipeline.py ) that achieves about 98% test accuracy: import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline, make_union from sklearn.preprocessing import PolynomialFeatures from tpot.builtins import StackingEstimator from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: 0.9799428471757372 exported_pipeline = make_pipeline( PolynomialFeatures(degree=2, include_bias=False, interaction_only=False), StackingEstimator(estimator=LogisticRegression(C=0.1, dual=False, penalty=\"l1\")), RandomForestClassifier(bootstrap=True, criterion=\"entropy\", max_features=0.35000000000000003, min_samples_leaf=20, min_samples_split=19, n_estimators=100) ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features) Boston housing prices modeling The following code illustrates how TPOT can be employed for performing a regression task over the Boston housing prices dataset. from tpot import TPOTRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split housing = load_boston() X_train, X_test, y_train, y_test = train_test_split(housing.data, housing.target, train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_boston_pipeline.py') Running this code should discover a pipeline (exported as tpot_boston_pipeline.py ) that achieves at least 10 mean squared error (MSE) on the test set: import numpy as np import pandas as pd from sklearn.ensemble import ExtraTreesRegressor from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline from sklearn.preprocessing import PolynomialFeatures from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: -10.812040755234403 exported_pipeline = make_pipeline( PolynomialFeatures(degree=2, include_bias=False, interaction_only=False), ExtraTreesRegressor(bootstrap=False, max_features=0.5, min_samples_leaf=2, min_samples_split=3, n_estimators=100) ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features) Titanic survival analysis To see the TPOT applied the Titanic Kaggle dataset, see the Jupyter notebook here . This example shows how to take a messy dataset and preprocess it such that it can be used in scikit-learn and TPOT. Portuguese Bank Marketing The corresponding Jupyter notebook, containing the associated data preprocessing and analysis, can be found here . MAGIC Gamma Telescope The corresponding Jupyter notebook, containing the associated data preprocessing and analysis, can be found here . Neural network classifier using TPOT-NN By loading the TPOT-NN configuration dictionary , PyTorch estimators will be included for classification. Users can also create their own NN configuration dictionary that includes tpot.builtins.PytorchLRClassifier and/or tpot.builtins.PytorchMLPClassifier , or they can specify them using a template string, as shown in the following example: from tpot import TPOTClassifier from sklearn.datasets import make_blobs from sklearn.model_selection import train_test_split X, y = make_blobs(n_samples=100, centers=2, n_features=3, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.75, test_size=0.25) clf = TPOTClassifier(config_dict='TPOT NN', template='Selector-Transformer-PytorchLRClassifier', verbosity=2, population_size=10, generations=10) clf.fit(X_train, y_train) print(clf.score(X_test, y_test)) clf.export('tpot_nn_demo_pipeline.py') This example is somewhat trivial, but it should result in nearly 100% classification accuracy.","title":"Examples"},{"location":"examples/#overview","text":"The following sections illustrate the usage of TPOT with various datasets, each belonging to a typical class of machine learning tasks. Dataset Task Task class Dataset description Jupyter notebook Iris flower classification classification link link Optical Recognition of Handwritten Digits digit recognition (image) classification link link Boston housing prices modeling regression link N/A Titanic survival analysis classification link link Bank Marketing subscription prediction classification link link MAGIC Gamma Telescope event detection classification link link Notes: - For details on how the fit() , score() and export() methods work, refer to the usage documentation . - Upon re-running the experiments, your resulting pipelines may differ (to some extent) from the ones demonstrated here.","title":"Overview"},{"location":"examples/#iris-flower-classification","text":"The following code illustrates how TPOT can be employed for performing a simple classification task over the Iris dataset. from tpot import TPOTClassifier from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import numpy as np iris = load_iris() X_train, X_test, y_train, y_test = train_test_split(iris.data.astype(np.float64), iris.target.astype(np.float64), train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_iris_pipeline.py') Running this code should discover a pipeline (exported as tpot_iris_pipeline.py ) that achieves about 97% test accuracy: import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.pipeline import make_pipeline from sklearn.preprocessing import Normalizer from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: 0.9826086956521738 exported_pipeline = make_pipeline( Normalizer(norm=\"l2\"), KNeighborsClassifier(n_neighbors=5, p=2, weights=\"distance\") ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features)","title":"Iris flower classification"},{"location":"examples/#digits-dataset","text":"Below is a minimal working example with the optical recognition of handwritten digits dataset, which is an image classification problem . from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Running this code should discover a pipeline (exported as tpot_digits_pipeline.py ) that achieves about 98% test accuracy: import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline, make_union from sklearn.preprocessing import PolynomialFeatures from tpot.builtins import StackingEstimator from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: 0.9799428471757372 exported_pipeline = make_pipeline( PolynomialFeatures(degree=2, include_bias=False, interaction_only=False), StackingEstimator(estimator=LogisticRegression(C=0.1, dual=False, penalty=\"l1\")), RandomForestClassifier(bootstrap=True, criterion=\"entropy\", max_features=0.35000000000000003, min_samples_leaf=20, min_samples_split=19, n_estimators=100) ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features)","title":"Digits dataset"},{"location":"examples/#boston-housing-prices-modeling","text":"The following code illustrates how TPOT can be employed for performing a regression task over the Boston housing prices dataset. from tpot import TPOTRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split housing = load_boston() X_train, X_test, y_train, y_test = train_test_split(housing.data, housing.target, train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_boston_pipeline.py') Running this code should discover a pipeline (exported as tpot_boston_pipeline.py ) that achieves at least 10 mean squared error (MSE) on the test set: import numpy as np import pandas as pd from sklearn.ensemble import ExtraTreesRegressor from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline from sklearn.preprocessing import PolynomialFeatures from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: -10.812040755234403 exported_pipeline = make_pipeline( PolynomialFeatures(degree=2, include_bias=False, interaction_only=False), ExtraTreesRegressor(bootstrap=False, max_features=0.5, min_samples_leaf=2, min_samples_split=3, n_estimators=100) ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features)","title":"Boston housing prices modeling"},{"location":"examples/#titanic-survival-analysis","text":"To see the TPOT applied the Titanic Kaggle dataset, see the Jupyter notebook here . This example shows how to take a messy dataset and preprocess it such that it can be used in scikit-learn and TPOT.","title":"Titanic survival analysis"},{"location":"examples/#portuguese-bank-marketing","text":"The corresponding Jupyter notebook, containing the associated data preprocessing and analysis, can be found here .","title":"Portuguese Bank Marketing"},{"location":"examples/#magic-gamma-telescope","text":"The corresponding Jupyter notebook, containing the associated data preprocessing and analysis, can be found here .","title":"MAGIC Gamma Telescope"},{"location":"examples/#neural-network-classifier-using-tpot-nn","text":"By loading the TPOT-NN configuration dictionary , PyTorch estimators will be included for classification. Users can also create their own NN configuration dictionary that includes tpot.builtins.PytorchLRClassifier and/or tpot.builtins.PytorchMLPClassifier , or they can specify them using a template string, as shown in the following example: from tpot import TPOTClassifier from sklearn.datasets import make_blobs from sklearn.model_selection import train_test_split X, y = make_blobs(n_samples=100, centers=2, n_features=3, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.75, test_size=0.25) clf = TPOTClassifier(config_dict='TPOT NN', template='Selector-Transformer-PytorchLRClassifier', verbosity=2, population_size=10, generations=10) clf.fit(X_train, y_train) print(clf.score(X_test, y_test)) clf.export('tpot_nn_demo_pipeline.py') This example is somewhat trivial, but it should result in nearly 100% classification accuracy.","title":"Neural network classifier using TPOT-NN"},{"location":"installing/","text":"Installation TPOT is built on top of several existing Python libraries, including: NumPy SciPy scikit-learn DEAP update_checker tqdm stopit pandas joblib Most of the necessary Python packages can be installed via the Anaconda Python distribution , which we strongly recommend that you use. We also strongly recommend that you use of Python 3 over Python 2 if you're given the choice. You can install TPOT using pip or conda-forge . pip NumPy, SciPy, scikit-learn, pandas, joblib, and PyTorch can be installed in Anaconda via the command: conda install numpy scipy scikit-learn pandas joblib pytorch DEAP, update_checker, tqdm and stopit can be installed with pip via the command: pip install deap update_checker tqdm stopit Optionally , you can install XGBoost if you would like TPOT to use the eXtreme Gradient Boosting models. XGBoost is entirely optional, and TPOT will still function normally without XGBoost if you do not have it installed. Windows users: pip installation may not work on some Windows environments, and it may cause unexpected errors. pip install xgboost If you have issues installing XGBoost, check the XGBoost installation documentation . If you plan to use Dask for parallel training, make sure to install dask[delay] and dask[dataframe] and dask_ml . pip install dask[delayed] dask[dataframe] dask-ml fsspec>=0.3.3 If you plan to use the TPOT-MDR configuration , make sure to install scikit-mdr and scikit-rebate : pip install scikit-mdr skrebate To enable support for PyTorch -based neural networks (TPOT-NN), you will need to install PyTorch. TPOT-NN will work with either CPU or GPU PyTorch, but we strongly recommend using a GPU version, if possible, as CPU PyTorch models tend to train very slowly. We recommend following PyTorch's installation instructions customized for your operating system and Python distribution. Finally to install TPOT itself, run the following command: pip install tpot conda-forge To install tpot and its core dependencies you can use: conda install -c conda-forge tpot To install additional dependencies you can use: conda install -c conda-forge tpot xgboost dask dask-ml scikit-mdr skrebate As mentioned above, we recommend following PyTorch's installation instructions for installing it to enable support for PyTorch -based neural networks (TPOT-NN). Installation problems Please file a new issue if you run into installation problems.","title":"Installation"},{"location":"installing/#installation","text":"TPOT is built on top of several existing Python libraries, including: NumPy SciPy scikit-learn DEAP update_checker tqdm stopit pandas joblib Most of the necessary Python packages can be installed via the Anaconda Python distribution , which we strongly recommend that you use. We also strongly recommend that you use of Python 3 over Python 2 if you're given the choice. You can install TPOT using pip or conda-forge .","title":"Installation"},{"location":"installing/#pip","text":"NumPy, SciPy, scikit-learn, pandas, joblib, and PyTorch can be installed in Anaconda via the command: conda install numpy scipy scikit-learn pandas joblib pytorch DEAP, update_checker, tqdm and stopit can be installed with pip via the command: pip install deap update_checker tqdm stopit Optionally , you can install XGBoost if you would like TPOT to use the eXtreme Gradient Boosting models. XGBoost is entirely optional, and TPOT will still function normally without XGBoost if you do not have it installed. Windows users: pip installation may not work on some Windows environments, and it may cause unexpected errors. pip install xgboost If you have issues installing XGBoost, check the XGBoost installation documentation . If you plan to use Dask for parallel training, make sure to install dask[delay] and dask[dataframe] and dask_ml . pip install dask[delayed] dask[dataframe] dask-ml fsspec>=0.3.3 If you plan to use the TPOT-MDR configuration , make sure to install scikit-mdr and scikit-rebate : pip install scikit-mdr skrebate To enable support for PyTorch -based neural networks (TPOT-NN), you will need to install PyTorch. TPOT-NN will work with either CPU or GPU PyTorch, but we strongly recommend using a GPU version, if possible, as CPU PyTorch models tend to train very slowly. We recommend following PyTorch's installation instructions customized for your operating system and Python distribution. Finally to install TPOT itself, run the following command: pip install tpot","title":"pip"},{"location":"installing/#conda-forge","text":"To install tpot and its core dependencies you can use: conda install -c conda-forge tpot To install additional dependencies you can use: conda install -c conda-forge tpot xgboost dask dask-ml scikit-mdr skrebate As mentioned above, we recommend following PyTorch's installation instructions for installing it to enable support for PyTorch -based neural networks (TPOT-NN).","title":"conda-forge"},{"location":"installing/#installation-problems","text":"Please file a new issue if you run into installation problems.","title":"Installation problems"},{"location":"related/","text":"Other Automated Machine Learning (AutoML) tools and related projects: Name Language License Description Auto-WEKA Java GPL-v3 Automated model selection and hyper-parameter tuning for Weka models. auto-sklearn Python BSD-3-Clause An automated machine learning toolkit and a drop-in replacement for a scikit-learn estimator. auto_ml Python MIT Automated machine learning for analytics & production. Supports manual feature type declarations. H2O AutoML Java with Python, Scala & R APIs and web GUI Apache 2.0 Automated: data prep, hyperparameter tuning, random grid search and stacked ensembles in a distributed ML platform. devol Python MIT Automated deep neural network design via genetic programming. MLBox Python BSD-3-Clause Accurate hyper-parameter optimization in high-dimensional space with support for distributed computing. Recipe C GPL-v3 Machine-learning pipeline optimization through genetic programming. Uses grammars to define pipeline structure. Xcessiv Python Apache 2.0 A web-based application for quick, scalable, and automated hyper-parameter tuning and stacked ensembling in Python. GAMA Python Apache 2.0 Machine-learning pipeline optimization through asynchronous evaluation based genetic programming.","title":"Related"},{"location":"releases/","text":"Release Notes Version 0.11.2 Fix early_stop parameter does not work properly TPOT built-in OneHotEncoder can refit to different datasets Fix the issue that the attribute evaluated_individuals_ cannot record correct generation info. Add a new parameter log_file to output logs to a file instead of sys.stdout Fix some code quality issues and mistakes in documentations Fix minor bugs Version 0.11.1 Fix compatibility issue with scikit-learn v0.22 warm_start now saves both Primitive Sets and evaluated_pipelines_ from previous runs; Fix the error that TPOT assign wrong fitness scores to non-evaluated pipelines (interrupted by max_min_mins or KeyboardInterrupt ) ; Fix the bug that mutation operator cannot generate new pipeline when template is not default value and warm_start is True; Fix the bug that max_time_mins cannot stop optimization process when search space is limited. Fix a bug in exported codes when the exported pipeline is only 1 estimator Fix spelling mistakes in documentations Fix some code quality issues Version 0.11.0 Support for Python 3.4 and below has been officially dropped. Also support for scikit-learn 0.20 or below has been dropped. The support of a metric function with the signature score_func(y_true, y_pred) for scoring parameter has been dropped. Refine StackingEstimator for not stacking NaN/Infinity predication probabilities. Fix a bug that population doesn't persist by warm_start=True when max_time_mins is not default value. Now the random_state parameter in TPOT is used for pipeline evaluation instead of using a fixed random seed of 42 before. The set_param_recursive function has been moved to export_utils.py and it can be used in exported codes for setting random_state recursively in scikit-learn Pipeline. It is used to set random_state in fitted_pipeline_ attribute and exported pipelines. TPOT can independently use generations and max_time_mins to limit the optimization process through using one of the parameters or both. .export() function will return string of exported pipeline if output filename is not specified. Add SGDClassifier and SGDRegressor into TPOT default configs. Documentation has been updated Fix minor bugs. Version 0.10.2 TPOT v0.10.2 is the last version to support Python 2.7 and Python 3.4. Minor updates for fixing compatibility issues with the latest version of scikit-learn (version > 0.21) and xgboost (v0.90) Default value of template parameter is changed to None instead. Fix errors in documentation Version 0.10.1 Add data_file_path option into expert function for replacing 'PATH/TO/DATA/FILE' to customized dataset path in exported scripts. (Related issue #838) Change python version in CI tests to 3.7 Add CI tests for macOS. Version 0.10.0 Add a new template option to specify a desired structure for machine learning pipeline in TPOT. Check TPOT API (it will be updated once it is merge to master branch). Add FeatureSetSelector operator into TPOT for feature selection based on priori export knowledge. Please check our preprint paper for more details ( Note: it was named DatasetSelector in 1st version paper but we will rename to FeatureSetSelector in next version of the paper ) Refine n_jobs parameter to accept value below -1. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Now memory parameter can create memory cache directory if it does not exist. Fix minor bugs. Version 0.9.6 Fix a bug causing that max_time_mins parameter doesn't work when use_dask=True in TPOT 0.9.5 Now TPOT saves best pareto values best pareto pipeline s in checkpoint folder TPOT raises ImportError if operators in the TPOT configuration are not available when verbosity>2 Thank @PGijsbers for the suggestions. Now TPOT can save scores of individuals already evaluated in any generation even the evaluation process of that generation is interrupted/stopped. But it is noted that, in this case, TPOT will raise this warning message : WARNING: TPOT may not provide a good pipeline if TPOT is stopped/interrupted in a early generation. , because the pipelines in early generation, e.g. 1st generation, are evolved/modified very limited times via evolutionary algorithm. Fix bugs in configuration of TPOTRegressor Error fixes in documentation Version 0.9.5 TPOT now supports integration with Dask for parallelization + smart caching . Big thanks to the Dask dev team for making this happen! TPOT now supports for imputation/sparse matrices into predict and predict_proba functions. TPOTClassifier and TPOTRegressor now follows scikit-learn estimator API. We refined scoring parameter in TPOT API for accepting Scorer object . We refined parameters in VarianceThreshold and FeatureAgglomeration. TPOT now supports using memory caching within a Pipeline via a optional memory parameter. We improved documentation of TPOT. Version 0.9 TPOT now supports sparse matrices with a new built-in TPOT configuration, \"TPOT sparse\". We are using a custom OneHotEncoder implementation that supports missing values and continuous features. We have added an \"early stopping\" option for stopping the optimization process if no improvement is made within a set number of generations. Look up the early_stop parameter to access this functionality. TPOT now reduces the number of duplicated pipelines between generations, which saves you time during the optimization process. TPOT now supports custom scoring functions via the command-line mode. We have added a new optional argument, periodic_checkpoint_folder , that allows TPOT to periodically save the best pipeline so far to a local folder during optimization process. TPOT no longer uses sklearn.externals.joblib when n_jobs=1 to avoid the potential freezing issue that scikit-learn suffers from . We have added pandas as a dependency to read input datasets instead of numpy.recfromcsv . NumPy's recfromcsv function is unable to parse datasets with complex data types. Fixed a bug that DEFAULT in the parameter(s) of nested estimator raises KeyError when exporting pipelines. Fixed a bug related to setting random_state in nested estimators. The issue would happen with pipeline with SelectFromModel ( ExtraTreesClassifier as nested estimator) or StackingEstimator if nested estimator has random_state parameter. Fixed a bug in the missing value imputation function in TPOT to impute along columns instead rows. Refined input checking for sparse matrices in TPOT. Refined the TPOT pipeline mutation operator. Version 0.8 TPOT now detects whether there are missing values in your dataset and replaces them with the median value of the column. TPOT now allows you to set a group parameter in the fit function so you can use the GroupKFold cross-validation strategy. TPOT now allows you to set a subsample ratio of the training instance with the subsample parameter. For example, setting subsample =0.5 tells TPOT to create a fixed subsample of half of the training data for the pipeline optimization process. This parameter can be useful for speeding up the pipeline optimization process, but may give less accurate performance estimates from cross-validation. TPOT now has more built-in configurations , including TPOT MDR and TPOT light, for both classification and regression problems. TPOTClassifier and TPOTRegressor now expose three useful internal attributes, fitted_pipeline_ , pareto_front_fitted_pipelines_ , and evaluated_individuals_ . These attributes are described in the API documentation . Oh, TPOT now has thorough API documentation . Check it out! Fixed a reproducibility issue where setting random_seed didn't necessarily result in the same results every time. This bug was present since TPOT v0.7. Refined input checking in TPOT. Removed Python 2 uncompliant code. Version 0.7 TPOT now has multiprocessing support. TPOT allows you to use multiple processes in parallel to accelerate the pipeline optimization process in TPOT with the n_jobs parameter. TPOT now allows you to customize the operators and parameters considered during the optimization process , which can be accomplished with the new config_dict parameter. The format of this customized dictionary can be found in the online documentation , along with a list of built-in configurations . TPOT now allows you to specify a time limit for evaluating a single pipeline (default limit is 5 minutes) in optimization process with the max_eval_time_mins parameter, so TPOT won't spend hours evaluating overly-complex pipelines. We tweaked TPOT's underlying evolutionary optimization algorithm to work even better, including using the mu+lambda algorithm . This algorithm gives you more control of how many pipelines are generated every iteration with the offspring_size parameter. Refined the default operators and parameters in TPOT, so TPOT 0.7 should work even better than 0.6. TPOT now supports sample weights in the fitness function if some if your samples are more important to classify correctly than others. The sample weights option works the same as in scikit-learn, e.g., tpot.fit(x_train, y_train, sample_weights=sample_weights) . The default scoring metric in TPOT has been changed from balanced accuracy to accuracy, the same default metric for classification algorithms in scikit-learn. Balanced accuracy can still be used by setting scoring='balanced_accuracy' when creating a TPOT instance. Version 0.6 TPOT now supports regression problems! We have created two separate TPOTClassifier and TPOTRegressor classes to support classification and regression problems, respectively. The command-line interface also supports this feature through the -mode parameter. TPOT now allows you to specify a time limit for the optimization process with the max_time_mins parameter, so you don't need to guess how long TPOT will take any more to recommend a pipeline to you. Added a new operator that performs feature selection using ExtraTrees feature importance scores. XGBoost has been added as an optional dependency to TPOT. If you have XGBoost installed, TPOT will automatically detect your installation and use the XGBoostClassifier and XGBoostRegressor in its pipelines. TPOT now offers a verbosity level of 3 (\"science mode\"), which outputs the entire Pareto front instead of only the current best score. This feature may be useful for users looking to make a trade-off between pipeline complexity and score. Version 0.5 Major refactor: Each operator is defined in a separate class file. Hooray for easier-to-maintain code! TPOT now exports directly to scikit-learn Pipelines instead of hacky code. Internal representation of individuals now uses scikit-learn pipelines. Parameters for each operator have been optimized so TPOT spends less time exploring useless parameters. We have removed pandas as a dependency and instead use numpy matrices to store the data. TPOT now uses k-fold cross-validation when evaluating pipelines, with a default k = 3. This k parameter can be tuned when creating a new TPOT instance. Improved scoring function support : Even though TPOT uses balanced accuracy by default, you can now have TPOT use any of the scoring functions that cross_val_score supports. Added the scikit-learn Normalizer preprocessor. Minor text fixes. Version 0.4 In TPOT 0.4, we've made some major changes to the internals of TPOT and added some convenience functions. We've summarized the changes below. Added new sklearn models and preprocessors AdaBoostClassifier BernoulliNB ExtraTreesClassifier GaussianNB MultinomialNB LinearSVC PassiveAggressiveClassifier GradientBoostingClassifier RBFSampler FastICA FeatureAgglomeration Nystroem Added operator that inserts virtual features for the count of features with values of zero Reworked parameterization of TPOT operators Reduced parameter search space with information from a scikit-learn benchmark TPOT no longer generates arbitrary parameter values, but uses a fixed parameter set instead Removed XGBoost as a dependency Too many users were having install issues with XGBoost Replaced with scikit-learn's GradientBoostingClassifier Improved descriptiveness of TPOT command line parameter documentation Removed min/max/avg details during fit() when verbosity > 1 Replaced with tqdm progress bar Added tqdm as a dependency Added fit_predict() convenience function Added get_params() function so TPOT can operate in scikit-learn's cross_val_score & related functions Version 0.3 We revised the internal optimization process of TPOT to make it more efficient, in particular in regards to the model parameters that TPOT optimizes over. Version 0.2 TPOT now has the ability to export the optimized pipelines to sklearn code. Logistic regression, SVM, and k-nearest neighbors classifiers were added as pipeline operators. Previously, TPOT only included decision tree and random forest classifiers. TPOT can now use arbitrary scoring functions for the optimization process. TPOT now performs multi-objective Pareto optimization to balance model complexity (i.e., # of pipeline operators) and the score of the pipeline. Version 0.1 First public release of TPOT. Optimizes pipelines with decision trees and random forest classifiers as the model, and uses a handful of feature preprocessors.","title":"Release Notes"},{"location":"releases/#release-notes","text":"","title":"Release Notes"},{"location":"releases/#version-0112","text":"Fix early_stop parameter does not work properly TPOT built-in OneHotEncoder can refit to different datasets Fix the issue that the attribute evaluated_individuals_ cannot record correct generation info. Add a new parameter log_file to output logs to a file instead of sys.stdout Fix some code quality issues and mistakes in documentations Fix minor bugs","title":"Version 0.11.2"},{"location":"releases/#version-0111","text":"Fix compatibility issue with scikit-learn v0.22 warm_start now saves both Primitive Sets and evaluated_pipelines_ from previous runs; Fix the error that TPOT assign wrong fitness scores to non-evaluated pipelines (interrupted by max_min_mins or KeyboardInterrupt ) ; Fix the bug that mutation operator cannot generate new pipeline when template is not default value and warm_start is True; Fix the bug that max_time_mins cannot stop optimization process when search space is limited. Fix a bug in exported codes when the exported pipeline is only 1 estimator Fix spelling mistakes in documentations Fix some code quality issues","title":"Version 0.11.1"},{"location":"releases/#version-0110","text":"Support for Python 3.4 and below has been officially dropped. Also support for scikit-learn 0.20 or below has been dropped. The support of a metric function with the signature score_func(y_true, y_pred) for scoring parameter has been dropped. Refine StackingEstimator for not stacking NaN/Infinity predication probabilities. Fix a bug that population doesn't persist by warm_start=True when max_time_mins is not default value. Now the random_state parameter in TPOT is used for pipeline evaluation instead of using a fixed random seed of 42 before. The set_param_recursive function has been moved to export_utils.py and it can be used in exported codes for setting random_state recursively in scikit-learn Pipeline. It is used to set random_state in fitted_pipeline_ attribute and exported pipelines. TPOT can independently use generations and max_time_mins to limit the optimization process through using one of the parameters or both. .export() function will return string of exported pipeline if output filename is not specified. Add SGDClassifier and SGDRegressor into TPOT default configs. Documentation has been updated Fix minor bugs.","title":"Version 0.11.0"},{"location":"releases/#version-0102","text":"TPOT v0.10.2 is the last version to support Python 2.7 and Python 3.4. Minor updates for fixing compatibility issues with the latest version of scikit-learn (version > 0.21) and xgboost (v0.90) Default value of template parameter is changed to None instead. Fix errors in documentation","title":"Version 0.10.2"},{"location":"releases/#version-0101","text":"Add data_file_path option into expert function for replacing 'PATH/TO/DATA/FILE' to customized dataset path in exported scripts. (Related issue #838) Change python version in CI tests to 3.7 Add CI tests for macOS.","title":"Version 0.10.1"},{"location":"releases/#version-0100","text":"Add a new template option to specify a desired structure for machine learning pipeline in TPOT. Check TPOT API (it will be updated once it is merge to master branch). Add FeatureSetSelector operator into TPOT for feature selection based on priori export knowledge. Please check our preprint paper for more details ( Note: it was named DatasetSelector in 1st version paper but we will rename to FeatureSetSelector in next version of the paper ) Refine n_jobs parameter to accept value below -1. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Now memory parameter can create memory cache directory if it does not exist. Fix minor bugs.","title":"Version 0.10.0"},{"location":"releases/#version-096","text":"Fix a bug causing that max_time_mins parameter doesn't work when use_dask=True in TPOT 0.9.5 Now TPOT saves best pareto values best pareto pipeline s in checkpoint folder TPOT raises ImportError if operators in the TPOT configuration are not available when verbosity>2 Thank @PGijsbers for the suggestions. Now TPOT can save scores of individuals already evaluated in any generation even the evaluation process of that generation is interrupted/stopped. But it is noted that, in this case, TPOT will raise this warning message : WARNING: TPOT may not provide a good pipeline if TPOT is stopped/interrupted in a early generation. , because the pipelines in early generation, e.g. 1st generation, are evolved/modified very limited times via evolutionary algorithm. Fix bugs in configuration of TPOTRegressor Error fixes in documentation","title":"Version 0.9.6"},{"location":"releases/#version-095","text":"TPOT now supports integration with Dask for parallelization + smart caching . Big thanks to the Dask dev team for making this happen! TPOT now supports for imputation/sparse matrices into predict and predict_proba functions. TPOTClassifier and TPOTRegressor now follows scikit-learn estimator API. We refined scoring parameter in TPOT API for accepting Scorer object . We refined parameters in VarianceThreshold and FeatureAgglomeration. TPOT now supports using memory caching within a Pipeline via a optional memory parameter. We improved documentation of TPOT.","title":"Version 0.9.5"},{"location":"releases/#version-09","text":"TPOT now supports sparse matrices with a new built-in TPOT configuration, \"TPOT sparse\". We are using a custom OneHotEncoder implementation that supports missing values and continuous features. We have added an \"early stopping\" option for stopping the optimization process if no improvement is made within a set number of generations. Look up the early_stop parameter to access this functionality. TPOT now reduces the number of duplicated pipelines between generations, which saves you time during the optimization process. TPOT now supports custom scoring functions via the command-line mode. We have added a new optional argument, periodic_checkpoint_folder , that allows TPOT to periodically save the best pipeline so far to a local folder during optimization process. TPOT no longer uses sklearn.externals.joblib when n_jobs=1 to avoid the potential freezing issue that scikit-learn suffers from . We have added pandas as a dependency to read input datasets instead of numpy.recfromcsv . NumPy's recfromcsv function is unable to parse datasets with complex data types. Fixed a bug that DEFAULT in the parameter(s) of nested estimator raises KeyError when exporting pipelines. Fixed a bug related to setting random_state in nested estimators. The issue would happen with pipeline with SelectFromModel ( ExtraTreesClassifier as nested estimator) or StackingEstimator if nested estimator has random_state parameter. Fixed a bug in the missing value imputation function in TPOT to impute along columns instead rows. Refined input checking for sparse matrices in TPOT. Refined the TPOT pipeline mutation operator.","title":"Version 0.9"},{"location":"releases/#version-08","text":"TPOT now detects whether there are missing values in your dataset and replaces them with the median value of the column. TPOT now allows you to set a group parameter in the fit function so you can use the GroupKFold cross-validation strategy. TPOT now allows you to set a subsample ratio of the training instance with the subsample parameter. For example, setting subsample =0.5 tells TPOT to create a fixed subsample of half of the training data for the pipeline optimization process. This parameter can be useful for speeding up the pipeline optimization process, but may give less accurate performance estimates from cross-validation. TPOT now has more built-in configurations , including TPOT MDR and TPOT light, for both classification and regression problems. TPOTClassifier and TPOTRegressor now expose three useful internal attributes, fitted_pipeline_ , pareto_front_fitted_pipelines_ , and evaluated_individuals_ . These attributes are described in the API documentation . Oh, TPOT now has thorough API documentation . Check it out! Fixed a reproducibility issue where setting random_seed didn't necessarily result in the same results every time. This bug was present since TPOT v0.7. Refined input checking in TPOT. Removed Python 2 uncompliant code.","title":"Version 0.8"},{"location":"releases/#version-07","text":"TPOT now has multiprocessing support. TPOT allows you to use multiple processes in parallel to accelerate the pipeline optimization process in TPOT with the n_jobs parameter. TPOT now allows you to customize the operators and parameters considered during the optimization process , which can be accomplished with the new config_dict parameter. The format of this customized dictionary can be found in the online documentation , along with a list of built-in configurations . TPOT now allows you to specify a time limit for evaluating a single pipeline (default limit is 5 minutes) in optimization process with the max_eval_time_mins parameter, so TPOT won't spend hours evaluating overly-complex pipelines. We tweaked TPOT's underlying evolutionary optimization algorithm to work even better, including using the mu+lambda algorithm . This algorithm gives you more control of how many pipelines are generated every iteration with the offspring_size parameter. Refined the default operators and parameters in TPOT, so TPOT 0.7 should work even better than 0.6. TPOT now supports sample weights in the fitness function if some if your samples are more important to classify correctly than others. The sample weights option works the same as in scikit-learn, e.g., tpot.fit(x_train, y_train, sample_weights=sample_weights) . The default scoring metric in TPOT has been changed from balanced accuracy to accuracy, the same default metric for classification algorithms in scikit-learn. Balanced accuracy can still be used by setting scoring='balanced_accuracy' when creating a TPOT instance.","title":"Version 0.7"},{"location":"releases/#version-06","text":"TPOT now supports regression problems! We have created two separate TPOTClassifier and TPOTRegressor classes to support classification and regression problems, respectively. The command-line interface also supports this feature through the -mode parameter. TPOT now allows you to specify a time limit for the optimization process with the max_time_mins parameter, so you don't need to guess how long TPOT will take any more to recommend a pipeline to you. Added a new operator that performs feature selection using ExtraTrees feature importance scores. XGBoost has been added as an optional dependency to TPOT. If you have XGBoost installed, TPOT will automatically detect your installation and use the XGBoostClassifier and XGBoostRegressor in its pipelines. TPOT now offers a verbosity level of 3 (\"science mode\"), which outputs the entire Pareto front instead of only the current best score. This feature may be useful for users looking to make a trade-off between pipeline complexity and score.","title":"Version 0.6"},{"location":"releases/#version-05","text":"Major refactor: Each operator is defined in a separate class file. Hooray for easier-to-maintain code! TPOT now exports directly to scikit-learn Pipelines instead of hacky code. Internal representation of individuals now uses scikit-learn pipelines. Parameters for each operator have been optimized so TPOT spends less time exploring useless parameters. We have removed pandas as a dependency and instead use numpy matrices to store the data. TPOT now uses k-fold cross-validation when evaluating pipelines, with a default k = 3. This k parameter can be tuned when creating a new TPOT instance. Improved scoring function support : Even though TPOT uses balanced accuracy by default, you can now have TPOT use any of the scoring functions that cross_val_score supports. Added the scikit-learn Normalizer preprocessor. Minor text fixes.","title":"Version 0.5"},{"location":"releases/#version-04","text":"In TPOT 0.4, we've made some major changes to the internals of TPOT and added some convenience functions. We've summarized the changes below. Added new sklearn models and preprocessors AdaBoostClassifier BernoulliNB ExtraTreesClassifier GaussianNB MultinomialNB LinearSVC PassiveAggressiveClassifier GradientBoostingClassifier RBFSampler FastICA FeatureAgglomeration Nystroem Added operator that inserts virtual features for the count of features with values of zero Reworked parameterization of TPOT operators Reduced parameter search space with information from a scikit-learn benchmark TPOT no longer generates arbitrary parameter values, but uses a fixed parameter set instead Removed XGBoost as a dependency Too many users were having install issues with XGBoost Replaced with scikit-learn's GradientBoostingClassifier Improved descriptiveness of TPOT command line parameter documentation Removed min/max/avg details during fit() when verbosity > 1 Replaced with tqdm progress bar Added tqdm as a dependency Added fit_predict() convenience function Added get_params() function so TPOT can operate in scikit-learn's cross_val_score & related functions","title":"Version 0.4"},{"location":"releases/#version-03","text":"We revised the internal optimization process of TPOT to make it more efficient, in particular in regards to the model parameters that TPOT optimizes over.","title":"Version 0.3"},{"location":"releases/#version-02","text":"TPOT now has the ability to export the optimized pipelines to sklearn code. Logistic regression, SVM, and k-nearest neighbors classifiers were added as pipeline operators. Previously, TPOT only included decision tree and random forest classifiers. TPOT can now use arbitrary scoring functions for the optimization process. TPOT now performs multi-objective Pareto optimization to balance model complexity (i.e., # of pipeline operators) and the score of the pipeline.","title":"Version 0.2"},{"location":"releases/#version-01","text":"First public release of TPOT. Optimizes pipelines with decision trees and random forest classifiers as the model, and uses a handful of feature preprocessors.","title":"Version 0.1"},{"location":"support/","text":"TPOT was developed in the Computational Genetics Lab at the University of Pennsylvania with funding from the NIH under grant R01 AI117694. We are incredibly grateful for the support of the NIH and the University of Pennsylvania during the development of this project. The TPOT logo was designed by Todd Newmuis, who generously donated his time to the project.","title":"Support"},{"location":"using/","text":"Using TPOT What to expect from AutoML software Automated machine learning (AutoML) takes a higher-level approach to machine learning than most practitioners are used to, so we've gathered a handful of guidelines on what to expect when running AutoML software such as TPOT. AutoML algorithms aren't intended to run for only a few minutes Of course, you can run TPOT for only a few minutes and it will find a reasonably good pipeline for your dataset. However, if you don't run TPOT for long enough, it may not find the best possible pipeline for your dataset. It may even not find any suitable pipeline at all, in which case a RuntimeError('A pipeline has not yet been optimized. Please call fit() first.') will be raised. Often it is worthwhile to run multiple instances of TPOT in parallel for a long time (hours to days) to allow TPOT to thoroughly search the pipeline space for your dataset. AutoML algorithms can take a long time to finish their search AutoML algorithms aren't as simple as fitting one model on the dataset; they are considering multiple machine learning algorithms (random forests, linear models, SVMs, etc.) in a pipeline with multiple preprocessing steps (missing value imputation, scaling, PCA, feature selection, etc.), the hyperparameters for all of the models and preprocessing steps, as well as multiple ways to ensemble or stack the algorithms within the pipeline. As such, TPOT will take a while to run on larger datasets, but it's important to realize why. With the default TPOT settings (100 generations with 100 population size), TPOT will evaluate 10,000 pipeline configurations before finishing. To put this number into context, think about a grid search of 10,000 hyperparameter combinations for a machine learning algorithm and how long that grid search will take. That is 10,000 model configurations to evaluate with 10-fold cross-validation, which means that roughly 100,000 models are fit and evaluated on the training data in one grid search. That's a time-consuming procedure, even for simpler models like decision trees. Typical TPOT runs will take hours to days to finish (unless it's a small dataset), but you can always interrupt the run partway through and see the best results so far. TPOT also provides a warm_start parameter that lets you restart a TPOT run from where it left off. AutoML algorithms can recommend different solutions for the same dataset If you're working with a reasonably complex dataset or run TPOT for a short amount of time, different TPOT runs may result in different pipeline recommendations. TPOT's optimization algorithm is stochastic in nature, which means that it uses randomness (in part) to search the possible pipeline space. When two TPOT runs recommend different pipelines, this means that the TPOT runs didn't converge due to lack of time or that multiple pipelines perform more-or-less the same on your dataset. This is actually an advantage over fixed grid search techniques: TPOT is meant to be an assistant that gives you ideas on how to solve a particular machine learning problem by exploring pipeline configurations that you might have never considered, then leaves the fine-tuning to more constrained parameter tuning techniques such as grid search. TPOT with code We've taken care to design the TPOT interface to be as similar as possible to scikit-learn. TPOT can be imported just like any regular Python module. To import TPOT, type: from tpot import TPOTClassifier then create an instance of TPOT as follows: pipeline_optimizer = TPOTClassifier() It's also possible to use TPOT for regression problems with the TPOTRegressor class. Other than the class name, a TPOTRegressor is used the same way as a TPOTClassifier . You can read more about the TPOTClassifier and TPOTRegressor classes in the API documentation . Some example code with custom TPOT parameters might look like: pipeline_optimizer = TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) Now TPOT is ready to optimize a pipeline for you. You can tell TPOT to optimize a pipeline based on a data set with the fit function: pipeline_optimizer.fit(X_train, y_train) The fit function initializes the genetic programming algorithm to find the highest-scoring pipeline based on average k-fold cross-validation Then, the pipeline is trained on the entire set of provided samples, and the TPOT instance can be used as a fitted model. You can then proceed to evaluate the final pipeline on the testing set with the score function: print(pipeline_optimizer.score(X_test, y_test)) Finally, you can tell TPOT to export the corresponding Python code for the optimized pipeline to a text file with the export function: pipeline_optimizer.export('tpot_exported_pipeline.py') Once this code finishes running, tpot_exported_pipeline.py will contain the Python code for the optimized pipeline. Below is a full example script using TPOT to optimize a pipeline, score it, and export the best pipeline to a file. from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) pipeline_optimizer = TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) pipeline_optimizer.fit(X_train, y_train) print(pipeline_optimizer.score(X_test, y_test)) pipeline_optimizer.export('tpot_exported_pipeline.py') Check our examples to see TPOT applied to some specific data sets. TPOT on the command line To use TPOT via the command line, enter the following command with a path to the data file: tpot /path_to/data_file.csv An example command-line call to TPOT may look like: tpot data/mnist.csv -is , -target class -o tpot_exported_pipeline.py -g 5 -p 20 -cv 5 -s 42 -v 2 TPOT offers several arguments that can be provided at the command line. To see brief descriptions of these arguments, enter the following command: tpot --help Detailed descriptions of the command-line arguments are below. Argument Parameter Valid values Effect -is INPUT_SEPARATOR Any string Character used to separate columns in the input file. -target TARGET_NAME Any string Name of the target column in the input file. -mode TPOT_MODE ['classification', 'regression'] Whether TPOT is being used for a supervised classification or regression problem. -o OUTPUT_FILE String path to a file File to export the code for the final optimized pipeline. -g GENERATIONS Any positive integer or None Number of iterations to run the pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate POPULATION_SIZE + GENERATIONS x OFFSPRING_SIZE pipelines in total. -p POPULATION_SIZE Any positive integer Number of individuals to retain in the GP population every generation. Generally, TPOT will work better when you give it more individuals (and therefore time) to optimize the pipeline. TPOT will evaluate POPULATION_SIZE + GENERATIONS x OFFSPRING_SIZE pipelines in total. -os OFFSPRING_SIZE Any positive integer Number of offspring to produce in each GP generation. By default, OFFSPRING_SIZE = POPULATION_SIZE. -mr MUTATION_RATE [0.0, 1.0] GP mutation rate in the range [0.0, 1.0]. This tells the GP algorithm how many pipelines to apply random changes to every generation. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. -xr CROSSOVER_RATE [0.0, 1.0] GP crossover rate in the range [0.0, 1.0]. This tells the GP algorithm how many pipelines to \"breed\" every generation. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. -scoring SCORING_FN 'accuracy', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'neg_log_loss', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'neg_median_absolute_error', 'precision', 'precision_macro', 'precision_micro', 'precision_samples', 'precision_weighted', 'r2', 'recall', 'recall_macro', 'recall_micro', 'recall_samples', 'recall_weighted', 'roc_auc', 'my_module.scorer_name*' Function used to evaluate the quality of a given pipeline for the problem. By default, accuracy is used for classification and mean squared error (MSE) is used for regression. TPOT assumes that any function with \"error\" or \"loss\" in the name is meant to be minimized, whereas any other functions will be maximized. my_module.scorer_name: You can also specify your own function or a full python path to an existing one. See the section on scoring functions for more details. -cv CV Any integer > 1 Number of folds to evaluate each pipeline over in k-fold cross-validation during the TPOT optimization process. -sub SUBSAMPLE (0.0, 1.0] Subsample ratio of the training instance. Setting it to 0.5 means that TPOT randomly collects half of training samples for pipeline optimization process. -njobs NUM_JOBS Any positive integer or -1 Number of CPUs for evaluating pipelines in parallel during the TPOT optimization process. Assigning this to -1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. -maxtime MAX_TIME_MINS Any positive integer How many minutes TPOT has to optimize the pipeline. How many minutes TPOT has to optimize the pipeline.If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generationsis set and all generations are already evaluated. -maxeval MAX_EVAL_MINS Any positive float How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to consider more complex pipelines but will also allow TPOT to run longer. -s RANDOM_STATE Any positive integer Random number generator seed for reproducibility. Set this seed if you want your TPOT run to be reproducible with the same seed and data set in the future. -config CONFIG_FILE String or file path Operators and parameter configurations in TPOT: Path for configuration file: TPOT will use the path to a configuration file for customizing the operators and parameters that TPOT uses in the optimization process string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. -template TEMPLATE String Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer, Classifier or Regressor) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html), [`ClassifierMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.ClassifierMixin.html) or [`RegressorMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Classifier\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. -memory MEMORY String or file path If supplied, pipeline will cache each transformer after calling fit. 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. Memory caching mode in TPOT: Path for a caching directory: TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown. string 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown. -cf CHECKPOINT_FOLDER Folder path If supplied, a folder you created, in which tpot will periodically save pipelines in pareto front so far while optimizing. This is useful in multiple cases: sudden death before tpot could save an optimized pipeline progress tracking grabbing a pipeline while tpot is working Example: mkdir my_checkpoints -cf ./my_checkpoints -es EARLY_STOP Any positive integer How many generations TPOT checks whether there is no improvement in optimization process. End optimization process if there is no improvement in the set number of generations. -v VERBOSITY {0, 1, 2, 3} How much information TPOT communicates while it is running. 0 = none, 1 = minimal, 2 = high, 3 = all. A setting of 2 or higher will add a progress bar during the optimization procedure. -log LOG Folder path Save progress content to a file. --no-update-check Flag indicating whether the TPOT version checker should be disabled. --version Show TPOT's version number and exit. --help Show TPOT's help documentation and exit. Scoring functions TPOT makes use of sklearn.model_selection.cross_val_score for evaluating pipelines, and as such offers the same support for scoring functions. There are two ways to make use of scoring functions with TPOT: You can pass in a string to the scoring parameter from the list above. Any other strings will cause TPOT to throw an exception. You can pass the callable object/function with signature scorer(estimator, X, y) , where estimator is trained estimator to use for scoring, X are features that will be passed to estimator.predict and y are target values for X . To do this, you should implement your own function. See the example below for further explanation. from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from sklearn.metrics import make_scorer digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) # Make a custom metric function def my_custom_accuracy(y_true, y_pred): return float(sum(y_pred == y_true)) / len(y_true) # Make a custom a scorer from the custom metric function # Note: greater_is_better=False in make_scorer below would mean that the scoring function should be minimized. my_custom_scorer = make_scorer(my_custom_accuracy, greater_is_better=True) tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, scoring=my_custom_scorer) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') my_module.scorer_name : You can also use a custom score_func(y_true, y_pred) or scorer(estimator, X, y) function through the command line by adding the argument -scoring my_module.scorer to your command-line call. TPOT will import your module and use the custom scoring function from there. TPOT will include your current working directory when importing the module, so you can place it in the same directory where you are going to run TPOT. Example: -scoring sklearn.metrics.auc will use the function auc from sklearn.metrics module. Built-in TPOT configurations TPOT comes with a handful of default operators and parameter configurations that we believe work well for optimizing machine learning pipelines. Below is a list of the current built-in configurations that come with TPOT. Configuration Name Description Operators Default TPOT TPOT will search over a broad range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Some of these operators are complex and may take a long time to run, especially on larger datasets. Note: This is the default configuration for TPOT. To use this configuration, use the default value (None) for the config_dict parameter. Classification Regression TPOT light TPOT will search over a restricted range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Only simpler and fast-running operators will be used in these pipelines, so TPOT light is useful for finding quick and simple pipelines for a classification or regression problem. This configuration works for both the TPOTClassifier and TPOTRegressor. Classification Regression TPOT MDR TPOT will search over a series of feature selectors and Multifactor Dimensionality Reduction models to find a series of operators that maximize prediction accuracy. The TPOT MDR configuration is specialized for genome-wide association studies (GWAS) , and is described in detail online here . Note that TPOT MDR may be slow to run because the feature selection routines are computationally expensive, especially on large datasets. Classification Regression TPOT sparse TPOT uses a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices. This configuration works for both the TPOTClassifier and TPOTRegressor. Classification Regression TPOT-NN TPOT uses the same configuration as \"Default TPOT\" plus additional neural network estimators written in PyTorch (currently only `tpot.builtins.PytorchLRClassifier` and `tpot.builtins.PytorchMLPClassifier`). Currently only classification is supported, but future releases will include regression estimators. Classification To use any of these configurations, simply pass the string name of the configuration to the config_dict parameter (or -config on the command line). For example, to use the \"TPOT light\" configuration: from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, config_dict='TPOT light') tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Customizing TPOT's operators and parameters Beyond the default configurations that come with TPOT, in some cases it is useful to limit the algorithms and parameters that TPOT considers. For that reason, we allow users to provide TPOT with a custom configuration for its operators and parameters. The custom TPOT configuration must be in nested dictionary format, where the first level key is the path and name of the operator (e.g., sklearn.naive_bayes.MultinomialNB ) and the second level key is the corresponding parameter name for that operator (e.g., fit_prior ). The second level key should point to a list of parameter values for that parameter, e.g., 'fit_prior': [True, False] . For a simple example, the configuration could be: tpot_config = { 'sklearn.naive_bayes.GaussianNB': { }, 'sklearn.naive_bayes.BernoulliNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] }, 'sklearn.naive_bayes.MultinomialNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] } } in which case TPOT would only consider pipelines containing GaussianNB , BernoulliNB , MultinomialNB , and tune those algorithm's parameters in the ranges provided. This dictionary can be passed directly within the code to the TPOTClassifier / TPOTRegressor config_dict parameter, described above. For example: from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot_config = { 'sklearn.naive_bayes.GaussianNB': { }, 'sklearn.naive_bayes.BernoulliNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] }, 'sklearn.naive_bayes.MultinomialNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] } } tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, config_dict=tpot_config) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Command-line users must create a separate .py file with the custom configuration and provide the path to the file to the tpot call. For example, if the simple example configuration above is saved in tpot_classifier_config.py , that configuration could be used on the command line with the command: tpot data/mnist.csv -is , -target class -config tpot_classifier_config.py -g 5 -p 20 -v 2 -o tpot_exported_pipeline.py When using the command-line interface, the configuration file specified in the -config parameter must name its custom TPOT configuration tpot_config . Otherwise, TPOT will not be able to locate the configuration dictionary. For more detailed examples of how to customize TPOT's operator configuration, see the default configurations for classification and regression in TPOT's source code. Note that you must have all of the corresponding packages for the operators installed on your computer, otherwise TPOT will not be able to use them. For example, if XGBoost is not installed on your computer, then TPOT will simply not import nor use XGBoost in the pipelines it considers. Template option in TPOT Template option provides a way to specify a desired structure for machine learning pipeline, which may reduce TPOT computation time and potentially provide more interpretable results. Current implementation only supports linear pipelines. Below is a simple example to use template option. The pipelines generated/evaluated in TPOT will follow this structure: 1st step is a feature selector (a subclass of SelectorMixin ), 2nd step is a feature transformer (a subclass of TransformerMixin ) and 3rd step is a classifier for classification (a subclass of ClassifierMixin ). The last step must be Classifier for TPOTClassifier 's template but Regressor for TPOTRegressor . Note: although SelectorMixin is subclass of TransformerMixin in scikit-learn, but Transformer in this option excludes those subclasses of SelectorMixin . tpot_obj = TPOTClassifier( template='Selector-Transformer-Classifier' ) If a specific operator, e.g. SelectPercentile , is preferred for usage in the 1st step of the pipeline, the template can be defined like 'SelectPercentile-Transformer-Classifier'. FeatureSetSelector in TPOT FeatureSetSelector is a special new operator in TPOT. This operator enables feature selection based on priori expert knowledge. For example, in RNA-seq gene expression analysis, this operator can be used to select one or more gene (feature) set(s) based on GO (Gene Ontology) terms or annotated gene sets Molecular Signatures Database ( MSigDB ) in the 1st step of pipeline via template option above, in order to reduce dimensions and TPOT computation time. This operator requires a dataset list in csv format. In this csv file, there are only three columns: 1st column is feature set names, 2nd column is the total number of features in one set and 3rd column is a list of feature names (if input X is pandas.DataFrame) or indexes (if input X is numpy.ndarray) delimited by \";\". Below is a example how to use this operator in TPOT. Please check our preprint paper for more details. from tpot import TPOTClassifier import numpy as np import pandas as pd from tpot.config import classifier_config_dict test_data = pd.read_csv(\"https://raw.githubusercontent.com/EpistasisLab/tpot/master/tests/tests.csv\") test_X = test_data.drop(\"class\", axis=1) test_y = test_data['class'] # add FeatureSetSelector into tpot configuration classifier_config_dict['tpot.builtins.FeatureSetSelector'] = { 'subset_list': ['https://raw.githubusercontent.com/EpistasisLab/tpot/master/tests/subset_test.csv'], 'sel_subset': [0,1] # select only one feature set, a list of index of subset in the list above #'sel_subset': list(combinations(range(3), 2)) # select two feature sets } tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, template='FeatureSetSelector-Transformer-Classifier', config_dict=classifier_config_dict) tpot.fit(test_X, test_y) Pipeline caching in TPOT With the memory parameter, pipelines can cache the results of each transformer after fitting them. This feature is used to avoid repeated computation by transformers within a pipeline if the parameters and input data are identical to another fitted pipeline during optimization process. TPOT allows users to specify a custom directory path or joblib.Memory in case they want to re-use the memory cache in future TPOT runs (or a warm_start run). There are three methods for enabling memory caching in TPOT: from tpot import TPOTClassifier from tempfile import mkdtemp from joblib import Memory from shutil import rmtree # Method 1, auto mode: TPOT uses memory caching with a temporary directory and cleans it up upon shutdown tpot = TPOTClassifier(memory='auto') # Method 2, with a custom directory for memory caching tpot = TPOTClassifier(memory='/to/your/path') # Method 3, with a Memory object cachedir = mkdtemp() # Create a temporary folder memory = Memory(cachedir=cachedir, verbose=0) tpot = TPOTClassifier(memory=memory) # Clear the cache directory when you don't need it anymore rmtree(cachedir) Note: TPOT does NOT clean up memory caches if users set a custom directory path or Memory object. We recommend that you clean up the memory caches when you don't need it anymore. Crash/freeze issue with n_jobs > 1 under OSX or Linux Internally, TPOT uses joblib to fit estimators in parallel. This is the same parallelization framework used by scikit-learn. But it may crash/freeze with n_jobs > 1 under OSX or Linux as scikit-learn does , especially with large datasets. One solution is to configure Python's multiprocessing module to use the forkserver start method (instead of the default fork ) to manage the process pools. You can enable the forkserver mode globally for your program by putting the following codes into your main script: import multiprocessing # other imports, custom code, load data, define model... if __name__ == '__main__': multiprocessing.set_start_method('forkserver') # call scikit-learn utils or tpot utils with n_jobs > 1 here More information about these start methods can be found in the multiprocessing documentation . Parallel Training with Dask For large problems or working on Jupyter notebook, we highly recommend that you can distribute the work on a Dask cluster. The dask-examples binder has a runnable example with a small dask cluster. To use your Dask cluster to fit a TPOT model, specify the use_dask keyword when you create the TPOT estimator. Note: if use_dask=True , TPOT will use as many cores as available on the your Dask cluster. If n_jobs is specified, then it will control the chunk size (10* n_jobs if it is less then offspring size) of parallel training. estimator = TPOTEstimator(use_dask=True, n_jobs=-1) This will use use all the workers on your cluster to do the training, and use Dask-ML's pipeline rewriting to avoid re-fitting estimators multiple times on the same set of data. It will also provide fine-grained diagnostics in the distributed scheduler UI . Alternatively, Dask implements a joblib backend. You can instruct TPOT to use the distributed backend during training by specifying a joblib.parallel_backend : import joblib import distributed.joblib from dask.distributed import Client # connect to the cluster client = Client('schedueler-address') # create the estimator normally estimator = TPOTClassifier(n_jobs=-1) # perform the fit in this context manager with joblib.parallel_backend(\"dask\"): estimator.fit(X, y) See dask's distributed joblib integration for more. Neural Networks in TPOT ( tpot.nn ) Support for neural network models and deep learning is an experimental feature newly added to TPOT. Available neural network architectures are provided by the tpot.nn module. Unlike regular sklearn estimators, these models need to be written by hand, and must also inherit the appropriate base classes provided by sklearn for all of their built-in modules. In other words, they need implement methods like .fit() , fit_transform() , get_params() , etc., as described in detail on Developing scikit-learn estimators . Telling TPOT to use built-in PyTorch neural network models Mainly due to the issues described below, TPOT won't use its neural network models unless you explicitly tell it to do so. This is done as follows: Use import tpot.nn before instantiating any TPOT estimators. Use a configuration dictionary that includes one or more tpot.nn estimators, either by writing one manually, including one from a file, or by importing the configuration in tpot/config/classifier_nn.py . A very simple example that will force TPOT to only use a PyTorch-based logistic regression classifier as its main estimator is as follows: tpot_config = { 'tpot.nn.PytorchLRClassifier': { 'learning_rate': [1e-3, 1e-2, 1e-1, 0.5, 1.] } } Alternatively, use a template string including PytorchLRClassifier or PytorchMLPClassifier while loading the TPOT-NN configuration dictionary. Neural network models are notorious for being extremely sensitive to their initialization parameters, so you may need to heavily adjust tpot.nn configuration dictionaries in order to attain good performance on your dataset. A simple example of using TPOT-NN is shown in examples . Important caveats Neural network models (especially when they reach moderately large sizes) take a notoriously large amount of time and computing power to train. You should expect tpot.nn neural networks to train several orders of magnitude slower than their sklearn alternatives. This can be alleviated somewhat by training the models on computers with CUDA-enabled GPUs. TPOT will occasionally learn pipelines that stack several sklearn estimators. Mathematically, these can be nearly identical to some deep learning models. For example, by stacking several sklearn.linear_model.LogisticRegression s, you end up with a very close approximation of a Multilayer Perceptron; one of the simplest and most well known deep learning architectures. TPOT's genetic programming algorithms generally optimize these 'networks' much faster than PyTorch, which typically uses a more brute-force convex optimization approach. The problem of 'black box' model introspection is one of the most substantial criticisms and challenges of deep learning. This problem persists in tpot.nn , whereas TPOT's default estimators often are far easier to introspect.","title":"Using TPOT"},{"location":"using/#using-tpot","text":"","title":"Using TPOT"},{"location":"using/#what-to-expect-from-automl-software","text":"Automated machine learning (AutoML) takes a higher-level approach to machine learning than most practitioners are used to, so we've gathered a handful of guidelines on what to expect when running AutoML software such as TPOT.","title":"What to expect from AutoML software"},{"location":"using/#tpot-with-code","text":"We've taken care to design the TPOT interface to be as similar as possible to scikit-learn. TPOT can be imported just like any regular Python module. To import TPOT, type: from tpot import TPOTClassifier then create an instance of TPOT as follows: pipeline_optimizer = TPOTClassifier() It's also possible to use TPOT for regression problems with the TPOTRegressor class. Other than the class name, a TPOTRegressor is used the same way as a TPOTClassifier . You can read more about the TPOTClassifier and TPOTRegressor classes in the API documentation . Some example code with custom TPOT parameters might look like: pipeline_optimizer = TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) Now TPOT is ready to optimize a pipeline for you. You can tell TPOT to optimize a pipeline based on a data set with the fit function: pipeline_optimizer.fit(X_train, y_train) The fit function initializes the genetic programming algorithm to find the highest-scoring pipeline based on average k-fold cross-validation Then, the pipeline is trained on the entire set of provided samples, and the TPOT instance can be used as a fitted model. You can then proceed to evaluate the final pipeline on the testing set with the score function: print(pipeline_optimizer.score(X_test, y_test)) Finally, you can tell TPOT to export the corresponding Python code for the optimized pipeline to a text file with the export function: pipeline_optimizer.export('tpot_exported_pipeline.py') Once this code finishes running, tpot_exported_pipeline.py will contain the Python code for the optimized pipeline. Below is a full example script using TPOT to optimize a pipeline, score it, and export the best pipeline to a file. from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) pipeline_optimizer = TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) pipeline_optimizer.fit(X_train, y_train) print(pipeline_optimizer.score(X_test, y_test)) pipeline_optimizer.export('tpot_exported_pipeline.py') Check our examples to see TPOT applied to some specific data sets.","title":"TPOT with code"},{"location":"using/#tpot-on-the-command-line","text":"To use TPOT via the command line, enter the following command with a path to the data file: tpot /path_to/data_file.csv An example command-line call to TPOT may look like: tpot data/mnist.csv -is , -target class -o tpot_exported_pipeline.py -g 5 -p 20 -cv 5 -s 42 -v 2 TPOT offers several arguments that can be provided at the command line. To see brief descriptions of these arguments, enter the following command: tpot --help Detailed descriptions of the command-line arguments are below. Argument Parameter Valid values Effect -is INPUT_SEPARATOR Any string Character used to separate columns in the input file. -target TARGET_NAME Any string Name of the target column in the input file. -mode TPOT_MODE ['classification', 'regression'] Whether TPOT is being used for a supervised classification or regression problem. -o OUTPUT_FILE String path to a file File to export the code for the final optimized pipeline. -g GENERATIONS Any positive integer or None Number of iterations to run the pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate POPULATION_SIZE + GENERATIONS x OFFSPRING_SIZE pipelines in total. -p POPULATION_SIZE Any positive integer Number of individuals to retain in the GP population every generation. Generally, TPOT will work better when you give it more individuals (and therefore time) to optimize the pipeline. TPOT will evaluate POPULATION_SIZE + GENERATIONS x OFFSPRING_SIZE pipelines in total. -os OFFSPRING_SIZE Any positive integer Number of offspring to produce in each GP generation. By default, OFFSPRING_SIZE = POPULATION_SIZE. -mr MUTATION_RATE [0.0, 1.0] GP mutation rate in the range [0.0, 1.0]. This tells the GP algorithm how many pipelines to apply random changes to every generation. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. -xr CROSSOVER_RATE [0.0, 1.0] GP crossover rate in the range [0.0, 1.0]. This tells the GP algorithm how many pipelines to \"breed\" every generation. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. -scoring SCORING_FN 'accuracy', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'neg_log_loss', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'neg_median_absolute_error', 'precision', 'precision_macro', 'precision_micro', 'precision_samples', 'precision_weighted', 'r2', 'recall', 'recall_macro', 'recall_micro', 'recall_samples', 'recall_weighted', 'roc_auc', 'my_module.scorer_name*' Function used to evaluate the quality of a given pipeline for the problem. By default, accuracy is used for classification and mean squared error (MSE) is used for regression. TPOT assumes that any function with \"error\" or \"loss\" in the name is meant to be minimized, whereas any other functions will be maximized. my_module.scorer_name: You can also specify your own function or a full python path to an existing one. See the section on scoring functions for more details. -cv CV Any integer > 1 Number of folds to evaluate each pipeline over in k-fold cross-validation during the TPOT optimization process. -sub SUBSAMPLE (0.0, 1.0] Subsample ratio of the training instance. Setting it to 0.5 means that TPOT randomly collects half of training samples for pipeline optimization process. -njobs NUM_JOBS Any positive integer or -1 Number of CPUs for evaluating pipelines in parallel during the TPOT optimization process. Assigning this to -1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. -maxtime MAX_TIME_MINS Any positive integer How many minutes TPOT has to optimize the pipeline. How many minutes TPOT has to optimize the pipeline.If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generationsis set and all generations are already evaluated. -maxeval MAX_EVAL_MINS Any positive float How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to consider more complex pipelines but will also allow TPOT to run longer. -s RANDOM_STATE Any positive integer Random number generator seed for reproducibility. Set this seed if you want your TPOT run to be reproducible with the same seed and data set in the future. -config CONFIG_FILE String or file path Operators and parameter configurations in TPOT: Path for configuration file: TPOT will use the path to a configuration file for customizing the operators and parameters that TPOT uses in the optimization process string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. -template TEMPLATE String Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer, Classifier or Regressor) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html), [`ClassifierMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.ClassifierMixin.html) or [`RegressorMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Classifier\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. -memory MEMORY String or file path If supplied, pipeline will cache each transformer after calling fit. 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. Memory caching mode in TPOT: Path for a caching directory: TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown. string 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown. -cf CHECKPOINT_FOLDER Folder path If supplied, a folder you created, in which tpot will periodically save pipelines in pareto front so far while optimizing. This is useful in multiple cases: sudden death before tpot could save an optimized pipeline progress tracking grabbing a pipeline while tpot is working Example: mkdir my_checkpoints -cf ./my_checkpoints -es EARLY_STOP Any positive integer How many generations TPOT checks whether there is no improvement in optimization process. End optimization process if there is no improvement in the set number of generations. -v VERBOSITY {0, 1, 2, 3} How much information TPOT communicates while it is running. 0 = none, 1 = minimal, 2 = high, 3 = all. A setting of 2 or higher will add a progress bar during the optimization procedure. -log LOG Folder path Save progress content to a file. --no-update-check Flag indicating whether the TPOT version checker should be disabled. --version Show TPOT's version number and exit. --help Show TPOT's help documentation and exit.","title":"TPOT on the command line"},{"location":"using/#scoring-functions","text":"TPOT makes use of sklearn.model_selection.cross_val_score for evaluating pipelines, and as such offers the same support for scoring functions. There are two ways to make use of scoring functions with TPOT: You can pass in a string to the scoring parameter from the list above. Any other strings will cause TPOT to throw an exception. You can pass the callable object/function with signature scorer(estimator, X, y) , where estimator is trained estimator to use for scoring, X are features that will be passed to estimator.predict and y are target values for X . To do this, you should implement your own function. See the example below for further explanation. from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from sklearn.metrics import make_scorer digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) # Make a custom metric function def my_custom_accuracy(y_true, y_pred): return float(sum(y_pred == y_true)) / len(y_true) # Make a custom a scorer from the custom metric function # Note: greater_is_better=False in make_scorer below would mean that the scoring function should be minimized. my_custom_scorer = make_scorer(my_custom_accuracy, greater_is_better=True) tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, scoring=my_custom_scorer) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') my_module.scorer_name : You can also use a custom score_func(y_true, y_pred) or scorer(estimator, X, y) function through the command line by adding the argument -scoring my_module.scorer to your command-line call. TPOT will import your module and use the custom scoring function from there. TPOT will include your current working directory when importing the module, so you can place it in the same directory where you are going to run TPOT. Example: -scoring sklearn.metrics.auc will use the function auc from sklearn.metrics module.","title":"Scoring functions"},{"location":"using/#built-in-tpot-configurations","text":"TPOT comes with a handful of default operators and parameter configurations that we believe work well for optimizing machine learning pipelines. Below is a list of the current built-in configurations that come with TPOT. Configuration Name Description Operators Default TPOT TPOT will search over a broad range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Some of these operators are complex and may take a long time to run, especially on larger datasets. Note: This is the default configuration for TPOT. To use this configuration, use the default value (None) for the config_dict parameter. Classification Regression TPOT light TPOT will search over a restricted range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Only simpler and fast-running operators will be used in these pipelines, so TPOT light is useful for finding quick and simple pipelines for a classification or regression problem. This configuration works for both the TPOTClassifier and TPOTRegressor. Classification Regression TPOT MDR TPOT will search over a series of feature selectors and Multifactor Dimensionality Reduction models to find a series of operators that maximize prediction accuracy. The TPOT MDR configuration is specialized for genome-wide association studies (GWAS) , and is described in detail online here . Note that TPOT MDR may be slow to run because the feature selection routines are computationally expensive, especially on large datasets. Classification Regression TPOT sparse TPOT uses a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices. This configuration works for both the TPOTClassifier and TPOTRegressor. Classification Regression TPOT-NN TPOT uses the same configuration as \"Default TPOT\" plus additional neural network estimators written in PyTorch (currently only `tpot.builtins.PytorchLRClassifier` and `tpot.builtins.PytorchMLPClassifier`). Currently only classification is supported, but future releases will include regression estimators. Classification To use any of these configurations, simply pass the string name of the configuration to the config_dict parameter (or -config on the command line). For example, to use the \"TPOT light\" configuration: from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, config_dict='TPOT light') tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py')","title":"Built-in TPOT configurations"},{"location":"using/#customizing-tpots-operators-and-parameters","text":"Beyond the default configurations that come with TPOT, in some cases it is useful to limit the algorithms and parameters that TPOT considers. For that reason, we allow users to provide TPOT with a custom configuration for its operators and parameters. The custom TPOT configuration must be in nested dictionary format, where the first level key is the path and name of the operator (e.g., sklearn.naive_bayes.MultinomialNB ) and the second level key is the corresponding parameter name for that operator (e.g., fit_prior ). The second level key should point to a list of parameter values for that parameter, e.g., 'fit_prior': [True, False] . For a simple example, the configuration could be: tpot_config = { 'sklearn.naive_bayes.GaussianNB': { }, 'sklearn.naive_bayes.BernoulliNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] }, 'sklearn.naive_bayes.MultinomialNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] } } in which case TPOT would only consider pipelines containing GaussianNB , BernoulliNB , MultinomialNB , and tune those algorithm's parameters in the ranges provided. This dictionary can be passed directly within the code to the TPOTClassifier / TPOTRegressor config_dict parameter, described above. For example: from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot_config = { 'sklearn.naive_bayes.GaussianNB': { }, 'sklearn.naive_bayes.BernoulliNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] }, 'sklearn.naive_bayes.MultinomialNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] } } tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, config_dict=tpot_config) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Command-line users must create a separate .py file with the custom configuration and provide the path to the file to the tpot call. For example, if the simple example configuration above is saved in tpot_classifier_config.py , that configuration could be used on the command line with the command: tpot data/mnist.csv -is , -target class -config tpot_classifier_config.py -g 5 -p 20 -v 2 -o tpot_exported_pipeline.py When using the command-line interface, the configuration file specified in the -config parameter must name its custom TPOT configuration tpot_config . Otherwise, TPOT will not be able to locate the configuration dictionary. For more detailed examples of how to customize TPOT's operator configuration, see the default configurations for classification and regression in TPOT's source code. Note that you must have all of the corresponding packages for the operators installed on your computer, otherwise TPOT will not be able to use them. For example, if XGBoost is not installed on your computer, then TPOT will simply not import nor use XGBoost in the pipelines it considers.","title":"Customizing TPOT's operators and parameters"},{"location":"using/#template-option-in-tpot","text":"Template option provides a way to specify a desired structure for machine learning pipeline, which may reduce TPOT computation time and potentially provide more interpretable results. Current implementation only supports linear pipelines. Below is a simple example to use template option. The pipelines generated/evaluated in TPOT will follow this structure: 1st step is a feature selector (a subclass of SelectorMixin ), 2nd step is a feature transformer (a subclass of TransformerMixin ) and 3rd step is a classifier for classification (a subclass of ClassifierMixin ). The last step must be Classifier for TPOTClassifier 's template but Regressor for TPOTRegressor . Note: although SelectorMixin is subclass of TransformerMixin in scikit-learn, but Transformer in this option excludes those subclasses of SelectorMixin . tpot_obj = TPOTClassifier( template='Selector-Transformer-Classifier' ) If a specific operator, e.g. SelectPercentile , is preferred for usage in the 1st step of the pipeline, the template can be defined like 'SelectPercentile-Transformer-Classifier'.","title":"Template option in TPOT"},{"location":"using/#featuresetselector-in-tpot","text":"FeatureSetSelector is a special new operator in TPOT. This operator enables feature selection based on priori expert knowledge. For example, in RNA-seq gene expression analysis, this operator can be used to select one or more gene (feature) set(s) based on GO (Gene Ontology) terms or annotated gene sets Molecular Signatures Database ( MSigDB ) in the 1st step of pipeline via template option above, in order to reduce dimensions and TPOT computation time. This operator requires a dataset list in csv format. In this csv file, there are only three columns: 1st column is feature set names, 2nd column is the total number of features in one set and 3rd column is a list of feature names (if input X is pandas.DataFrame) or indexes (if input X is numpy.ndarray) delimited by \";\". Below is a example how to use this operator in TPOT. Please check our preprint paper for more details. from tpot import TPOTClassifier import numpy as np import pandas as pd from tpot.config import classifier_config_dict test_data = pd.read_csv(\"https://raw.githubusercontent.com/EpistasisLab/tpot/master/tests/tests.csv\") test_X = test_data.drop(\"class\", axis=1) test_y = test_data['class'] # add FeatureSetSelector into tpot configuration classifier_config_dict['tpot.builtins.FeatureSetSelector'] = { 'subset_list': ['https://raw.githubusercontent.com/EpistasisLab/tpot/master/tests/subset_test.csv'], 'sel_subset': [0,1] # select only one feature set, a list of index of subset in the list above #'sel_subset': list(combinations(range(3), 2)) # select two feature sets } tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, template='FeatureSetSelector-Transformer-Classifier', config_dict=classifier_config_dict) tpot.fit(test_X, test_y)","title":"FeatureSetSelector in TPOT"},{"location":"using/#pipeline-caching-in-tpot","text":"With the memory parameter, pipelines can cache the results of each transformer after fitting them. This feature is used to avoid repeated computation by transformers within a pipeline if the parameters and input data are identical to another fitted pipeline during optimization process. TPOT allows users to specify a custom directory path or joblib.Memory in case they want to re-use the memory cache in future TPOT runs (or a warm_start run). There are three methods for enabling memory caching in TPOT: from tpot import TPOTClassifier from tempfile import mkdtemp from joblib import Memory from shutil import rmtree # Method 1, auto mode: TPOT uses memory caching with a temporary directory and cleans it up upon shutdown tpot = TPOTClassifier(memory='auto') # Method 2, with a custom directory for memory caching tpot = TPOTClassifier(memory='/to/your/path') # Method 3, with a Memory object cachedir = mkdtemp() # Create a temporary folder memory = Memory(cachedir=cachedir, verbose=0) tpot = TPOTClassifier(memory=memory) # Clear the cache directory when you don't need it anymore rmtree(cachedir) Note: TPOT does NOT clean up memory caches if users set a custom directory path or Memory object. We recommend that you clean up the memory caches when you don't need it anymore.","title":"Pipeline caching in TPOT"},{"location":"using/#crashfreeze-issue-with-n_jobs-1-under-osx-or-linux","text":"Internally, TPOT uses joblib to fit estimators in parallel. This is the same parallelization framework used by scikit-learn. But it may crash/freeze with n_jobs > 1 under OSX or Linux as scikit-learn does , especially with large datasets. One solution is to configure Python's multiprocessing module to use the forkserver start method (instead of the default fork ) to manage the process pools. You can enable the forkserver mode globally for your program by putting the following codes into your main script: import multiprocessing # other imports, custom code, load data, define model... if __name__ == '__main__': multiprocessing.set_start_method('forkserver') # call scikit-learn utils or tpot utils with n_jobs > 1 here More information about these start methods can be found in the multiprocessing documentation .","title":"Crash/freeze issue with n_jobs > 1 under OSX or Linux"},{"location":"using/#parallel-training-with-dask","text":"For large problems or working on Jupyter notebook, we highly recommend that you can distribute the work on a Dask cluster. The dask-examples binder has a runnable example with a small dask cluster. To use your Dask cluster to fit a TPOT model, specify the use_dask keyword when you create the TPOT estimator. Note: if use_dask=True , TPOT will use as many cores as available on the your Dask cluster. If n_jobs is specified, then it will control the chunk size (10* n_jobs if it is less then offspring size) of parallel training. estimator = TPOTEstimator(use_dask=True, n_jobs=-1) This will use use all the workers on your cluster to do the training, and use Dask-ML's pipeline rewriting to avoid re-fitting estimators multiple times on the same set of data. It will also provide fine-grained diagnostics in the distributed scheduler UI . Alternatively, Dask implements a joblib backend. You can instruct TPOT to use the distributed backend during training by specifying a joblib.parallel_backend : import joblib import distributed.joblib from dask.distributed import Client # connect to the cluster client = Client('schedueler-address') # create the estimator normally estimator = TPOTClassifier(n_jobs=-1) # perform the fit in this context manager with joblib.parallel_backend(\"dask\"): estimator.fit(X, y) See dask's distributed joblib integration for more.","title":"Parallel Training with Dask"},{"location":"using/#neural-networks-in-tpot-tpotnn","text":"Support for neural network models and deep learning is an experimental feature newly added to TPOT. Available neural network architectures are provided by the tpot.nn module. Unlike regular sklearn estimators, these models need to be written by hand, and must also inherit the appropriate base classes provided by sklearn for all of their built-in modules. In other words, they need implement methods like .fit() , fit_transform() , get_params() , etc., as described in detail on Developing scikit-learn estimators .","title":"Neural Networks in TPOT (tpot.nn)"},{"location":"using/#telling-tpot-to-use-built-in-pytorch-neural-network-models","text":"Mainly due to the issues described below, TPOT won't use its neural network models unless you explicitly tell it to do so. This is done as follows: Use import tpot.nn before instantiating any TPOT estimators. Use a configuration dictionary that includes one or more tpot.nn estimators, either by writing one manually, including one from a file, or by importing the configuration in tpot/config/classifier_nn.py . A very simple example that will force TPOT to only use a PyTorch-based logistic regression classifier as its main estimator is as follows: tpot_config = { 'tpot.nn.PytorchLRClassifier': { 'learning_rate': [1e-3, 1e-2, 1e-1, 0.5, 1.] } } Alternatively, use a template string including PytorchLRClassifier or PytorchMLPClassifier while loading the TPOT-NN configuration dictionary. Neural network models are notorious for being extremely sensitive to their initialization parameters, so you may need to heavily adjust tpot.nn configuration dictionaries in order to attain good performance on your dataset. A simple example of using TPOT-NN is shown in examples .","title":"Telling TPOT to use built-in PyTorch neural network models"},{"location":"using/#important-caveats","text":"Neural network models (especially when they reach moderately large sizes) take a notoriously large amount of time and computing power to train. You should expect tpot.nn neural networks to train several orders of magnitude slower than their sklearn alternatives. This can be alleviated somewhat by training the models on computers with CUDA-enabled GPUs. TPOT will occasionally learn pipelines that stack several sklearn estimators. Mathematically, these can be nearly identical to some deep learning models. For example, by stacking several sklearn.linear_model.LogisticRegression s, you end up with a very close approximation of a Multilayer Perceptron; one of the simplest and most well known deep learning architectures. TPOT's genetic programming algorithms generally optimize these 'networks' much faster than PyTorch, which typically uses a more brute-force convex optimization approach. The problem of 'black box' model introspection is one of the most substantial criticisms and challenges of deep learning. This problem persists in tpot.nn , whereas TPOT's default estimators often are far easier to introspect.","title":"Important caveats"}]} \ No newline at end of file +{"config":{"lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Consider TPOT your Data Science Assistant . TPOT is a Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming. TPOT will automate the most tedious part of machine learning by intelligently exploring thousands of possible pipelines to find the best one for your data. An example machine learning pipeline Once TPOT is finished searching (or you get tired of waiting), it provides you with the Python code for the best pipeline it found so you can tinker with the pipeline from there. An example TPOT pipeline TPOT is built on top of scikit-learn, so all of the code it generates should look familiar... if you're familiar with scikit-learn, anyway. TPOT is still under active development and we encourage you to check back on this repository regularly for updates.","title":"Home"},{"location":"api/","text":"TPOT API Classification class tpot. TPOTClassifier ( generations =100, population_size =100, offspring_size =None, mutation_rate =0.9, crossover_rate =0.1, scoring ='accuracy', cv =5, subsample =1.0, n_jobs =1, max_time_mins =None, max_eval_time_mins =5, random_state =None, config_dict =None, template =None, warm_start =False, memory =None, use_dask =False, periodic_checkpoint_folder =None, early_stop =None, verbosity =0, disable_update_check =False, log_file =None ) source Automated machine learning for supervised classification tasks. The TPOTClassifier performs an intelligent search over machine learning pipelines that can contain supervised classification models, preprocessors, feature selection techniques, and any other estimator or transformer that follows the scikit-learn API . The TPOTClassifier will also search over the hyperparameters of all objects in the pipeline. By default, TPOTClassifier will search over a broad range of supervised classification algorithms, transformers, and their parameters. However, the algorithms, transformers, and hyperparameters that the TPOTClassifier searches over can be fully customized using the config_dict parameter. Read more in the User Guide . Parameters: generations : int or None optional (default=100) Number of iterations to the run pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate population_size + generations \u00d7 offspring_size pipelines in total. population_size : int, optional (default=100) Number of individuals to retain in the genetic programming population every generation. Must be a positive number. Generally, TPOT will work better when you give it more individuals with which to optimize the pipeline. offspring_size : int, optional (default=None) Number of offspring to produce in each genetic programming generation. Must be a positive number. By default, the number of offspring is equal to the number of population size. mutation_rate : float, optional (default=0.9) Mutation rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the GP algorithm how many pipelines to apply random changes to every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. crossover_rate : float, optional (default=0.1) Crossover rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the genetic programming algorithm how many pipelines to \"breed\" every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. scoring : string or callable, optional (default='accuracy') Function used to evaluate the quality of a given pipeline for the classification problem. The following built-in scoring functions can be used: 'accuracy', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'neg_log_loss', 'precision' etc. (suffixes apply as with \u2018f1\u2019), 'recall' etc. (suffixes apply as with \u2018f1\u2019), \u2018jaccard\u2019 etc. (suffixes apply as with \u2018f1\u2019), 'roc_auc', \u2018roc_auc_ovr\u2019, \u2018roc_auc_ovo\u2019, \u2018roc_auc_ovr_weighted\u2019, \u2018roc_auc_ovo_weighted\u2019 If you would like to use a custom scorer, you can pass the callable object/function with signature scorer(estimator, X, y) . See the section on scoring functions for more details. cv : int, cross-validation generator, or an iterable, optional (default=5) Cross-validation strategy used when evaluating pipelines. Possible inputs: integer, to specify the number of folds in a StratifiedKFold, An object to be used as a cross-validation generator, or An iterable yielding train/test splits. subsample : float, optional (default=1.0) Fraction of training samples that are used during the TPOT optimization process. Must be in the range (0.0, 1.0]. Setting subsample =0.5 tells TPOT to use a random subsample of half of the training data. This subsample will remain the same during the entire pipeline optimization process. n_jobs : integer, optional (default=1) Number of processes to use in parallel for evaluating pipelines during the TPOT optimization process. Setting n_jobs =-1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Beware that using multiple processes on the same machine may cause memory issues for large datasets. max_time_mins : integer or None, optional (default=None) How many minutes TPOT has to optimize the pipeline. If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generations is set and all generations are already evaluated. max_eval_time_mins : float, optional (default=5) How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to evaluate more complex pipelines, but will also allow TPOT to run longer. Use this parameter to help prevent TPOT from wasting time on evaluating time-consuming pipelines. random_state : integer or None, optional (default=None) The seed of the pseudo random number generator used in TPOT. Use this parameter to make sure that TPOT will give you the same results each time you run it against the same data set with that seed. config_dict : Python dictionary, string, or None, optional (default=None) A configuration dictionary for customizing the operators and parameters that TPOT searches in the optimization process. Possible inputs are: Python dictionary, TPOT will use your custom configuration, string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors, or string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies, or string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices, or None, TPOT will use the default TPOTClassifier configuration. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. template : string (default=None) Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer, Classifier) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html), [`ClassifierMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.ClassifierMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Classifier\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. warm_start : boolean, optional (default=False) Flag indicating whether the TPOT instance will reuse the population from previous calls to fit() . Setting warm_start =True can be useful for running TPOT for a short time on a dataset, checking the results, then resuming the TPOT run from where it left off. memory : a joblib.Memory object or string, optional (default=None) If supplied, pipeline will cache each transformer after calling fit. 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. More details about memory caching in scikit-learn documentation Possible inputs are: String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown, or Path of a caching directory, TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown, or Memory object, TPOT uses the instance of joblib.Memory for memory caching and TPOT does NOT clean the caching directory up upon shutdown, or None, TPOT does not use memory caching. use_dask : boolean, optional (default: False) Whether to use Dask-ML's pipeline optimiziations. This avoid re-fitting the same estimator on the same split of data multiple times. It will also provide more detailed diagnostics when using Dask's distributed scheduler. See avoid repeated work for more details. periodic_checkpoint_folder : path string, optional (default: None) If supplied, a folder in which TPOT will periodically save pipelines in pareto front so far while optimizing. Currently once per generation but not more often than once per 30 seconds. Useful in multiple cases: Sudden death before TPOT could save optimized pipeline Track its progress Grab pipelines while it's still optimizing early_stop : integer, optional (default: None) How many generations TPOT checks whether there is no improvement in optimization process. Ends the optimization process if there is no improvement in the given number of generations. verbosity : integer, optional (default=0) How much information TPOT communicates while it's running. Possible inputs are: 0, TPOT will print nothing, 1, TPOT will print minimal information, 2, TPOT will print more information and provide a progress bar, or 3, TPOT will print everything and provide a progress bar. disable_update_check : boolean, optional (default=False) Flag indicating whether the TPOT version checker should be disabled. The update checker will tell you when a new version of TPOT has been released. log_file : io.TextIOWrapper or io.StringIO, optional (defaul: sys.stdout) Save progress content to a file. Attributes: fitted_pipeline_ : scikit-learn Pipeline object The best pipeline that TPOT discovered during the pipeline optimization process, fitted on the entire training dataset. pareto_front_fitted_pipelines_ : Python dictionary Dictionary containing the all pipelines on the TPOT Pareto front, where the key is the string representation of the pipeline and the value is the corresponding pipeline fitted on the entire training dataset. The TPOT Pareto front provides a trade-off between pipeline complexity (i.e., the number of steps in the pipeline) and the predictive performance of the pipeline. Note: pareto_front_fitted_pipelines_ is only available when verbosity =3. evaluated_individuals_ : Python dictionary Dictionary containing all pipelines that were evaluated during the pipeline optimization process, where the key is the string representation of the pipeline and the value is a tuple containing (# of steps in pipeline, accuracy metric for the pipeline). This attribute is primarily for internal use, but may be useful for looking at the other pipelines that TPOT evaluated. Example from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Functions fit (features, classes[, sample_weight, groups]) Run the TPOT optimization process on the given training data. predict (features) Use the optimized pipeline to predict the classes for a feature set. predict_proba (features) Use the optimized pipeline to estimate the class probabilities for a feature set. score (testing_features, testing_classes) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. export (output_file_name) Export the optimized pipeline as Python code. fit(features, classes, sample_weight=None, groups=None) Run the TPOT optimization process on the given training data. Uses genetic programming to optimize a machine learning pipeline that maximizes the score on the provided features and target. This pipeline optimization procedure uses internal k-fold cross-validaton to avoid overfitting on the provided data. At the end of the pipeline optimization procedure, the best pipeline is then trained on the entire set of provided samples. Parameters: features : array-like {n_samples, n_features} Feature matrix TPOT and all scikit-learn algorithms assume that the features will be numerical and there will be no missing values. As such, when a feature matrix is provided to TPOT, all missing values will automatically be replaced (i.e., imputed) using median value imputation . If you wish to use a different imputation strategy than median imputation, please make sure to apply imputation to your feature set prior to passing it to TPOT. classes : array-like {n_samples} List of class labels for prediction sample_weight : array-like {n_samples}, optional Per-sample weights. Higher weights indicate more importance. If specified, sample_weight will be passed to any pipeline element whose fit() function accepts a sample_weight argument. By default, using sample_weight does not affect tpot's scoring functions, which determine preferences between pipelines. groups : array-like, with shape {n_samples, }, optional Group labels for the samples used when performing cross-validation. This parameter should only be used in conjunction with sklearn's Group cross-validation functions, such as sklearn.model_selection.GroupKFold . Returns: self : object Returns a copy of the fitted TPOT object predict(features) Use the optimized pipeline to predict the classes for a feature set. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples} Predicted classes for the samples in the feature matrix predict_proba(features) Use the optimized pipeline to estimate the class probabilities for a feature set. Note: This function will only work for pipelines whose final classifier supports the predict_proba function. TPOT will raise an error otherwise. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples, n_classes} The class probabilities of the input samples score(testing_features, testing_classes) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. The default scoring function for TPOTClassifier is 'accuracy'. Parameters: testing_features : array-like {n_samples, n_features} Feature matrix of the testing set testing_classes : array-like {n_samples} List of class labels for prediction in the testing set Returns: accuracy_score : float The estimated test set accuracy according to the user-specified scoring function. export(output_file_name, data_file_path) Export the optimized pipeline as Python code. See the usage documentation for example usage of the export function. Parameters: output_file_name : string String containing the path and file name of the desired output file data_file_path : string By default, the path of input dataset is 'PATH/TO/DATA/FILE' by default. If data_file_path is another string, the path will be replaced. Returns: exported_code_string : string The whole pipeline text as a string should be returned if output_file_name is not specified. Regression class tpot. TPOTRegressor ( generations =100, population_size =100, offspring_size =None, mutation_rate =0.9, crossover_rate =0.1, scoring ='neg_mean_squared_error', cv =5, subsample =1.0, n_jobs =1, max_time_mins =None, max_eval_time_mins =5, random_state =None, config_dict =None, template =None, warm_start =False, memory =None, use_dask =False, periodic_checkpoint_folder =None, early_stop =None, verbosity =0, disable_update_check =False ) source Automated machine learning for supervised regression tasks. The TPOTRegressor performs an intelligent search over machine learning pipelines that can contain supervised regression models, preprocessors, feature selection techniques, and any other estimator or transformer that follows the scikit-learn API . The TPOTRegressor will also search over the hyperparameters of all objects in the pipeline. By default, TPOTRegressor will search over a broad range of supervised regression models, transformers, and their hyperparameters. However, the models, transformers, and parameters that the TPOTRegressor searches over can be fully customized using the config_dict parameter. Read more in the User Guide . Parameters: generations : int or None, optional (default=100) Number of iterations to the run pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate population_size + generations \u00d7 offspring_size pipelines in total. population_size : int, optional (default=100) Number of individuals to retain in the genetic programming population every generation. Must be a positive number. Generally, TPOT will work better when you give it more individuals with which to optimize the pipeline. offspring_size : int, optional (default=None) Number of offspring to produce in each genetic programming generation. Must be a positive number. By default, the number of offspring is equal to the number of population size. mutation_rate : float, optional (default=0.9) Mutation rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the GP algorithm how many pipelines to apply random changes to every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. crossover_rate : float, optional (default=0.1) Crossover rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the genetic programming algorithm how many pipelines to \"breed\" every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. scoring : string or callable, optional (default='neg_mean_squared_error') Function used to evaluate the quality of a given pipeline for the regression problem. The following built-in scoring functions can be used: 'neg_median_absolute_error', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'r2' Note that we recommend using the neg version of mean squared error and related metrics so TPOT will minimize (instead of maximize) the metric. If you would like to use a custom scorer, you can pass the callable object/function with signature scorer(estimator, X, y) . See the section on scoring functions for more details. cv : int, cross-validation generator, or an iterable, optional (default=5) Cross-validation strategy used when evaluating pipelines. Possible inputs: integer, to specify the number of folds in a KFold, An object to be used as a cross-validation generator, or An iterable yielding train/test splits. subsample : float, optional (default=1.0) Fraction of training samples that are used during the TPOT optimization process. Must be in the range (0.0, 1.0]. Setting subsample =0.5 tells TPOT to use a random subsample of half of the training data. This subsample will remain the same during the entire pipeline optimization process. n_jobs : integer, optional (default=1) Number of processes to use in parallel for evaluating pipelines during the TPOT optimization process. Setting n_jobs =-1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Beware that using multiple processes on the same machine may cause memory issues for large datasets max_time_mins : integer or None, optional (default=None) How many minutes TPOT has to optimize the pipeline. If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generations is set and all generations are already evaluated. max_eval_time_mins : float, optional (default=5) How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to evaluate more complex pipelines, but will also allow TPOT to run longer. Use this parameter to help prevent TPOT from wasting time on evaluating time-consuming pipelines. random_state : integer or None, optional (default=None) The seed of the pseudo random number generator used in TPOT. Use this parameter to make sure that TPOT will give you the same results each time you run it against the same data set with that seed. config_dict : Python dictionary, string, or None, optional (default=None) A configuration dictionary for customizing the operators and parameters that TPOT searches in the optimization process. Possible inputs are: Python dictionary, TPOT will use your custom configuration, string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors, or string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies, or string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices, or None, TPOT will use the default TPOTRegressor configuration. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. template : string (default=None) Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer or Regressor) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html) or [`RegressorMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Regressor\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. warm_start : boolean, optional (default=False) Flag indicating whether the TPOT instance will reuse the population from previous calls to fit() . Setting warm_start =True can be useful for running TPOT for a short time on a dataset, checking the results, then resuming the TPOT run from where it left off. memory : a joblib.Memory object or string, optional (default=None) If supplied, pipeline will cache each transformer after calling fit. 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. More details about memory caching in scikit-learn documentation Possible inputs are: String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown, or Path of a caching directory, TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown, or Memory object, TPOT uses the instance of joblib.Memory for memory caching and TPOT does NOT clean the caching directory up upon shutdown, or None, TPOT does not use memory caching. use_dask : boolean, optional (default: False) Whether to use Dask-ML's pipeline optimiziations. This avoid re-fitting the same estimator on the same split of data multiple times. It will also provide more detailed diagnostics when using Dask's distributed scheduler. See avoid repeated work for more details. periodic_checkpoint_folder : path string, optional (default: None) If supplied, a folder in which TPOT will periodically save pipelines in pareto front so far while optimizing. Currently once per generation but not more often than once per 30 seconds. Useful in multiple cases: Sudden death before TPOT could save optimized pipeline Track its progress Grab pipelines while it's still optimizing early_stop : integer, optional (default: None) How many generations TPOT checks whether there is no improvement in optimization process. Ends the optimization process if there is no improvement in the given number of generations. verbosity : integer, optional (default=0) How much information TPOT communicates while it's running. Possible inputs are: 0, TPOT will print nothing, 1, TPOT will print minimal information, 2, TPOT will print more information and provide a progress bar, or 3, TPOT will print everything and provide a progress bar. disable_update_check : boolean, optional (default=False) Flag indicating whether the TPOT version checker should be disabled. The update checker will tell you when a new version of TPOT has been released. Attributes: fitted_pipeline_ : scikit-learn Pipeline object The best pipeline that TPOT discovered during the pipeline optimization process, fitted on the entire training dataset. pareto_front_fitted_pipelines_ : Python dictionary Dictionary containing the all pipelines on the TPOT Pareto front, where the key is the string representation of the pipeline and the value is the corresponding pipeline fitted on the entire training dataset. The TPOT Pareto front provides a trade-off between pipeline complexity (i.e., the number of steps in the pipeline) and the predictive performance of the pipeline. Note: _pareto_front_fitted_pipelines is only available when verbosity =3. evaluated_individuals_ : Python dictionary Dictionary containing all pipelines that were evaluated during the pipeline optimization process, where the key is the string representation of the pipeline and the value is a tuple containing (# of steps in pipeline, accuracy metric for the pipeline). This attribute is primarily for internal use, but may be useful for looking at the other pipelines that TPOT evaluated. Example from tpot import TPOTRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split digits = load_boston() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_boston_pipeline.py') Functions fit (features, target[, sample_weight, groups]) Run the TPOT optimization process on the given training data. predict (features) Use the optimized pipeline to predict the target values for a feature set. score (testing_features, testing_target) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. export (output_file_name) Export the optimized pipeline as Python code. fit(features, target, sample_weight=None, groups=None) Run the TPOT optimization process on the given training data. Uses genetic programming to optimize a machine learning pipeline that maximizes the score on the provided features and target. This pipeline optimization procedure uses internal k-fold cross-validaton to avoid overfitting on the provided data. At the end of the pipeline optimization procedure, the best pipeline is then trained on the entire set of provided samples. Parameters: features : array-like {n_samples, n_features} Feature matrix TPOT and all scikit-learn algorithms assume that the features will be numerical and there will be no missing values. As such, when a feature matrix is provided to TPOT, all missing values will automatically be replaced (i.e., imputed) using median value imputation . If you wish to use a different imputation strategy than median imputation, please make sure to apply imputation to your feature set prior to passing it to TPOT. target : array-like {n_samples} List of target labels for prediction sample_weight : array-like {n_samples}, optional Per-sample weights. Higher weights indicate more importance. If specified, sample_weight will be passed to any pipeline element whose fit() function accepts a sample_weight argument. By default, using sample_weight does not affect tpot's scoring functions, which determine preferences between pipelines. groups : array-like, with shape {n_samples, }, optional Group labels for the samples used when performing cross-validation. This parameter should only be used in conjunction with sklearn's Group cross-validation functions, such as sklearn.model_selection.GroupKFold . Returns: self : object Returns a copy of the fitted TPOT object predict(features) Use the optimized pipeline to predict the target values for a feature set. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples} Predicted target values for the samples in the feature matrix score(testing_features, testing_target) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. The default scoring function for TPOTRegressor is 'mean_squared_error'. Parameters: testing_features : array-like {n_samples, n_features} Feature matrix of the testing set testing_target : array-like {n_samples} List of target labels for prediction in the testing set Returns: accuracy_score : float The estimated test set accuracy according to the user-specified scoring function. export(output_file_name) Export the optimized pipeline as Python code. See the usage documentation for example usage of the export function. Parameters: output_file_name : string String containing the path and file name of the desired output file data_file_path : string By default, the path of input dataset is 'PATH/TO/DATA/FILE' by default. If data_file_path is another string, the path will be replaced. Returns: exported_code_string : string The whole pipeline text as a string should be returned if output_file_name is not specified.","title":"TPOT API"},{"location":"api/#tpot-api","text":"","title":"TPOT API"},{"location":"api/#classification","text":"class tpot. TPOTClassifier ( generations =100, population_size =100, offspring_size =None, mutation_rate =0.9, crossover_rate =0.1, scoring ='accuracy', cv =5, subsample =1.0, n_jobs =1, max_time_mins =None, max_eval_time_mins =5, random_state =None, config_dict =None, template =None, warm_start =False, memory =None, use_dask =False, periodic_checkpoint_folder =None, early_stop =None, verbosity =0, disable_update_check =False, log_file =None ) source Automated machine learning for supervised classification tasks. The TPOTClassifier performs an intelligent search over machine learning pipelines that can contain supervised classification models, preprocessors, feature selection techniques, and any other estimator or transformer that follows the scikit-learn API . The TPOTClassifier will also search over the hyperparameters of all objects in the pipeline. By default, TPOTClassifier will search over a broad range of supervised classification algorithms, transformers, and their parameters. However, the algorithms, transformers, and hyperparameters that the TPOTClassifier searches over can be fully customized using the config_dict parameter. Read more in the User Guide . Parameters: generations : int or None optional (default=100) Number of iterations to the run pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate population_size + generations \u00d7 offspring_size pipelines in total. population_size : int, optional (default=100) Number of individuals to retain in the genetic programming population every generation. Must be a positive number. Generally, TPOT will work better when you give it more individuals with which to optimize the pipeline. offspring_size : int, optional (default=None) Number of offspring to produce in each genetic programming generation. Must be a positive number. By default, the number of offspring is equal to the number of population size. mutation_rate : float, optional (default=0.9) Mutation rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the GP algorithm how many pipelines to apply random changes to every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. crossover_rate : float, optional (default=0.1) Crossover rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the genetic programming algorithm how many pipelines to \"breed\" every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. scoring : string or callable, optional (default='accuracy') Function used to evaluate the quality of a given pipeline for the classification problem. The following built-in scoring functions can be used: 'accuracy', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'neg_log_loss', 'precision' etc. (suffixes apply as with \u2018f1\u2019), 'recall' etc. (suffixes apply as with \u2018f1\u2019), \u2018jaccard\u2019 etc. (suffixes apply as with \u2018f1\u2019), 'roc_auc', \u2018roc_auc_ovr\u2019, \u2018roc_auc_ovo\u2019, \u2018roc_auc_ovr_weighted\u2019, \u2018roc_auc_ovo_weighted\u2019 If you would like to use a custom scorer, you can pass the callable object/function with signature scorer(estimator, X, y) . See the section on scoring functions for more details. cv : int, cross-validation generator, or an iterable, optional (default=5) Cross-validation strategy used when evaluating pipelines. Possible inputs: integer, to specify the number of folds in a StratifiedKFold, An object to be used as a cross-validation generator, or An iterable yielding train/test splits. subsample : float, optional (default=1.0) Fraction of training samples that are used during the TPOT optimization process. Must be in the range (0.0, 1.0]. Setting subsample =0.5 tells TPOT to use a random subsample of half of the training data. This subsample will remain the same during the entire pipeline optimization process. n_jobs : integer, optional (default=1) Number of processes to use in parallel for evaluating pipelines during the TPOT optimization process. Setting n_jobs =-1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Beware that using multiple processes on the same machine may cause memory issues for large datasets. max_time_mins : integer or None, optional (default=None) How many minutes TPOT has to optimize the pipeline. If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generations is set and all generations are already evaluated. max_eval_time_mins : float, optional (default=5) How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to evaluate more complex pipelines, but will also allow TPOT to run longer. Use this parameter to help prevent TPOT from wasting time on evaluating time-consuming pipelines. random_state : integer or None, optional (default=None) The seed of the pseudo random number generator used in TPOT. Use this parameter to make sure that TPOT will give you the same results each time you run it against the same data set with that seed. config_dict : Python dictionary, string, or None, optional (default=None) A configuration dictionary for customizing the operators and parameters that TPOT searches in the optimization process. Possible inputs are: Python dictionary, TPOT will use your custom configuration, string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors, or string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies, or string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices, or None, TPOT will use the default TPOTClassifier configuration. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. template : string (default=None) Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer, Classifier) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html), [`ClassifierMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.ClassifierMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Classifier\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. warm_start : boolean, optional (default=False) Flag indicating whether the TPOT instance will reuse the population from previous calls to fit() . Setting warm_start =True can be useful for running TPOT for a short time on a dataset, checking the results, then resuming the TPOT run from where it left off. memory : a joblib.Memory object or string, optional (default=None) If supplied, pipeline will cache each transformer after calling fit. 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. More details about memory caching in scikit-learn documentation Possible inputs are: String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown, or Path of a caching directory, TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown, or Memory object, TPOT uses the instance of joblib.Memory for memory caching and TPOT does NOT clean the caching directory up upon shutdown, or None, TPOT does not use memory caching. use_dask : boolean, optional (default: False) Whether to use Dask-ML's pipeline optimiziations. This avoid re-fitting the same estimator on the same split of data multiple times. It will also provide more detailed diagnostics when using Dask's distributed scheduler. See avoid repeated work for more details. periodic_checkpoint_folder : path string, optional (default: None) If supplied, a folder in which TPOT will periodically save pipelines in pareto front so far while optimizing. Currently once per generation but not more often than once per 30 seconds. Useful in multiple cases: Sudden death before TPOT could save optimized pipeline Track its progress Grab pipelines while it's still optimizing early_stop : integer, optional (default: None) How many generations TPOT checks whether there is no improvement in optimization process. Ends the optimization process if there is no improvement in the given number of generations. verbosity : integer, optional (default=0) How much information TPOT communicates while it's running. Possible inputs are: 0, TPOT will print nothing, 1, TPOT will print minimal information, 2, TPOT will print more information and provide a progress bar, or 3, TPOT will print everything and provide a progress bar. disable_update_check : boolean, optional (default=False) Flag indicating whether the TPOT version checker should be disabled. The update checker will tell you when a new version of TPOT has been released. log_file : io.TextIOWrapper or io.StringIO, optional (defaul: sys.stdout) Save progress content to a file. Attributes: fitted_pipeline_ : scikit-learn Pipeline object The best pipeline that TPOT discovered during the pipeline optimization process, fitted on the entire training dataset. pareto_front_fitted_pipelines_ : Python dictionary Dictionary containing the all pipelines on the TPOT Pareto front, where the key is the string representation of the pipeline and the value is the corresponding pipeline fitted on the entire training dataset. The TPOT Pareto front provides a trade-off between pipeline complexity (i.e., the number of steps in the pipeline) and the predictive performance of the pipeline. Note: pareto_front_fitted_pipelines_ is only available when verbosity =3. evaluated_individuals_ : Python dictionary Dictionary containing all pipelines that were evaluated during the pipeline optimization process, where the key is the string representation of the pipeline and the value is a tuple containing (# of steps in pipeline, accuracy metric for the pipeline). This attribute is primarily for internal use, but may be useful for looking at the other pipelines that TPOT evaluated. Example from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Functions fit (features, classes[, sample_weight, groups]) Run the TPOT optimization process on the given training data. predict (features) Use the optimized pipeline to predict the classes for a feature set. predict_proba (features) Use the optimized pipeline to estimate the class probabilities for a feature set. score (testing_features, testing_classes) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. export (output_file_name) Export the optimized pipeline as Python code. fit(features, classes, sample_weight=None, groups=None) Run the TPOT optimization process on the given training data. Uses genetic programming to optimize a machine learning pipeline that maximizes the score on the provided features and target. This pipeline optimization procedure uses internal k-fold cross-validaton to avoid overfitting on the provided data. At the end of the pipeline optimization procedure, the best pipeline is then trained on the entire set of provided samples. Parameters: features : array-like {n_samples, n_features} Feature matrix TPOT and all scikit-learn algorithms assume that the features will be numerical and there will be no missing values. As such, when a feature matrix is provided to TPOT, all missing values will automatically be replaced (i.e., imputed) using median value imputation . If you wish to use a different imputation strategy than median imputation, please make sure to apply imputation to your feature set prior to passing it to TPOT. classes : array-like {n_samples} List of class labels for prediction sample_weight : array-like {n_samples}, optional Per-sample weights. Higher weights indicate more importance. If specified, sample_weight will be passed to any pipeline element whose fit() function accepts a sample_weight argument. By default, using sample_weight does not affect tpot's scoring functions, which determine preferences between pipelines. groups : array-like, with shape {n_samples, }, optional Group labels for the samples used when performing cross-validation. This parameter should only be used in conjunction with sklearn's Group cross-validation functions, such as sklearn.model_selection.GroupKFold . Returns: self : object Returns a copy of the fitted TPOT object predict(features) Use the optimized pipeline to predict the classes for a feature set. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples} Predicted classes for the samples in the feature matrix predict_proba(features) Use the optimized pipeline to estimate the class probabilities for a feature set. Note: This function will only work for pipelines whose final classifier supports the predict_proba function. TPOT will raise an error otherwise. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples, n_classes} The class probabilities of the input samples score(testing_features, testing_classes) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. The default scoring function for TPOTClassifier is 'accuracy'. Parameters: testing_features : array-like {n_samples, n_features} Feature matrix of the testing set testing_classes : array-like {n_samples} List of class labels for prediction in the testing set Returns: accuracy_score : float The estimated test set accuracy according to the user-specified scoring function. export(output_file_name, data_file_path) Export the optimized pipeline as Python code. See the usage documentation for example usage of the export function. Parameters: output_file_name : string String containing the path and file name of the desired output file data_file_path : string By default, the path of input dataset is 'PATH/TO/DATA/FILE' by default. If data_file_path is another string, the path will be replaced. Returns: exported_code_string : string The whole pipeline text as a string should be returned if output_file_name is not specified.","title":"Classification"},{"location":"api/#regression","text":"class tpot. TPOTRegressor ( generations =100, population_size =100, offspring_size =None, mutation_rate =0.9, crossover_rate =0.1, scoring ='neg_mean_squared_error', cv =5, subsample =1.0, n_jobs =1, max_time_mins =None, max_eval_time_mins =5, random_state =None, config_dict =None, template =None, warm_start =False, memory =None, use_dask =False, periodic_checkpoint_folder =None, early_stop =None, verbosity =0, disable_update_check =False ) source Automated machine learning for supervised regression tasks. The TPOTRegressor performs an intelligent search over machine learning pipelines that can contain supervised regression models, preprocessors, feature selection techniques, and any other estimator or transformer that follows the scikit-learn API . The TPOTRegressor will also search over the hyperparameters of all objects in the pipeline. By default, TPOTRegressor will search over a broad range of supervised regression models, transformers, and their hyperparameters. However, the models, transformers, and parameters that the TPOTRegressor searches over can be fully customized using the config_dict parameter. Read more in the User Guide . Parameters: generations : int or None, optional (default=100) Number of iterations to the run pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate population_size + generations \u00d7 offspring_size pipelines in total. population_size : int, optional (default=100) Number of individuals to retain in the genetic programming population every generation. Must be a positive number. Generally, TPOT will work better when you give it more individuals with which to optimize the pipeline. offspring_size : int, optional (default=None) Number of offspring to produce in each genetic programming generation. Must be a positive number. By default, the number of offspring is equal to the number of population size. mutation_rate : float, optional (default=0.9) Mutation rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the GP algorithm how many pipelines to apply random changes to every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. crossover_rate : float, optional (default=0.1) Crossover rate for the genetic programming algorithm in the range [0.0, 1.0]. This parameter tells the genetic programming algorithm how many pipelines to \"breed\" every generation. mutation_rate + crossover_rate cannot exceed 1.0. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. scoring : string or callable, optional (default='neg_mean_squared_error') Function used to evaluate the quality of a given pipeline for the regression problem. The following built-in scoring functions can be used: 'neg_median_absolute_error', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'r2' Note that we recommend using the neg version of mean squared error and related metrics so TPOT will minimize (instead of maximize) the metric. If you would like to use a custom scorer, you can pass the callable object/function with signature scorer(estimator, X, y) . See the section on scoring functions for more details. cv : int, cross-validation generator, or an iterable, optional (default=5) Cross-validation strategy used when evaluating pipelines. Possible inputs: integer, to specify the number of folds in a KFold, An object to be used as a cross-validation generator, or An iterable yielding train/test splits. subsample : float, optional (default=1.0) Fraction of training samples that are used during the TPOT optimization process. Must be in the range (0.0, 1.0]. Setting subsample =0.5 tells TPOT to use a random subsample of half of the training data. This subsample will remain the same during the entire pipeline optimization process. n_jobs : integer, optional (default=1) Number of processes to use in parallel for evaluating pipelines during the TPOT optimization process. Setting n_jobs =-1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Beware that using multiple processes on the same machine may cause memory issues for large datasets max_time_mins : integer or None, optional (default=None) How many minutes TPOT has to optimize the pipeline. If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generations is set and all generations are already evaluated. max_eval_time_mins : float, optional (default=5) How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to evaluate more complex pipelines, but will also allow TPOT to run longer. Use this parameter to help prevent TPOT from wasting time on evaluating time-consuming pipelines. random_state : integer or None, optional (default=None) The seed of the pseudo random number generator used in TPOT. Use this parameter to make sure that TPOT will give you the same results each time you run it against the same data set with that seed. config_dict : Python dictionary, string, or None, optional (default=None) A configuration dictionary for customizing the operators and parameters that TPOT searches in the optimization process. Possible inputs are: Python dictionary, TPOT will use your custom configuration, string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors, or string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies, or string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices, or None, TPOT will use the default TPOTRegressor configuration. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. template : string (default=None) Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer or Regressor) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html) or [`RegressorMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Regressor\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. warm_start : boolean, optional (default=False) Flag indicating whether the TPOT instance will reuse the population from previous calls to fit() . Setting warm_start =True can be useful for running TPOT for a short time on a dataset, checking the results, then resuming the TPOT run from where it left off. memory : a joblib.Memory object or string, optional (default=None) If supplied, pipeline will cache each transformer after calling fit. 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. More details about memory caching in scikit-learn documentation Possible inputs are: String 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown, or Path of a caching directory, TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown, or Memory object, TPOT uses the instance of joblib.Memory for memory caching and TPOT does NOT clean the caching directory up upon shutdown, or None, TPOT does not use memory caching. use_dask : boolean, optional (default: False) Whether to use Dask-ML's pipeline optimiziations. This avoid re-fitting the same estimator on the same split of data multiple times. It will also provide more detailed diagnostics when using Dask's distributed scheduler. See avoid repeated work for more details. periodic_checkpoint_folder : path string, optional (default: None) If supplied, a folder in which TPOT will periodically save pipelines in pareto front so far while optimizing. Currently once per generation but not more often than once per 30 seconds. Useful in multiple cases: Sudden death before TPOT could save optimized pipeline Track its progress Grab pipelines while it's still optimizing early_stop : integer, optional (default: None) How many generations TPOT checks whether there is no improvement in optimization process. Ends the optimization process if there is no improvement in the given number of generations. verbosity : integer, optional (default=0) How much information TPOT communicates while it's running. Possible inputs are: 0, TPOT will print nothing, 1, TPOT will print minimal information, 2, TPOT will print more information and provide a progress bar, or 3, TPOT will print everything and provide a progress bar. disable_update_check : boolean, optional (default=False) Flag indicating whether the TPOT version checker should be disabled. The update checker will tell you when a new version of TPOT has been released. Attributes: fitted_pipeline_ : scikit-learn Pipeline object The best pipeline that TPOT discovered during the pipeline optimization process, fitted on the entire training dataset. pareto_front_fitted_pipelines_ : Python dictionary Dictionary containing the all pipelines on the TPOT Pareto front, where the key is the string representation of the pipeline and the value is the corresponding pipeline fitted on the entire training dataset. The TPOT Pareto front provides a trade-off between pipeline complexity (i.e., the number of steps in the pipeline) and the predictive performance of the pipeline. Note: _pareto_front_fitted_pipelines is only available when verbosity =3. evaluated_individuals_ : Python dictionary Dictionary containing all pipelines that were evaluated during the pipeline optimization process, where the key is the string representation of the pipeline and the value is a tuple containing (# of steps in pipeline, accuracy metric for the pipeline). This attribute is primarily for internal use, but may be useful for looking at the other pipelines that TPOT evaluated. Example from tpot import TPOTRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split digits = load_boston() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_boston_pipeline.py') Functions fit (features, target[, sample_weight, groups]) Run the TPOT optimization process on the given training data. predict (features) Use the optimized pipeline to predict the target values for a feature set. score (testing_features, testing_target) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. export (output_file_name) Export the optimized pipeline as Python code. fit(features, target, sample_weight=None, groups=None) Run the TPOT optimization process on the given training data. Uses genetic programming to optimize a machine learning pipeline that maximizes the score on the provided features and target. This pipeline optimization procedure uses internal k-fold cross-validaton to avoid overfitting on the provided data. At the end of the pipeline optimization procedure, the best pipeline is then trained on the entire set of provided samples. Parameters: features : array-like {n_samples, n_features} Feature matrix TPOT and all scikit-learn algorithms assume that the features will be numerical and there will be no missing values. As such, when a feature matrix is provided to TPOT, all missing values will automatically be replaced (i.e., imputed) using median value imputation . If you wish to use a different imputation strategy than median imputation, please make sure to apply imputation to your feature set prior to passing it to TPOT. target : array-like {n_samples} List of target labels for prediction sample_weight : array-like {n_samples}, optional Per-sample weights. Higher weights indicate more importance. If specified, sample_weight will be passed to any pipeline element whose fit() function accepts a sample_weight argument. By default, using sample_weight does not affect tpot's scoring functions, which determine preferences between pipelines. groups : array-like, with shape {n_samples, }, optional Group labels for the samples used when performing cross-validation. This parameter should only be used in conjunction with sklearn's Group cross-validation functions, such as sklearn.model_selection.GroupKFold . Returns: self : object Returns a copy of the fitted TPOT object predict(features) Use the optimized pipeline to predict the target values for a feature set. Parameters: features : array-like {n_samples, n_features} Feature matrix Returns: predictions : array-like {n_samples} Predicted target values for the samples in the feature matrix score(testing_features, testing_target) Returns the optimized pipeline's score on the given testing data using the user-specified scoring function. The default scoring function for TPOTRegressor is 'mean_squared_error'. Parameters: testing_features : array-like {n_samples, n_features} Feature matrix of the testing set testing_target : array-like {n_samples} List of target labels for prediction in the testing set Returns: accuracy_score : float The estimated test set accuracy according to the user-specified scoring function. export(output_file_name) Export the optimized pipeline as Python code. See the usage documentation for example usage of the export function. Parameters: output_file_name : string String containing the path and file name of the desired output file data_file_path : string By default, the path of input dataset is 'PATH/TO/DATA/FILE' by default. If data_file_path is another string, the path will be replaced. Returns: exported_code_string : string The whole pipeline text as a string should be returned if output_file_name is not specified.","title":"Regression"},{"location":"citing/","text":"Citing TPOT If you use TPOT in a scientific publication, please consider citing at least one of the following papers: Trang T. Le, Weixuan Fu and Jason H. Moore (2020). Scaling tree-based automated machine learning to biomedical big data with a feature set selector . Bioinformatics .36(1): 250-256. BibTeX entry: @article{le2020scaling, title={Scaling tree-based automated machine learning to biomedical big data with a feature set selector}, author={Le, Trang T and Fu, Weixuan and Moore, Jason H}, journal={Bioinformatics}, volume={36}, number={1}, pages={250--256}, year={2020}, publisher={Oxford University Press} } Randal S. Olson, Ryan J. Urbanowicz, Peter C. Andrews, Nicole A. Lavender, La Creis Kidd, and Jason H. Moore (2016). Automating biomedical data science through tree-based pipeline optimization . Applications of Evolutionary Computation , pages 123-137. BibTeX entry: @inbook{Olson2016EvoBio, author={Olson, Randal S. and Urbanowicz, Ryan J. and Andrews, Peter C. and Lavender, Nicole A. and Kidd, La Creis and Moore, Jason H.}, editor={Squillero, Giovanni and Burelli, Paolo}, chapter={Automating Biomedical Data Science Through Tree-Based Pipeline Optimization}, title={Applications of Evolutionary Computation: 19th European Conference, EvoApplications 2016, Porto, Portugal, March 30 -- April 1, 2016, Proceedings, Part I}, year={2016}, publisher={Springer International Publishing}, pages={123--137}, isbn={978-3-319-31204-0}, doi={10.1007/978-3-319-31204-0_9}, url={http://dx.doi.org/10.1007/978-3-319-31204-0_9} } Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science Randal S. Olson, Nathan Bartley, Ryan J. Urbanowicz, and Jason H. Moore (2016). Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science . Proceedings of GECCO 2016 , pages 485-492. BibTeX entry: @inproceedings{OlsonGECCO2016, author = {Olson, Randal S. and Bartley, Nathan and Urbanowicz, Ryan J. and Moore, Jason H.}, title = {Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science}, booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference 2016}, series = {GECCO '16}, year = {2016}, isbn = {978-1-4503-4206-3}, location = {Denver, Colorado, USA}, pages = {485--492}, numpages = {8}, url = {http://doi.acm.org/10.1145/2908812.2908918}, doi = {10.1145/2908812.2908918}, acmid = {2908918}, publisher = {ACM}, address = {New York, NY, USA}, } Alternatively, you can cite the repository directly with the following DOI: DOI","title":"Citing TPOT"},{"location":"citing/#citing-tpot","text":"If you use TPOT in a scientific publication, please consider citing at least one of the following papers: Trang T. Le, Weixuan Fu and Jason H. Moore (2020). Scaling tree-based automated machine learning to biomedical big data with a feature set selector . Bioinformatics .36(1): 250-256. BibTeX entry: @article{le2020scaling, title={Scaling tree-based automated machine learning to biomedical big data with a feature set selector}, author={Le, Trang T and Fu, Weixuan and Moore, Jason H}, journal={Bioinformatics}, volume={36}, number={1}, pages={250--256}, year={2020}, publisher={Oxford University Press} } Randal S. Olson, Ryan J. Urbanowicz, Peter C. Andrews, Nicole A. Lavender, La Creis Kidd, and Jason H. Moore (2016). Automating biomedical data science through tree-based pipeline optimization . Applications of Evolutionary Computation , pages 123-137. BibTeX entry: @inbook{Olson2016EvoBio, author={Olson, Randal S. and Urbanowicz, Ryan J. and Andrews, Peter C. and Lavender, Nicole A. and Kidd, La Creis and Moore, Jason H.}, editor={Squillero, Giovanni and Burelli, Paolo}, chapter={Automating Biomedical Data Science Through Tree-Based Pipeline Optimization}, title={Applications of Evolutionary Computation: 19th European Conference, EvoApplications 2016, Porto, Portugal, March 30 -- April 1, 2016, Proceedings, Part I}, year={2016}, publisher={Springer International Publishing}, pages={123--137}, isbn={978-3-319-31204-0}, doi={10.1007/978-3-319-31204-0_9}, url={http://dx.doi.org/10.1007/978-3-319-31204-0_9} } Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science Randal S. Olson, Nathan Bartley, Ryan J. Urbanowicz, and Jason H. Moore (2016). Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science . Proceedings of GECCO 2016 , pages 485-492. BibTeX entry: @inproceedings{OlsonGECCO2016, author = {Olson, Randal S. and Bartley, Nathan and Urbanowicz, Ryan J. and Moore, Jason H.}, title = {Evaluation of a Tree-based Pipeline Optimization Tool for Automating Data Science}, booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference 2016}, series = {GECCO '16}, year = {2016}, isbn = {978-1-4503-4206-3}, location = {Denver, Colorado, USA}, pages = {485--492}, numpages = {8}, url = {http://doi.acm.org/10.1145/2908812.2908918}, doi = {10.1145/2908812.2908918}, acmid = {2908918}, publisher = {ACM}, address = {New York, NY, USA}, } Alternatively, you can cite the repository directly with the following DOI: DOI","title":"Citing TPOT"},{"location":"contributing/","text":"Contribution Guide We welcome you to check the existing issues for bugs or enhancements to work on. If you have an idea for an extension to TPOT, please file a new issue so we can discuss it. Project layout The latest stable release of TPOT is on the master branch , whereas the latest version of TPOT in development is on the development branch . Make sure you are looking at and working on the correct branch if you're looking to contribute code. In terms of directory structure: All of TPOT's code sources are in the tpot directory The documentation sources are in the docs_sources directory Images in the documentation are in the images directory Tutorials for TPOT are in the tutorials directory Unit tests for TPOT are in the tests.py file Make sure to familiarize yourself with the project layout before making any major contributions, and especially make sure to send all code changes to the development branch. How to contribute The preferred way to contribute to TPOT is to fork the main repository on GitHub: Fork the project repository : click on the 'Fork' button near the top of the page. This creates a copy of the code under your account on the GitHub server. Clone this copy to your local disk: $ git clone git@github.com:YourUsername/tpot.git $ cd tpot Create a branch to hold your changes: $ git checkout -b my-contribution Make sure your local environment is setup correctly for development. Installation instructions are almost identical to the user instructions except that TPOT should not be installed. If you have TPOT installed on your computer then make sure you are using a virtual environment that does not have TPOT installed. Furthermore, you should make sure you have installed the nose package into your development environment so that you can test changes locally. $ conda install nose Start making changes on your newly created branch, remembering to never work on the master branch! Work on this copy on your computer using Git to do the version control. Once some changes are saved locally, you can use your tweaked version of TPOT by navigating to the project's base directory and running TPOT directly from the command line: $ python -m tpot.driver or by running script that imports and uses the TPOT module with code similar to from tpot import TPOTClassifier To check your changes haven't broken any existing tests and to check new tests you've added pass run the following (note, you must have the nose package installed within your dev environment for this to work): $ nosetests -s -v When you're done editing and local testing, run: $ git add modified_files $ git commit to record your changes in Git, then push them to GitHub with: $ git push -u origin my-contribution Finally, go to the web page of your fork of the TPOT repo, and click 'Pull Request' (PR) to send your changes to the maintainers for review. Make sure that you send your PR to the development branch, as the master branch is reserved for the latest stable release. This will start the CI server to check all the project's unit tests run and send an email to the maintainers. (If any of the above seems like magic to you, then look up the Git documentation on the web.) Before submitting your pull request Before you submit a pull request for your contribution, please work through this checklist to make sure that you have done everything necessary so we can efficiently review and accept your changes. If your contribution changes TPOT in any way: Update the documentation so all of your changes are reflected there. Update the README if anything there has changed. If your contribution involves any code changes: Update the project unit tests to test your code changes. Make sure that your code is properly commented with docstrings and comments explaining your rationale behind non-obvious coding practices. If your code affected any of the pipeline operators, make sure that the corresponding export functionality reflects those changes. If your contribution requires a new library dependency: Double-check that the new dependency is easy to install via pip or Anaconda and supports both Python 2 and 3. If the dependency requires a complicated installation, then we most likely won't merge your changes because we want to keep TPOT easy to install. Add the required version of the library to .travis.yml Add a line to pip install the library to .travis_install.sh Add a line to print the version of the library to .travis_install.sh Similarly add a line to print the version of the library to .travis_test.sh After submitting your pull request After submitting your pull request, Travis-CI will automatically run unit tests on your changes and make sure that your updated code builds and runs on Python 2 and 3. We also use services that automatically check code quality and test coverage. Check back shortly after submitting your pull request to make sure that your code passes these checks. If any of the checks come back with a red X, then do your best to address the errors.","title":"Contributing"},{"location":"contributing/#contribution-guide","text":"We welcome you to check the existing issues for bugs or enhancements to work on. If you have an idea for an extension to TPOT, please file a new issue so we can discuss it.","title":"Contribution Guide"},{"location":"contributing/#project-layout","text":"The latest stable release of TPOT is on the master branch , whereas the latest version of TPOT in development is on the development branch . Make sure you are looking at and working on the correct branch if you're looking to contribute code. In terms of directory structure: All of TPOT's code sources are in the tpot directory The documentation sources are in the docs_sources directory Images in the documentation are in the images directory Tutorials for TPOT are in the tutorials directory Unit tests for TPOT are in the tests.py file Make sure to familiarize yourself with the project layout before making any major contributions, and especially make sure to send all code changes to the development branch.","title":"Project layout"},{"location":"contributing/#how-to-contribute","text":"The preferred way to contribute to TPOT is to fork the main repository on GitHub: Fork the project repository : click on the 'Fork' button near the top of the page. This creates a copy of the code under your account on the GitHub server. Clone this copy to your local disk: $ git clone git@github.com:YourUsername/tpot.git $ cd tpot Create a branch to hold your changes: $ git checkout -b my-contribution Make sure your local environment is setup correctly for development. Installation instructions are almost identical to the user instructions except that TPOT should not be installed. If you have TPOT installed on your computer then make sure you are using a virtual environment that does not have TPOT installed. Furthermore, you should make sure you have installed the nose package into your development environment so that you can test changes locally. $ conda install nose Start making changes on your newly created branch, remembering to never work on the master branch! Work on this copy on your computer using Git to do the version control. Once some changes are saved locally, you can use your tweaked version of TPOT by navigating to the project's base directory and running TPOT directly from the command line: $ python -m tpot.driver or by running script that imports and uses the TPOT module with code similar to from tpot import TPOTClassifier To check your changes haven't broken any existing tests and to check new tests you've added pass run the following (note, you must have the nose package installed within your dev environment for this to work): $ nosetests -s -v When you're done editing and local testing, run: $ git add modified_files $ git commit to record your changes in Git, then push them to GitHub with: $ git push -u origin my-contribution Finally, go to the web page of your fork of the TPOT repo, and click 'Pull Request' (PR) to send your changes to the maintainers for review. Make sure that you send your PR to the development branch, as the master branch is reserved for the latest stable release. This will start the CI server to check all the project's unit tests run and send an email to the maintainers. (If any of the above seems like magic to you, then look up the Git documentation on the web.)","title":"How to contribute"},{"location":"contributing/#before-submitting-your-pull-request","text":"Before you submit a pull request for your contribution, please work through this checklist to make sure that you have done everything necessary so we can efficiently review and accept your changes. If your contribution changes TPOT in any way: Update the documentation so all of your changes are reflected there. Update the README if anything there has changed. If your contribution involves any code changes: Update the project unit tests to test your code changes. Make sure that your code is properly commented with docstrings and comments explaining your rationale behind non-obvious coding practices. If your code affected any of the pipeline operators, make sure that the corresponding export functionality reflects those changes. If your contribution requires a new library dependency: Double-check that the new dependency is easy to install via pip or Anaconda and supports both Python 2 and 3. If the dependency requires a complicated installation, then we most likely won't merge your changes because we want to keep TPOT easy to install. Add the required version of the library to .travis.yml Add a line to pip install the library to .travis_install.sh Add a line to print the version of the library to .travis_install.sh Similarly add a line to print the version of the library to .travis_test.sh","title":"Before submitting your pull request"},{"location":"contributing/#after-submitting-your-pull-request","text":"After submitting your pull request, Travis-CI will automatically run unit tests on your changes and make sure that your updated code builds and runs on Python 2 and 3. We also use services that automatically check code quality and test coverage. Check back shortly after submitting your pull request to make sure that your code passes these checks. If any of the checks come back with a red X, then do your best to address the errors.","title":"After submitting your pull request"},{"location":"examples/","text":"Overview The following sections illustrate the usage of TPOT with various datasets, each belonging to a typical class of machine learning tasks. Dataset Task Task class Dataset description Jupyter notebook Iris flower classification classification link link Optical Recognition of Handwritten Digits digit recognition (image) classification link link Boston housing prices modeling regression link N/A Titanic survival analysis classification link link Bank Marketing subscription prediction classification link link MAGIC Gamma Telescope event detection classification link link Notes: - For details on how the fit() , score() and export() methods work, refer to the usage documentation . - Upon re-running the experiments, your resulting pipelines may differ (to some extent) from the ones demonstrated here. Iris flower classification The following code illustrates how TPOT can be employed for performing a simple classification task over the Iris dataset. from tpot import TPOTClassifier from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import numpy as np iris = load_iris() X_train, X_test, y_train, y_test = train_test_split(iris.data.astype(np.float64), iris.target.astype(np.float64), train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_iris_pipeline.py') Running this code should discover a pipeline (exported as tpot_iris_pipeline.py ) that achieves about 97% test accuracy: import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.pipeline import make_pipeline from sklearn.preprocessing import Normalizer from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: 0.9826086956521738 exported_pipeline = make_pipeline( Normalizer(norm=\"l2\"), KNeighborsClassifier(n_neighbors=5, p=2, weights=\"distance\") ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features) Digits dataset Below is a minimal working example with the optical recognition of handwritten digits dataset, which is an image classification problem . from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Running this code should discover a pipeline (exported as tpot_digits_pipeline.py ) that achieves about 98% test accuracy: import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline, make_union from sklearn.preprocessing import PolynomialFeatures from tpot.builtins import StackingEstimator from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: 0.9799428471757372 exported_pipeline = make_pipeline( PolynomialFeatures(degree=2, include_bias=False, interaction_only=False), StackingEstimator(estimator=LogisticRegression(C=0.1, dual=False, penalty=\"l1\")), RandomForestClassifier(bootstrap=True, criterion=\"entropy\", max_features=0.35000000000000003, min_samples_leaf=20, min_samples_split=19, n_estimators=100) ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features) Boston housing prices modeling The following code illustrates how TPOT can be employed for performing a regression task over the Boston housing prices dataset. from tpot import TPOTRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split housing = load_boston() X_train, X_test, y_train, y_test = train_test_split(housing.data, housing.target, train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_boston_pipeline.py') Running this code should discover a pipeline (exported as tpot_boston_pipeline.py ) that achieves at least 10 mean squared error (MSE) on the test set: import numpy as np import pandas as pd from sklearn.ensemble import ExtraTreesRegressor from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline from sklearn.preprocessing import PolynomialFeatures from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: -10.812040755234403 exported_pipeline = make_pipeline( PolynomialFeatures(degree=2, include_bias=False, interaction_only=False), ExtraTreesRegressor(bootstrap=False, max_features=0.5, min_samples_leaf=2, min_samples_split=3, n_estimators=100) ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features) Titanic survival analysis To see the TPOT applied the Titanic Kaggle dataset, see the Jupyter notebook here . This example shows how to take a messy dataset and preprocess it such that it can be used in scikit-learn and TPOT. Portuguese Bank Marketing The corresponding Jupyter notebook, containing the associated data preprocessing and analysis, can be found here . MAGIC Gamma Telescope The corresponding Jupyter notebook, containing the associated data preprocessing and analysis, can be found here . Neural network classifier using TPOT-NN By loading the TPOT-NN configuration dictionary , PyTorch estimators will be included for classification. Users can also create their own NN configuration dictionary that includes tpot.builtins.PytorchLRClassifier and/or tpot.builtins.PytorchMLPClassifier , or they can specify them using a template string, as shown in the following example: from tpot import TPOTClassifier from sklearn.datasets import make_blobs from sklearn.model_selection import train_test_split X, y = make_blobs(n_samples=100, centers=2, n_features=3, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.75, test_size=0.25) clf = TPOTClassifier(config_dict='TPOT NN', template='Selector-Transformer-PytorchLRClassifier', verbosity=2, population_size=10, generations=10) clf.fit(X_train, y_train) print(clf.score(X_test, y_test)) clf.export('tpot_nn_demo_pipeline.py') This example is somewhat trivial, but it should result in nearly 100% classification accuracy.","title":"Examples"},{"location":"examples/#overview","text":"The following sections illustrate the usage of TPOT with various datasets, each belonging to a typical class of machine learning tasks. Dataset Task Task class Dataset description Jupyter notebook Iris flower classification classification link link Optical Recognition of Handwritten Digits digit recognition (image) classification link link Boston housing prices modeling regression link N/A Titanic survival analysis classification link link Bank Marketing subscription prediction classification link link MAGIC Gamma Telescope event detection classification link link Notes: - For details on how the fit() , score() and export() methods work, refer to the usage documentation . - Upon re-running the experiments, your resulting pipelines may differ (to some extent) from the ones demonstrated here.","title":"Overview"},{"location":"examples/#iris-flower-classification","text":"The following code illustrates how TPOT can be employed for performing a simple classification task over the Iris dataset. from tpot import TPOTClassifier from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import numpy as np iris = load_iris() X_train, X_test, y_train, y_test = train_test_split(iris.data.astype(np.float64), iris.target.astype(np.float64), train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_iris_pipeline.py') Running this code should discover a pipeline (exported as tpot_iris_pipeline.py ) that achieves about 97% test accuracy: import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.pipeline import make_pipeline from sklearn.preprocessing import Normalizer from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: 0.9826086956521738 exported_pipeline = make_pipeline( Normalizer(norm=\"l2\"), KNeighborsClassifier(n_neighbors=5, p=2, weights=\"distance\") ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features)","title":"Iris flower classification"},{"location":"examples/#digits-dataset","text":"Below is a minimal working example with the optical recognition of handwritten digits dataset, which is an image classification problem . from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Running this code should discover a pipeline (exported as tpot_digits_pipeline.py ) that achieves about 98% test accuracy: import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline, make_union from sklearn.preprocessing import PolynomialFeatures from tpot.builtins import StackingEstimator from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: 0.9799428471757372 exported_pipeline = make_pipeline( PolynomialFeatures(degree=2, include_bias=False, interaction_only=False), StackingEstimator(estimator=LogisticRegression(C=0.1, dual=False, penalty=\"l1\")), RandomForestClassifier(bootstrap=True, criterion=\"entropy\", max_features=0.35000000000000003, min_samples_leaf=20, min_samples_split=19, n_estimators=100) ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features)","title":"Digits dataset"},{"location":"examples/#boston-housing-prices-modeling","text":"The following code illustrates how TPOT can be employed for performing a regression task over the Boston housing prices dataset. from tpot import TPOTRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split housing = load_boston() X_train, X_test, y_train, y_test = train_test_split(housing.data, housing.target, train_size=0.75, test_size=0.25, random_state=42) tpot = TPOTRegressor(generations=5, population_size=50, verbosity=2, random_state=42) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_boston_pipeline.py') Running this code should discover a pipeline (exported as tpot_boston_pipeline.py ) that achieves at least 10 mean squared error (MSE) on the test set: import numpy as np import pandas as pd from sklearn.ensemble import ExtraTreesRegressor from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline from sklearn.preprocessing import PolynomialFeatures from tpot.export_utils import set_param_recursive # NOTE: Make sure that the outcome column is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1) training_features, testing_features, training_target, testing_target = \\ train_test_split(features, tpot_data['target'], random_state=42) # Average CV score on the training set was: -10.812040755234403 exported_pipeline = make_pipeline( PolynomialFeatures(degree=2, include_bias=False, interaction_only=False), ExtraTreesRegressor(bootstrap=False, max_features=0.5, min_samples_leaf=2, min_samples_split=3, n_estimators=100) ) # Fix random state for all the steps in exported pipeline set_param_recursive(exported_pipeline.steps, 'random_state', 42) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features)","title":"Boston housing prices modeling"},{"location":"examples/#titanic-survival-analysis","text":"To see the TPOT applied the Titanic Kaggle dataset, see the Jupyter notebook here . This example shows how to take a messy dataset and preprocess it such that it can be used in scikit-learn and TPOT.","title":"Titanic survival analysis"},{"location":"examples/#portuguese-bank-marketing","text":"The corresponding Jupyter notebook, containing the associated data preprocessing and analysis, can be found here .","title":"Portuguese Bank Marketing"},{"location":"examples/#magic-gamma-telescope","text":"The corresponding Jupyter notebook, containing the associated data preprocessing and analysis, can be found here .","title":"MAGIC Gamma Telescope"},{"location":"examples/#neural-network-classifier-using-tpot-nn","text":"By loading the TPOT-NN configuration dictionary , PyTorch estimators will be included for classification. Users can also create their own NN configuration dictionary that includes tpot.builtins.PytorchLRClassifier and/or tpot.builtins.PytorchMLPClassifier , or they can specify them using a template string, as shown in the following example: from tpot import TPOTClassifier from sklearn.datasets import make_blobs from sklearn.model_selection import train_test_split X, y = make_blobs(n_samples=100, centers=2, n_features=3, random_state=42) X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.75, test_size=0.25) clf = TPOTClassifier(config_dict='TPOT NN', template='Selector-Transformer-PytorchLRClassifier', verbosity=2, population_size=10, generations=10) clf.fit(X_train, y_train) print(clf.score(X_test, y_test)) clf.export('tpot_nn_demo_pipeline.py') This example is somewhat trivial, but it should result in nearly 100% classification accuracy.","title":"Neural network classifier using TPOT-NN"},{"location":"installing/","text":"Installation TPOT is built on top of several existing Python libraries, including: NumPy SciPy scikit-learn DEAP update_checker tqdm stopit pandas joblib Most of the necessary Python packages can be installed via the Anaconda Python distribution , which we strongly recommend that you use. Support for Python 3.4 and below has been officially dropped since version 0.11.0. You can install TPOT using pip or conda-forge . pip NumPy, SciPy, scikit-learn, pandas, joblib, and PyTorch can be installed in Anaconda via the command: conda install numpy scipy scikit-learn pandas joblib pytorch DEAP, update_checker, tqdm and stopit can be installed with pip via the command: pip install deap update_checker tqdm stopit Optionally , you can install XGBoost if you would like TPOT to use the eXtreme Gradient Boosting models. XGBoost is entirely optional, and TPOT will still function normally without XGBoost if you do not have it installed. Windows users: pip installation may not work on some Windows environments, and it may cause unexpected errors. pip install xgboost If you have issues installing XGBoost, check the XGBoost installation documentation . If you plan to use Dask for parallel training, make sure to install dask[delay] and dask[dataframe] and dask_ml . pip install dask[delayed] dask[dataframe] dask-ml fsspec>=0.3.3 If you plan to use the TPOT-MDR configuration , make sure to install scikit-mdr and scikit-rebate : pip install scikit-mdr skrebate To enable support for PyTorch -based neural networks (TPOT-NN), you will need to install PyTorch. TPOT-NN will work with either CPU or GPU PyTorch, but we strongly recommend using a GPU version, if possible, as CPU PyTorch models tend to train very slowly. We recommend following PyTorch's installation instructions customized for your operating system and Python distribution. Finally to install TPOT itself, run the following command: pip install tpot conda-forge To install tpot and its core dependencies you can use: conda install -c conda-forge tpot To install additional dependencies you can use: conda install -c conda-forge tpot xgboost dask dask-ml scikit-mdr skrebate As mentioned above, we recommend following PyTorch's installation instructions for installing it to enable support for PyTorch -based neural networks (TPOT-NN). Installation problems Please file a new issue if you run into installation problems.","title":"Installation"},{"location":"installing/#installation","text":"TPOT is built on top of several existing Python libraries, including: NumPy SciPy scikit-learn DEAP update_checker tqdm stopit pandas joblib Most of the necessary Python packages can be installed via the Anaconda Python distribution , which we strongly recommend that you use. Support for Python 3.4 and below has been officially dropped since version 0.11.0. You can install TPOT using pip or conda-forge .","title":"Installation"},{"location":"installing/#pip","text":"NumPy, SciPy, scikit-learn, pandas, joblib, and PyTorch can be installed in Anaconda via the command: conda install numpy scipy scikit-learn pandas joblib pytorch DEAP, update_checker, tqdm and stopit can be installed with pip via the command: pip install deap update_checker tqdm stopit Optionally , you can install XGBoost if you would like TPOT to use the eXtreme Gradient Boosting models. XGBoost is entirely optional, and TPOT will still function normally without XGBoost if you do not have it installed. Windows users: pip installation may not work on some Windows environments, and it may cause unexpected errors. pip install xgboost If you have issues installing XGBoost, check the XGBoost installation documentation . If you plan to use Dask for parallel training, make sure to install dask[delay] and dask[dataframe] and dask_ml . pip install dask[delayed] dask[dataframe] dask-ml fsspec>=0.3.3 If you plan to use the TPOT-MDR configuration , make sure to install scikit-mdr and scikit-rebate : pip install scikit-mdr skrebate To enable support for PyTorch -based neural networks (TPOT-NN), you will need to install PyTorch. TPOT-NN will work with either CPU or GPU PyTorch, but we strongly recommend using a GPU version, if possible, as CPU PyTorch models tend to train very slowly. We recommend following PyTorch's installation instructions customized for your operating system and Python distribution. Finally to install TPOT itself, run the following command: pip install tpot","title":"pip"},{"location":"installing/#conda-forge","text":"To install tpot and its core dependencies you can use: conda install -c conda-forge tpot To install additional dependencies you can use: conda install -c conda-forge tpot xgboost dask dask-ml scikit-mdr skrebate As mentioned above, we recommend following PyTorch's installation instructions for installing it to enable support for PyTorch -based neural networks (TPOT-NN).","title":"conda-forge"},{"location":"installing/#installation-problems","text":"Please file a new issue if you run into installation problems.","title":"Installation problems"},{"location":"related/","text":"Other Automated Machine Learning (AutoML) tools and related projects: Name Language License Description Auto-WEKA Java GPL-v3 Automated model selection and hyper-parameter tuning for Weka models. auto-sklearn Python BSD-3-Clause An automated machine learning toolkit and a drop-in replacement for a scikit-learn estimator. auto_ml Python MIT Automated machine learning for analytics & production. Supports manual feature type declarations. H2O AutoML Java with Python, Scala & R APIs and web GUI Apache 2.0 Automated: data prep, hyperparameter tuning, random grid search and stacked ensembles in a distributed ML platform. devol Python MIT Automated deep neural network design via genetic programming. MLBox Python BSD-3-Clause Accurate hyper-parameter optimization in high-dimensional space with support for distributed computing. Recipe C GPL-v3 Machine-learning pipeline optimization through genetic programming. Uses grammars to define pipeline structure. Xcessiv Python Apache 2.0 A web-based application for quick, scalable, and automated hyper-parameter tuning and stacked ensembling in Python. GAMA Python Apache 2.0 Machine-learning pipeline optimization through asynchronous evaluation based genetic programming.","title":"Related"},{"location":"releases/","text":"Release Notes Version 0.11.2 Fix early_stop parameter does not work properly TPOT built-in OneHotEncoder can refit to different datasets Fix the issue that the attribute evaluated_individuals_ cannot record correct generation info. Add a new parameter log_file to output logs to a file instead of sys.stdout Fix some code quality issues and mistakes in documentations Fix minor bugs Version 0.11.1 Fix compatibility issue with scikit-learn v0.22 warm_start now saves both Primitive Sets and evaluated_pipelines_ from previous runs; Fix the error that TPOT assign wrong fitness scores to non-evaluated pipelines (interrupted by max_min_mins or KeyboardInterrupt ) ; Fix the bug that mutation operator cannot generate new pipeline when template is not default value and warm_start is True; Fix the bug that max_time_mins cannot stop optimization process when search space is limited. Fix a bug in exported codes when the exported pipeline is only 1 estimator Fix spelling mistakes in documentations Fix some code quality issues Version 0.11.0 Support for Python 3.4 and below has been officially dropped. Also support for scikit-learn 0.20 or below has been dropped. The support of a metric function with the signature score_func(y_true, y_pred) for scoring parameter has been dropped. Refine StackingEstimator for not stacking NaN/Infinity predication probabilities. Fix a bug that population doesn't persist by warm_start=True when max_time_mins is not default value. Now the random_state parameter in TPOT is used for pipeline evaluation instead of using a fixed random seed of 42 before. The set_param_recursive function has been moved to export_utils.py and it can be used in exported codes for setting random_state recursively in scikit-learn Pipeline. It is used to set random_state in fitted_pipeline_ attribute and exported pipelines. TPOT can independently use generations and max_time_mins to limit the optimization process through using one of the parameters or both. .export() function will return string of exported pipeline if output filename is not specified. Add SGDClassifier and SGDRegressor into TPOT default configs. Documentation has been updated Fix minor bugs. Version 0.10.2 TPOT v0.10.2 is the last version to support Python 2.7 and Python 3.4. Minor updates for fixing compatibility issues with the latest version of scikit-learn (version > 0.21) and xgboost (v0.90) Default value of template parameter is changed to None instead. Fix errors in documentation Version 0.10.1 Add data_file_path option into expert function for replacing 'PATH/TO/DATA/FILE' to customized dataset path in exported scripts. (Related issue #838) Change python version in CI tests to 3.7 Add CI tests for macOS. Version 0.10.0 Add a new template option to specify a desired structure for machine learning pipeline in TPOT. Check TPOT API (it will be updated once it is merge to master branch). Add FeatureSetSelector operator into TPOT for feature selection based on priori export knowledge. Please check our preprint paper for more details ( Note: it was named DatasetSelector in 1st version paper but we will rename to FeatureSetSelector in next version of the paper ) Refine n_jobs parameter to accept value below -1. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Now memory parameter can create memory cache directory if it does not exist. Fix minor bugs. Version 0.9.6 Fix a bug causing that max_time_mins parameter doesn't work when use_dask=True in TPOT 0.9.5 Now TPOT saves best pareto values best pareto pipeline s in checkpoint folder TPOT raises ImportError if operators in the TPOT configuration are not available when verbosity>2 Thank @PGijsbers for the suggestions. Now TPOT can save scores of individuals already evaluated in any generation even the evaluation process of that generation is interrupted/stopped. But it is noted that, in this case, TPOT will raise this warning message : WARNING: TPOT may not provide a good pipeline if TPOT is stopped/interrupted in a early generation. , because the pipelines in early generation, e.g. 1st generation, are evolved/modified very limited times via evolutionary algorithm. Fix bugs in configuration of TPOTRegressor Error fixes in documentation Version 0.9.5 TPOT now supports integration with Dask for parallelization + smart caching . Big thanks to the Dask dev team for making this happen! TPOT now supports for imputation/sparse matrices into predict and predict_proba functions. TPOTClassifier and TPOTRegressor now follows scikit-learn estimator API. We refined scoring parameter in TPOT API for accepting Scorer object . We refined parameters in VarianceThreshold and FeatureAgglomeration. TPOT now supports using memory caching within a Pipeline via a optional memory parameter. We improved documentation of TPOT. Version 0.9 TPOT now supports sparse matrices with a new built-in TPOT configuration, \"TPOT sparse\". We are using a custom OneHotEncoder implementation that supports missing values and continuous features. We have added an \"early stopping\" option for stopping the optimization process if no improvement is made within a set number of generations. Look up the early_stop parameter to access this functionality. TPOT now reduces the number of duplicated pipelines between generations, which saves you time during the optimization process. TPOT now supports custom scoring functions via the command-line mode. We have added a new optional argument, periodic_checkpoint_folder , that allows TPOT to periodically save the best pipeline so far to a local folder during optimization process. TPOT no longer uses sklearn.externals.joblib when n_jobs=1 to avoid the potential freezing issue that scikit-learn suffers from . We have added pandas as a dependency to read input datasets instead of numpy.recfromcsv . NumPy's recfromcsv function is unable to parse datasets with complex data types. Fixed a bug that DEFAULT in the parameter(s) of nested estimator raises KeyError when exporting pipelines. Fixed a bug related to setting random_state in nested estimators. The issue would happen with pipeline with SelectFromModel ( ExtraTreesClassifier as nested estimator) or StackingEstimator if nested estimator has random_state parameter. Fixed a bug in the missing value imputation function in TPOT to impute along columns instead rows. Refined input checking for sparse matrices in TPOT. Refined the TPOT pipeline mutation operator. Version 0.8 TPOT now detects whether there are missing values in your dataset and replaces them with the median value of the column. TPOT now allows you to set a group parameter in the fit function so you can use the GroupKFold cross-validation strategy. TPOT now allows you to set a subsample ratio of the training instance with the subsample parameter. For example, setting subsample =0.5 tells TPOT to create a fixed subsample of half of the training data for the pipeline optimization process. This parameter can be useful for speeding up the pipeline optimization process, but may give less accurate performance estimates from cross-validation. TPOT now has more built-in configurations , including TPOT MDR and TPOT light, for both classification and regression problems. TPOTClassifier and TPOTRegressor now expose three useful internal attributes, fitted_pipeline_ , pareto_front_fitted_pipelines_ , and evaluated_individuals_ . These attributes are described in the API documentation . Oh, TPOT now has thorough API documentation . Check it out! Fixed a reproducibility issue where setting random_seed didn't necessarily result in the same results every time. This bug was present since TPOT v0.7. Refined input checking in TPOT. Removed Python 2 uncompliant code. Version 0.7 TPOT now has multiprocessing support. TPOT allows you to use multiple processes in parallel to accelerate the pipeline optimization process in TPOT with the n_jobs parameter. TPOT now allows you to customize the operators and parameters considered during the optimization process , which can be accomplished with the new config_dict parameter. The format of this customized dictionary can be found in the online documentation , along with a list of built-in configurations . TPOT now allows you to specify a time limit for evaluating a single pipeline (default limit is 5 minutes) in optimization process with the max_eval_time_mins parameter, so TPOT won't spend hours evaluating overly-complex pipelines. We tweaked TPOT's underlying evolutionary optimization algorithm to work even better, including using the mu+lambda algorithm . This algorithm gives you more control of how many pipelines are generated every iteration with the offspring_size parameter. Refined the default operators and parameters in TPOT, so TPOT 0.7 should work even better than 0.6. TPOT now supports sample weights in the fitness function if some if your samples are more important to classify correctly than others. The sample weights option works the same as in scikit-learn, e.g., tpot.fit(x_train, y_train, sample_weights=sample_weights) . The default scoring metric in TPOT has been changed from balanced accuracy to accuracy, the same default metric for classification algorithms in scikit-learn. Balanced accuracy can still be used by setting scoring='balanced_accuracy' when creating a TPOT instance. Version 0.6 TPOT now supports regression problems! We have created two separate TPOTClassifier and TPOTRegressor classes to support classification and regression problems, respectively. The command-line interface also supports this feature through the -mode parameter. TPOT now allows you to specify a time limit for the optimization process with the max_time_mins parameter, so you don't need to guess how long TPOT will take any more to recommend a pipeline to you. Added a new operator that performs feature selection using ExtraTrees feature importance scores. XGBoost has been added as an optional dependency to TPOT. If you have XGBoost installed, TPOT will automatically detect your installation and use the XGBoostClassifier and XGBoostRegressor in its pipelines. TPOT now offers a verbosity level of 3 (\"science mode\"), which outputs the entire Pareto front instead of only the current best score. This feature may be useful for users looking to make a trade-off between pipeline complexity and score. Version 0.5 Major refactor: Each operator is defined in a separate class file. Hooray for easier-to-maintain code! TPOT now exports directly to scikit-learn Pipelines instead of hacky code. Internal representation of individuals now uses scikit-learn pipelines. Parameters for each operator have been optimized so TPOT spends less time exploring useless parameters. We have removed pandas as a dependency and instead use numpy matrices to store the data. TPOT now uses k-fold cross-validation when evaluating pipelines, with a default k = 3. This k parameter can be tuned when creating a new TPOT instance. Improved scoring function support : Even though TPOT uses balanced accuracy by default, you can now have TPOT use any of the scoring functions that cross_val_score supports. Added the scikit-learn Normalizer preprocessor. Minor text fixes. Version 0.4 In TPOT 0.4, we've made some major changes to the internals of TPOT and added some convenience functions. We've summarized the changes below. Added new sklearn models and preprocessors AdaBoostClassifier BernoulliNB ExtraTreesClassifier GaussianNB MultinomialNB LinearSVC PassiveAggressiveClassifier GradientBoostingClassifier RBFSampler FastICA FeatureAgglomeration Nystroem Added operator that inserts virtual features for the count of features with values of zero Reworked parameterization of TPOT operators Reduced parameter search space with information from a scikit-learn benchmark TPOT no longer generates arbitrary parameter values, but uses a fixed parameter set instead Removed XGBoost as a dependency Too many users were having install issues with XGBoost Replaced with scikit-learn's GradientBoostingClassifier Improved descriptiveness of TPOT command line parameter documentation Removed min/max/avg details during fit() when verbosity > 1 Replaced with tqdm progress bar Added tqdm as a dependency Added fit_predict() convenience function Added get_params() function so TPOT can operate in scikit-learn's cross_val_score & related functions Version 0.3 We revised the internal optimization process of TPOT to make it more efficient, in particular in regards to the model parameters that TPOT optimizes over. Version 0.2 TPOT now has the ability to export the optimized pipelines to sklearn code. Logistic regression, SVM, and k-nearest neighbors classifiers were added as pipeline operators. Previously, TPOT only included decision tree and random forest classifiers. TPOT can now use arbitrary scoring functions for the optimization process. TPOT now performs multi-objective Pareto optimization to balance model complexity (i.e., # of pipeline operators) and the score of the pipeline. Version 0.1 First public release of TPOT. Optimizes pipelines with decision trees and random forest classifiers as the model, and uses a handful of feature preprocessors.","title":"Release Notes"},{"location":"releases/#release-notes","text":"","title":"Release Notes"},{"location":"releases/#version-0112","text":"Fix early_stop parameter does not work properly TPOT built-in OneHotEncoder can refit to different datasets Fix the issue that the attribute evaluated_individuals_ cannot record correct generation info. Add a new parameter log_file to output logs to a file instead of sys.stdout Fix some code quality issues and mistakes in documentations Fix minor bugs","title":"Version 0.11.2"},{"location":"releases/#version-0111","text":"Fix compatibility issue with scikit-learn v0.22 warm_start now saves both Primitive Sets and evaluated_pipelines_ from previous runs; Fix the error that TPOT assign wrong fitness scores to non-evaluated pipelines (interrupted by max_min_mins or KeyboardInterrupt ) ; Fix the bug that mutation operator cannot generate new pipeline when template is not default value and warm_start is True; Fix the bug that max_time_mins cannot stop optimization process when search space is limited. Fix a bug in exported codes when the exported pipeline is only 1 estimator Fix spelling mistakes in documentations Fix some code quality issues","title":"Version 0.11.1"},{"location":"releases/#version-0110","text":"Support for Python 3.4 and below has been officially dropped. Also support for scikit-learn 0.20 or below has been dropped. The support of a metric function with the signature score_func(y_true, y_pred) for scoring parameter has been dropped. Refine StackingEstimator for not stacking NaN/Infinity predication probabilities. Fix a bug that population doesn't persist by warm_start=True when max_time_mins is not default value. Now the random_state parameter in TPOT is used for pipeline evaluation instead of using a fixed random seed of 42 before. The set_param_recursive function has been moved to export_utils.py and it can be used in exported codes for setting random_state recursively in scikit-learn Pipeline. It is used to set random_state in fitted_pipeline_ attribute and exported pipelines. TPOT can independently use generations and max_time_mins to limit the optimization process through using one of the parameters or both. .export() function will return string of exported pipeline if output filename is not specified. Add SGDClassifier and SGDRegressor into TPOT default configs. Documentation has been updated Fix minor bugs.","title":"Version 0.11.0"},{"location":"releases/#version-0102","text":"TPOT v0.10.2 is the last version to support Python 2.7 and Python 3.4. Minor updates for fixing compatibility issues with the latest version of scikit-learn (version > 0.21) and xgboost (v0.90) Default value of template parameter is changed to None instead. Fix errors in documentation","title":"Version 0.10.2"},{"location":"releases/#version-0101","text":"Add data_file_path option into expert function for replacing 'PATH/TO/DATA/FILE' to customized dataset path in exported scripts. (Related issue #838) Change python version in CI tests to 3.7 Add CI tests for macOS.","title":"Version 0.10.1"},{"location":"releases/#version-0100","text":"Add a new template option to specify a desired structure for machine learning pipeline in TPOT. Check TPOT API (it will be updated once it is merge to master branch). Add FeatureSetSelector operator into TPOT for feature selection based on priori export knowledge. Please check our preprint paper for more details ( Note: it was named DatasetSelector in 1st version paper but we will rename to FeatureSetSelector in next version of the paper ) Refine n_jobs parameter to accept value below -1. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. Now memory parameter can create memory cache directory if it does not exist. Fix minor bugs.","title":"Version 0.10.0"},{"location":"releases/#version-096","text":"Fix a bug causing that max_time_mins parameter doesn't work when use_dask=True in TPOT 0.9.5 Now TPOT saves best pareto values best pareto pipeline s in checkpoint folder TPOT raises ImportError if operators in the TPOT configuration are not available when verbosity>2 Thank @PGijsbers for the suggestions. Now TPOT can save scores of individuals already evaluated in any generation even the evaluation process of that generation is interrupted/stopped. But it is noted that, in this case, TPOT will raise this warning message : WARNING: TPOT may not provide a good pipeline if TPOT is stopped/interrupted in a early generation. , because the pipelines in early generation, e.g. 1st generation, are evolved/modified very limited times via evolutionary algorithm. Fix bugs in configuration of TPOTRegressor Error fixes in documentation","title":"Version 0.9.6"},{"location":"releases/#version-095","text":"TPOT now supports integration with Dask for parallelization + smart caching . Big thanks to the Dask dev team for making this happen! TPOT now supports for imputation/sparse matrices into predict and predict_proba functions. TPOTClassifier and TPOTRegressor now follows scikit-learn estimator API. We refined scoring parameter in TPOT API for accepting Scorer object . We refined parameters in VarianceThreshold and FeatureAgglomeration. TPOT now supports using memory caching within a Pipeline via a optional memory parameter. We improved documentation of TPOT.","title":"Version 0.9.5"},{"location":"releases/#version-09","text":"TPOT now supports sparse matrices with a new built-in TPOT configuration, \"TPOT sparse\". We are using a custom OneHotEncoder implementation that supports missing values and continuous features. We have added an \"early stopping\" option for stopping the optimization process if no improvement is made within a set number of generations. Look up the early_stop parameter to access this functionality. TPOT now reduces the number of duplicated pipelines between generations, which saves you time during the optimization process. TPOT now supports custom scoring functions via the command-line mode. We have added a new optional argument, periodic_checkpoint_folder , that allows TPOT to periodically save the best pipeline so far to a local folder during optimization process. TPOT no longer uses sklearn.externals.joblib when n_jobs=1 to avoid the potential freezing issue that scikit-learn suffers from . We have added pandas as a dependency to read input datasets instead of numpy.recfromcsv . NumPy's recfromcsv function is unable to parse datasets with complex data types. Fixed a bug that DEFAULT in the parameter(s) of nested estimator raises KeyError when exporting pipelines. Fixed a bug related to setting random_state in nested estimators. The issue would happen with pipeline with SelectFromModel ( ExtraTreesClassifier as nested estimator) or StackingEstimator if nested estimator has random_state parameter. Fixed a bug in the missing value imputation function in TPOT to impute along columns instead rows. Refined input checking for sparse matrices in TPOT. Refined the TPOT pipeline mutation operator.","title":"Version 0.9"},{"location":"releases/#version-08","text":"TPOT now detects whether there are missing values in your dataset and replaces them with the median value of the column. TPOT now allows you to set a group parameter in the fit function so you can use the GroupKFold cross-validation strategy. TPOT now allows you to set a subsample ratio of the training instance with the subsample parameter. For example, setting subsample =0.5 tells TPOT to create a fixed subsample of half of the training data for the pipeline optimization process. This parameter can be useful for speeding up the pipeline optimization process, but may give less accurate performance estimates from cross-validation. TPOT now has more built-in configurations , including TPOT MDR and TPOT light, for both classification and regression problems. TPOTClassifier and TPOTRegressor now expose three useful internal attributes, fitted_pipeline_ , pareto_front_fitted_pipelines_ , and evaluated_individuals_ . These attributes are described in the API documentation . Oh, TPOT now has thorough API documentation . Check it out! Fixed a reproducibility issue where setting random_seed didn't necessarily result in the same results every time. This bug was present since TPOT v0.7. Refined input checking in TPOT. Removed Python 2 uncompliant code.","title":"Version 0.8"},{"location":"releases/#version-07","text":"TPOT now has multiprocessing support. TPOT allows you to use multiple processes in parallel to accelerate the pipeline optimization process in TPOT with the n_jobs parameter. TPOT now allows you to customize the operators and parameters considered during the optimization process , which can be accomplished with the new config_dict parameter. The format of this customized dictionary can be found in the online documentation , along with a list of built-in configurations . TPOT now allows you to specify a time limit for evaluating a single pipeline (default limit is 5 minutes) in optimization process with the max_eval_time_mins parameter, so TPOT won't spend hours evaluating overly-complex pipelines. We tweaked TPOT's underlying evolutionary optimization algorithm to work even better, including using the mu+lambda algorithm . This algorithm gives you more control of how many pipelines are generated every iteration with the offspring_size parameter. Refined the default operators and parameters in TPOT, so TPOT 0.7 should work even better than 0.6. TPOT now supports sample weights in the fitness function if some if your samples are more important to classify correctly than others. The sample weights option works the same as in scikit-learn, e.g., tpot.fit(x_train, y_train, sample_weights=sample_weights) . The default scoring metric in TPOT has been changed from balanced accuracy to accuracy, the same default metric for classification algorithms in scikit-learn. Balanced accuracy can still be used by setting scoring='balanced_accuracy' when creating a TPOT instance.","title":"Version 0.7"},{"location":"releases/#version-06","text":"TPOT now supports regression problems! We have created two separate TPOTClassifier and TPOTRegressor classes to support classification and regression problems, respectively. The command-line interface also supports this feature through the -mode parameter. TPOT now allows you to specify a time limit for the optimization process with the max_time_mins parameter, so you don't need to guess how long TPOT will take any more to recommend a pipeline to you. Added a new operator that performs feature selection using ExtraTrees feature importance scores. XGBoost has been added as an optional dependency to TPOT. If you have XGBoost installed, TPOT will automatically detect your installation and use the XGBoostClassifier and XGBoostRegressor in its pipelines. TPOT now offers a verbosity level of 3 (\"science mode\"), which outputs the entire Pareto front instead of only the current best score. This feature may be useful for users looking to make a trade-off between pipeline complexity and score.","title":"Version 0.6"},{"location":"releases/#version-05","text":"Major refactor: Each operator is defined in a separate class file. Hooray for easier-to-maintain code! TPOT now exports directly to scikit-learn Pipelines instead of hacky code. Internal representation of individuals now uses scikit-learn pipelines. Parameters for each operator have been optimized so TPOT spends less time exploring useless parameters. We have removed pandas as a dependency and instead use numpy matrices to store the data. TPOT now uses k-fold cross-validation when evaluating pipelines, with a default k = 3. This k parameter can be tuned when creating a new TPOT instance. Improved scoring function support : Even though TPOT uses balanced accuracy by default, you can now have TPOT use any of the scoring functions that cross_val_score supports. Added the scikit-learn Normalizer preprocessor. Minor text fixes.","title":"Version 0.5"},{"location":"releases/#version-04","text":"In TPOT 0.4, we've made some major changes to the internals of TPOT and added some convenience functions. We've summarized the changes below. Added new sklearn models and preprocessors AdaBoostClassifier BernoulliNB ExtraTreesClassifier GaussianNB MultinomialNB LinearSVC PassiveAggressiveClassifier GradientBoostingClassifier RBFSampler FastICA FeatureAgglomeration Nystroem Added operator that inserts virtual features for the count of features with values of zero Reworked parameterization of TPOT operators Reduced parameter search space with information from a scikit-learn benchmark TPOT no longer generates arbitrary parameter values, but uses a fixed parameter set instead Removed XGBoost as a dependency Too many users were having install issues with XGBoost Replaced with scikit-learn's GradientBoostingClassifier Improved descriptiveness of TPOT command line parameter documentation Removed min/max/avg details during fit() when verbosity > 1 Replaced with tqdm progress bar Added tqdm as a dependency Added fit_predict() convenience function Added get_params() function so TPOT can operate in scikit-learn's cross_val_score & related functions","title":"Version 0.4"},{"location":"releases/#version-03","text":"We revised the internal optimization process of TPOT to make it more efficient, in particular in regards to the model parameters that TPOT optimizes over.","title":"Version 0.3"},{"location":"releases/#version-02","text":"TPOT now has the ability to export the optimized pipelines to sklearn code. Logistic regression, SVM, and k-nearest neighbors classifiers were added as pipeline operators. Previously, TPOT only included decision tree and random forest classifiers. TPOT can now use arbitrary scoring functions for the optimization process. TPOT now performs multi-objective Pareto optimization to balance model complexity (i.e., # of pipeline operators) and the score of the pipeline.","title":"Version 0.2"},{"location":"releases/#version-01","text":"First public release of TPOT. Optimizes pipelines with decision trees and random forest classifiers as the model, and uses a handful of feature preprocessors.","title":"Version 0.1"},{"location":"support/","text":"TPOT was developed in the Computational Genetics Lab at the University of Pennsylvania with funding from the NIH under grant R01 AI117694. We are incredibly grateful for the support of the NIH and the University of Pennsylvania during the development of this project. The TPOT logo was designed by Todd Newmuis, who generously donated his time to the project.","title":"Support"},{"location":"using/","text":"Using TPOT What to expect from AutoML software Automated machine learning (AutoML) takes a higher-level approach to machine learning than most practitioners are used to, so we've gathered a handful of guidelines on what to expect when running AutoML software such as TPOT. AutoML algorithms aren't intended to run for only a few minutes Of course, you can run TPOT for only a few minutes and it will find a reasonably good pipeline for your dataset. However, if you don't run TPOT for long enough, it may not find the best possible pipeline for your dataset. It may even not find any suitable pipeline at all, in which case a RuntimeError('A pipeline has not yet been optimized. Please call fit() first.') will be raised. Often it is worthwhile to run multiple instances of TPOT in parallel for a long time (hours to days) to allow TPOT to thoroughly search the pipeline space for your dataset. AutoML algorithms can take a long time to finish their search AutoML algorithms aren't as simple as fitting one model on the dataset; they are considering multiple machine learning algorithms (random forests, linear models, SVMs, etc.) in a pipeline with multiple preprocessing steps (missing value imputation, scaling, PCA, feature selection, etc.), the hyperparameters for all of the models and preprocessing steps, as well as multiple ways to ensemble or stack the algorithms within the pipeline. As such, TPOT will take a while to run on larger datasets, but it's important to realize why. With the default TPOT settings (100 generations with 100 population size), TPOT will evaluate 10,000 pipeline configurations before finishing. To put this number into context, think about a grid search of 10,000 hyperparameter combinations for a machine learning algorithm and how long that grid search will take. That is 10,000 model configurations to evaluate with 10-fold cross-validation, which means that roughly 100,000 models are fit and evaluated on the training data in one grid search. That's a time-consuming procedure, even for simpler models like decision trees. Typical TPOT runs will take hours to days to finish (unless it's a small dataset), but you can always interrupt the run partway through and see the best results so far. TPOT also provides a warm_start parameter that lets you restart a TPOT run from where it left off. AutoML algorithms can recommend different solutions for the same dataset If you're working with a reasonably complex dataset or run TPOT for a short amount of time, different TPOT runs may result in different pipeline recommendations. TPOT's optimization algorithm is stochastic in nature, which means that it uses randomness (in part) to search the possible pipeline space. When two TPOT runs recommend different pipelines, this means that the TPOT runs didn't converge due to lack of time or that multiple pipelines perform more-or-less the same on your dataset. This is actually an advantage over fixed grid search techniques: TPOT is meant to be an assistant that gives you ideas on how to solve a particular machine learning problem by exploring pipeline configurations that you might have never considered, then leaves the fine-tuning to more constrained parameter tuning techniques such as grid search. TPOT with code We've taken care to design the TPOT interface to be as similar as possible to scikit-learn. TPOT can be imported just like any regular Python module. To import TPOT, type: from tpot import TPOTClassifier then create an instance of TPOT as follows: pipeline_optimizer = TPOTClassifier() It's also possible to use TPOT for regression problems with the TPOTRegressor class. Other than the class name, a TPOTRegressor is used the same way as a TPOTClassifier . You can read more about the TPOTClassifier and TPOTRegressor classes in the API documentation . Some example code with custom TPOT parameters might look like: pipeline_optimizer = TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) Now TPOT is ready to optimize a pipeline for you. You can tell TPOT to optimize a pipeline based on a data set with the fit function: pipeline_optimizer.fit(X_train, y_train) The fit function initializes the genetic programming algorithm to find the highest-scoring pipeline based on average k-fold cross-validation Then, the pipeline is trained on the entire set of provided samples, and the TPOT instance can be used as a fitted model. You can then proceed to evaluate the final pipeline on the testing set with the score function: print(pipeline_optimizer.score(X_test, y_test)) Finally, you can tell TPOT to export the corresponding Python code for the optimized pipeline to a text file with the export function: pipeline_optimizer.export('tpot_exported_pipeline.py') Once this code finishes running, tpot_exported_pipeline.py will contain the Python code for the optimized pipeline. Below is a full example script using TPOT to optimize a pipeline, score it, and export the best pipeline to a file. from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) pipeline_optimizer = TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) pipeline_optimizer.fit(X_train, y_train) print(pipeline_optimizer.score(X_test, y_test)) pipeline_optimizer.export('tpot_exported_pipeline.py') Check our examples to see TPOT applied to some specific data sets. TPOT on the command line To use TPOT via the command line, enter the following command with a path to the data file: tpot /path_to/data_file.csv An example command-line call to TPOT may look like: tpot data/mnist.csv -is , -target class -o tpot_exported_pipeline.py -g 5 -p 20 -cv 5 -s 42 -v 2 TPOT offers several arguments that can be provided at the command line. To see brief descriptions of these arguments, enter the following command: tpot --help Detailed descriptions of the command-line arguments are below. Argument Parameter Valid values Effect -is INPUT_SEPARATOR Any string Character used to separate columns in the input file. -target TARGET_NAME Any string Name of the target column in the input file. -mode TPOT_MODE ['classification', 'regression'] Whether TPOT is being used for a supervised classification or regression problem. -o OUTPUT_FILE String path to a file File to export the code for the final optimized pipeline. -g GENERATIONS Any positive integer or None Number of iterations to run the pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate POPULATION_SIZE + GENERATIONS x OFFSPRING_SIZE pipelines in total. -p POPULATION_SIZE Any positive integer Number of individuals to retain in the GP population every generation. Generally, TPOT will work better when you give it more individuals (and therefore time) to optimize the pipeline. TPOT will evaluate POPULATION_SIZE + GENERATIONS x OFFSPRING_SIZE pipelines in total. -os OFFSPRING_SIZE Any positive integer Number of offspring to produce in each GP generation. By default, OFFSPRING_SIZE = POPULATION_SIZE. -mr MUTATION_RATE [0.0, 1.0] GP mutation rate in the range [0.0, 1.0]. This tells the GP algorithm how many pipelines to apply random changes to every generation. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. -xr CROSSOVER_RATE [0.0, 1.0] GP crossover rate in the range [0.0, 1.0]. This tells the GP algorithm how many pipelines to \"breed\" every generation. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. -scoring SCORING_FN 'accuracy', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'neg_log_loss', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'neg_median_absolute_error', 'precision', 'precision_macro', 'precision_micro', 'precision_samples', 'precision_weighted', 'r2', 'recall', 'recall_macro', 'recall_micro', 'recall_samples', 'recall_weighted', 'roc_auc', 'my_module.scorer_name*' Function used to evaluate the quality of a given pipeline for the problem. By default, accuracy is used for classification and mean squared error (MSE) is used for regression. TPOT assumes that any function with \"error\" or \"loss\" in the name is meant to be minimized, whereas any other functions will be maximized. my_module.scorer_name: You can also specify your own function or a full python path to an existing one. See the section on scoring functions for more details. -cv CV Any integer > 1 Number of folds to evaluate each pipeline over in k-fold cross-validation during the TPOT optimization process. -sub SUBSAMPLE (0.0, 1.0] Subsample ratio of the training instance. Setting it to 0.5 means that TPOT randomly collects half of training samples for pipeline optimization process. -njobs NUM_JOBS Any positive integer or -1 Number of CPUs for evaluating pipelines in parallel during the TPOT optimization process. Assigning this to -1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. -maxtime MAX_TIME_MINS Any positive integer How many minutes TPOT has to optimize the pipeline. How many minutes TPOT has to optimize the pipeline.If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generationsis set and all generations are already evaluated. -maxeval MAX_EVAL_MINS Any positive float How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to consider more complex pipelines but will also allow TPOT to run longer. -s RANDOM_STATE Any positive integer Random number generator seed for reproducibility. Set this seed if you want your TPOT run to be reproducible with the same seed and data set in the future. -config CONFIG_FILE String or file path Operators and parameter configurations in TPOT: Path for configuration file: TPOT will use the path to a configuration file for customizing the operators and parameters that TPOT uses in the optimization process string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. -template TEMPLATE String Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer, Classifier or Regressor) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html), [`ClassifierMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.ClassifierMixin.html) or [`RegressorMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Classifier\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. -memory MEMORY String or file path If supplied, pipeline will cache each transformer after calling fit. 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. Memory caching mode in TPOT: Path for a caching directory: TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown. string 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown. -cf CHECKPOINT_FOLDER Folder path If supplied, a folder you created, in which tpot will periodically save pipelines in pareto front so far while optimizing. This is useful in multiple cases: sudden death before tpot could save an optimized pipeline progress tracking grabbing a pipeline while tpot is working Example: mkdir my_checkpoints -cf ./my_checkpoints -es EARLY_STOP Any positive integer How many generations TPOT checks whether there is no improvement in optimization process. End optimization process if there is no improvement in the set number of generations. -v VERBOSITY {0, 1, 2, 3} How much information TPOT communicates while it is running. 0 = none, 1 = minimal, 2 = high, 3 = all. A setting of 2 or higher will add a progress bar during the optimization procedure. -log LOG Folder path Save progress content to a file. --no-update-check Flag indicating whether the TPOT version checker should be disabled. --version Show TPOT's version number and exit. --help Show TPOT's help documentation and exit. Scoring functions TPOT makes use of sklearn.model_selection.cross_val_score for evaluating pipelines, and as such offers the same support for scoring functions. There are two ways to make use of scoring functions with TPOT: You can pass in a string to the scoring parameter from the list above. Any other strings will cause TPOT to throw an exception. You can pass the callable object/function with signature scorer(estimator, X, y) , where estimator is trained estimator to use for scoring, X are features that will be passed to estimator.predict and y are target values for X . To do this, you should implement your own function. See the example below for further explanation. from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from sklearn.metrics import make_scorer digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) # Make a custom metric function def my_custom_accuracy(y_true, y_pred): return float(sum(y_pred == y_true)) / len(y_true) # Make a custom a scorer from the custom metric function # Note: greater_is_better=False in make_scorer below would mean that the scoring function should be minimized. my_custom_scorer = make_scorer(my_custom_accuracy, greater_is_better=True) tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, scoring=my_custom_scorer) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') my_module.scorer_name : You can also use a custom score_func(y_true, y_pred) or scorer(estimator, X, y) function through the command line by adding the argument -scoring my_module.scorer to your command-line call. TPOT will import your module and use the custom scoring function from there. TPOT will include your current working directory when importing the module, so you can place it in the same directory where you are going to run TPOT. Example: -scoring sklearn.metrics.auc will use the function auc from sklearn.metrics module. Built-in TPOT configurations TPOT comes with a handful of default operators and parameter configurations that we believe work well for optimizing machine learning pipelines. Below is a list of the current built-in configurations that come with TPOT. Configuration Name Description Operators Default TPOT TPOT will search over a broad range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Some of these operators are complex and may take a long time to run, especially on larger datasets. Note: This is the default configuration for TPOT. To use this configuration, use the default value (None) for the config_dict parameter. Classification Regression TPOT light TPOT will search over a restricted range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Only simpler and fast-running operators will be used in these pipelines, so TPOT light is useful for finding quick and simple pipelines for a classification or regression problem. This configuration works for both the TPOTClassifier and TPOTRegressor. Classification Regression TPOT MDR TPOT will search over a series of feature selectors and Multifactor Dimensionality Reduction models to find a series of operators that maximize prediction accuracy. The TPOT MDR configuration is specialized for genome-wide association studies (GWAS) , and is described in detail online here . Note that TPOT MDR may be slow to run because the feature selection routines are computationally expensive, especially on large datasets. Classification Regression TPOT sparse TPOT uses a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices. This configuration works for both the TPOTClassifier and TPOTRegressor. Classification Regression TPOT-NN TPOT uses the same configuration as \"Default TPOT\" plus additional neural network estimators written in PyTorch (currently only `tpot.builtins.PytorchLRClassifier` and `tpot.builtins.PytorchMLPClassifier`). Currently only classification is supported, but future releases will include regression estimators. Classification To use any of these configurations, simply pass the string name of the configuration to the config_dict parameter (or -config on the command line). For example, to use the \"TPOT light\" configuration: from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, config_dict='TPOT light') tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Customizing TPOT's operators and parameters Beyond the default configurations that come with TPOT, in some cases it is useful to limit the algorithms and parameters that TPOT considers. For that reason, we allow users to provide TPOT with a custom configuration for its operators and parameters. The custom TPOT configuration must be in nested dictionary format, where the first level key is the path and name of the operator (e.g., sklearn.naive_bayes.MultinomialNB ) and the second level key is the corresponding parameter name for that operator (e.g., fit_prior ). The second level key should point to a list of parameter values for that parameter, e.g., 'fit_prior': [True, False] . For a simple example, the configuration could be: tpot_config = { 'sklearn.naive_bayes.GaussianNB': { }, 'sklearn.naive_bayes.BernoulliNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] }, 'sklearn.naive_bayes.MultinomialNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] } } in which case TPOT would only consider pipelines containing GaussianNB , BernoulliNB , MultinomialNB , and tune those algorithm's parameters in the ranges provided. This dictionary can be passed directly within the code to the TPOTClassifier / TPOTRegressor config_dict parameter, described above. For example: from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot_config = { 'sklearn.naive_bayes.GaussianNB': { }, 'sklearn.naive_bayes.BernoulliNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] }, 'sklearn.naive_bayes.MultinomialNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] } } tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, config_dict=tpot_config) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Command-line users must create a separate .py file with the custom configuration and provide the path to the file to the tpot call. For example, if the simple example configuration above is saved in tpot_classifier_config.py , that configuration could be used on the command line with the command: tpot data/mnist.csv -is , -target class -config tpot_classifier_config.py -g 5 -p 20 -v 2 -o tpot_exported_pipeline.py When using the command-line interface, the configuration file specified in the -config parameter must name its custom TPOT configuration tpot_config . Otherwise, TPOT will not be able to locate the configuration dictionary. For more detailed examples of how to customize TPOT's operator configuration, see the default configurations for classification and regression in TPOT's source code. Note that you must have all of the corresponding packages for the operators installed on your computer, otherwise TPOT will not be able to use them. For example, if XGBoost is not installed on your computer, then TPOT will simply not import nor use XGBoost in the pipelines it considers. Template option in TPOT Template option provides a way to specify a desired structure for machine learning pipeline, which may reduce TPOT computation time and potentially provide more interpretable results. Current implementation only supports linear pipelines. Below is a simple example to use template option. The pipelines generated/evaluated in TPOT will follow this structure: 1st step is a feature selector (a subclass of SelectorMixin ), 2nd step is a feature transformer (a subclass of TransformerMixin ) and 3rd step is a classifier for classification (a subclass of ClassifierMixin ). The last step must be Classifier for TPOTClassifier 's template but Regressor for TPOTRegressor . Note: although SelectorMixin is subclass of TransformerMixin in scikit-learn, but Transformer in this option excludes those subclasses of SelectorMixin . tpot_obj = TPOTClassifier( template='Selector-Transformer-Classifier' ) If a specific operator, e.g. SelectPercentile , is preferred for usage in the 1st step of the pipeline, the template can be defined like 'SelectPercentile-Transformer-Classifier'. FeatureSetSelector in TPOT FeatureSetSelector is a special new operator in TPOT. This operator enables feature selection based on priori expert knowledge. For example, in RNA-seq gene expression analysis, this operator can be used to select one or more gene (feature) set(s) based on GO (Gene Ontology) terms or annotated gene sets Molecular Signatures Database ( MSigDB ) in the 1st step of pipeline via template option above, in order to reduce dimensions and TPOT computation time. This operator requires a dataset list in csv format. In this csv file, there are only three columns: 1st column is feature set names, 2nd column is the total number of features in one set and 3rd column is a list of feature names (if input X is pandas.DataFrame) or indexes (if input X is numpy.ndarray) delimited by \";\". Below is a example how to use this operator in TPOT. Please check our preprint paper for more details. from tpot import TPOTClassifier import numpy as np import pandas as pd from tpot.config import classifier_config_dict test_data = pd.read_csv(\"https://raw.githubusercontent.com/EpistasisLab/tpot/master/tests/tests.csv\") test_X = test_data.drop(\"class\", axis=1) test_y = test_data['class'] # add FeatureSetSelector into tpot configuration classifier_config_dict['tpot.builtins.FeatureSetSelector'] = { 'subset_list': ['https://raw.githubusercontent.com/EpistasisLab/tpot/master/tests/subset_test.csv'], 'sel_subset': [0,1] # select only one feature set, a list of index of subset in the list above #'sel_subset': list(combinations(range(3), 2)) # select two feature sets } tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, template='FeatureSetSelector-Transformer-Classifier', config_dict=classifier_config_dict) tpot.fit(test_X, test_y) Pipeline caching in TPOT With the memory parameter, pipelines can cache the results of each transformer after fitting them. This feature is used to avoid repeated computation by transformers within a pipeline if the parameters and input data are identical to another fitted pipeline during optimization process. TPOT allows users to specify a custom directory path or joblib.Memory in case they want to re-use the memory cache in future TPOT runs (or a warm_start run). There are three methods for enabling memory caching in TPOT: from tpot import TPOTClassifier from tempfile import mkdtemp from joblib import Memory from shutil import rmtree # Method 1, auto mode: TPOT uses memory caching with a temporary directory and cleans it up upon shutdown tpot = TPOTClassifier(memory='auto') # Method 2, with a custom directory for memory caching tpot = TPOTClassifier(memory='/to/your/path') # Method 3, with a Memory object cachedir = mkdtemp() # Create a temporary folder memory = Memory(cachedir=cachedir, verbose=0) tpot = TPOTClassifier(memory=memory) # Clear the cache directory when you don't need it anymore rmtree(cachedir) Note: TPOT does NOT clean up memory caches if users set a custom directory path or Memory object. We recommend that you clean up the memory caches when you don't need it anymore. Crash/freeze issue with n_jobs > 1 under OSX or Linux Internally, TPOT uses joblib to fit estimators in parallel. This is the same parallelization framework used by scikit-learn. But it may crash/freeze with n_jobs > 1 under OSX or Linux as scikit-learn does , especially with large datasets. One solution is to configure Python's multiprocessing module to use the forkserver start method (instead of the default fork ) to manage the process pools. You can enable the forkserver mode globally for your program by putting the following codes into your main script: import multiprocessing # other imports, custom code, load data, define model... if __name__ == '__main__': multiprocessing.set_start_method('forkserver') # call scikit-learn utils or tpot utils with n_jobs > 1 here More information about these start methods can be found in the multiprocessing documentation . Parallel Training with Dask For large problems or working on Jupyter notebook, we highly recommend that you can distribute the work on a Dask cluster. The dask-examples binder has a runnable example with a small dask cluster. To use your Dask cluster to fit a TPOT model, specify the use_dask keyword when you create the TPOT estimator. Note: if use_dask=True , TPOT will use as many cores as available on the your Dask cluster. If n_jobs is specified, then it will control the chunk size (10* n_jobs if it is less then offspring size) of parallel training. estimator = TPOTEstimator(use_dask=True, n_jobs=-1) This will use use all the workers on your cluster to do the training, and use Dask-ML's pipeline rewriting to avoid re-fitting estimators multiple times on the same set of data. It will also provide fine-grained diagnostics in the distributed scheduler UI . Alternatively, Dask implements a joblib backend. You can instruct TPOT to use the distributed backend during training by specifying a joblib.parallel_backend : import joblib import distributed.joblib from dask.distributed import Client # connect to the cluster client = Client('schedueler-address') # create the estimator normally estimator = TPOTClassifier(n_jobs=-1) # perform the fit in this context manager with joblib.parallel_backend(\"dask\"): estimator.fit(X, y) See dask's distributed joblib integration for more. Neural Networks in TPOT ( tpot.nn ) Support for neural network models and deep learning is an experimental feature newly added to TPOT. Available neural network architectures are provided by the tpot.nn module. Unlike regular sklearn estimators, these models need to be written by hand, and must also inherit the appropriate base classes provided by sklearn for all of their built-in modules. In other words, they need implement methods like .fit() , fit_transform() , get_params() , etc., as described in detail on Developing scikit-learn estimators . Telling TPOT to use built-in PyTorch neural network models Mainly due to the issues described below, TPOT won't use its neural network models unless you explicitly tell it to do so. This is done as follows: Use import tpot.nn before instantiating any TPOT estimators. Use a configuration dictionary that includes one or more tpot.nn estimators, either by writing one manually, including one from a file, or by importing the configuration in tpot/config/classifier_nn.py . A very simple example that will force TPOT to only use a PyTorch-based logistic regression classifier as its main estimator is as follows: tpot_config = { 'tpot.nn.PytorchLRClassifier': { 'learning_rate': [1e-3, 1e-2, 1e-1, 0.5, 1.] } } Alternatively, use a template string including PytorchLRClassifier or PytorchMLPClassifier while loading the TPOT-NN configuration dictionary. Neural network models are notorious for being extremely sensitive to their initialization parameters, so you may need to heavily adjust tpot.nn configuration dictionaries in order to attain good performance on your dataset. A simple example of using TPOT-NN is shown in examples . Important caveats Neural network models (especially when they reach moderately large sizes) take a notoriously large amount of time and computing power to train. You should expect tpot.nn neural networks to train several orders of magnitude slower than their sklearn alternatives. This can be alleviated somewhat by training the models on computers with CUDA-enabled GPUs. TPOT will occasionally learn pipelines that stack several sklearn estimators. Mathematically, these can be nearly identical to some deep learning models. For example, by stacking several sklearn.linear_model.LogisticRegression s, you end up with a very close approximation of a Multilayer Perceptron; one of the simplest and most well known deep learning architectures. TPOT's genetic programming algorithms generally optimize these 'networks' much faster than PyTorch, which typically uses a more brute-force convex optimization approach. The problem of 'black box' model introspection is one of the most substantial criticisms and challenges of deep learning. This problem persists in tpot.nn , whereas TPOT's default estimators often are far easier to introspect.","title":"Using TPOT"},{"location":"using/#using-tpot","text":"","title":"Using TPOT"},{"location":"using/#what-to-expect-from-automl-software","text":"Automated machine learning (AutoML) takes a higher-level approach to machine learning than most practitioners are used to, so we've gathered a handful of guidelines on what to expect when running AutoML software such as TPOT.","title":"What to expect from AutoML software"},{"location":"using/#tpot-with-code","text":"We've taken care to design the TPOT interface to be as similar as possible to scikit-learn. TPOT can be imported just like any regular Python module. To import TPOT, type: from tpot import TPOTClassifier then create an instance of TPOT as follows: pipeline_optimizer = TPOTClassifier() It's also possible to use TPOT for regression problems with the TPOTRegressor class. Other than the class name, a TPOTRegressor is used the same way as a TPOTClassifier . You can read more about the TPOTClassifier and TPOTRegressor classes in the API documentation . Some example code with custom TPOT parameters might look like: pipeline_optimizer = TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) Now TPOT is ready to optimize a pipeline for you. You can tell TPOT to optimize a pipeline based on a data set with the fit function: pipeline_optimizer.fit(X_train, y_train) The fit function initializes the genetic programming algorithm to find the highest-scoring pipeline based on average k-fold cross-validation Then, the pipeline is trained on the entire set of provided samples, and the TPOT instance can be used as a fitted model. You can then proceed to evaluate the final pipeline on the testing set with the score function: print(pipeline_optimizer.score(X_test, y_test)) Finally, you can tell TPOT to export the corresponding Python code for the optimized pipeline to a text file with the export function: pipeline_optimizer.export('tpot_exported_pipeline.py') Once this code finishes running, tpot_exported_pipeline.py will contain the Python code for the optimized pipeline. Below is a full example script using TPOT to optimize a pipeline, score it, and export the best pipeline to a file. from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) pipeline_optimizer = TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) pipeline_optimizer.fit(X_train, y_train) print(pipeline_optimizer.score(X_test, y_test)) pipeline_optimizer.export('tpot_exported_pipeline.py') Check our examples to see TPOT applied to some specific data sets.","title":"TPOT with code"},{"location":"using/#tpot-on-the-command-line","text":"To use TPOT via the command line, enter the following command with a path to the data file: tpot /path_to/data_file.csv An example command-line call to TPOT may look like: tpot data/mnist.csv -is , -target class -o tpot_exported_pipeline.py -g 5 -p 20 -cv 5 -s 42 -v 2 TPOT offers several arguments that can be provided at the command line. To see brief descriptions of these arguments, enter the following command: tpot --help Detailed descriptions of the command-line arguments are below. Argument Parameter Valid values Effect -is INPUT_SEPARATOR Any string Character used to separate columns in the input file. -target TARGET_NAME Any string Name of the target column in the input file. -mode TPOT_MODE ['classification', 'regression'] Whether TPOT is being used for a supervised classification or regression problem. -o OUTPUT_FILE String path to a file File to export the code for the final optimized pipeline. -g GENERATIONS Any positive integer or None Number of iterations to run the pipeline optimization process. It must be a positive number or None. If None, the parameter max_time_mins must be defined as the runtime limit. Generally, TPOT will work better when you give it more generations (and therefore time) to optimize the pipeline. TPOT will evaluate POPULATION_SIZE + GENERATIONS x OFFSPRING_SIZE pipelines in total. -p POPULATION_SIZE Any positive integer Number of individuals to retain in the GP population every generation. Generally, TPOT will work better when you give it more individuals (and therefore time) to optimize the pipeline. TPOT will evaluate POPULATION_SIZE + GENERATIONS x OFFSPRING_SIZE pipelines in total. -os OFFSPRING_SIZE Any positive integer Number of offspring to produce in each GP generation. By default, OFFSPRING_SIZE = POPULATION_SIZE. -mr MUTATION_RATE [0.0, 1.0] GP mutation rate in the range [0.0, 1.0]. This tells the GP algorithm how many pipelines to apply random changes to every generation. We recommend using the default parameter unless you understand how the mutation rate affects GP algorithms. -xr CROSSOVER_RATE [0.0, 1.0] GP crossover rate in the range [0.0, 1.0]. This tells the GP algorithm how many pipelines to \"breed\" every generation. We recommend using the default parameter unless you understand how the crossover rate affects GP algorithms. -scoring SCORING_FN 'accuracy', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'neg_log_loss', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'neg_median_absolute_error', 'precision', 'precision_macro', 'precision_micro', 'precision_samples', 'precision_weighted', 'r2', 'recall', 'recall_macro', 'recall_micro', 'recall_samples', 'recall_weighted', 'roc_auc', 'my_module.scorer_name*' Function used to evaluate the quality of a given pipeline for the problem. By default, accuracy is used for classification and mean squared error (MSE) is used for regression. TPOT assumes that any function with \"error\" or \"loss\" in the name is meant to be minimized, whereas any other functions will be maximized. my_module.scorer_name: You can also specify your own function or a full python path to an existing one. See the section on scoring functions for more details. -cv CV Any integer > 1 Number of folds to evaluate each pipeline over in k-fold cross-validation during the TPOT optimization process. -sub SUBSAMPLE (0.0, 1.0] Subsample ratio of the training instance. Setting it to 0.5 means that TPOT randomly collects half of training samples for pipeline optimization process. -njobs NUM_JOBS Any positive integer or -1 Number of CPUs for evaluating pipelines in parallel during the TPOT optimization process. Assigning this to -1 will use as many cores as available on the computer. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used. -maxtime MAX_TIME_MINS Any positive integer How many minutes TPOT has to optimize the pipeline. How many minutes TPOT has to optimize the pipeline.If not None, this setting will allow TPOT to run until max_time_mins minutes elapsed and then stop. TPOT will stop earlier if generationsis set and all generations are already evaluated. -maxeval MAX_EVAL_MINS Any positive float How many minutes TPOT has to evaluate a single pipeline. Setting this parameter to higher values will allow TPOT to consider more complex pipelines but will also allow TPOT to run longer. -s RANDOM_STATE Any positive integer Random number generator seed for reproducibility. Set this seed if you want your TPOT run to be reproducible with the same seed and data set in the future. -config CONFIG_FILE String or file path Operators and parameter configurations in TPOT: Path for configuration file: TPOT will use the path to a configuration file for customizing the operators and parameters that TPOT uses in the optimization process string 'TPOT light', TPOT will use a built-in configuration with only fast models and preprocessors string 'TPOT MDR', TPOT will use a built-in configuration specialized for genomic studies string 'TPOT sparse': TPOT will use a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices. See the built-in configurations section for the list of configurations included with TPOT, and the custom configuration section for more information and examples of how to create your own TPOT configurations. -template TEMPLATE String Template of predefined pipeline structure. The option is for specifying a desired structure for the machine learning pipeline evaluated in TPOT. So far this option only supports linear pipeline structure. Each step in the pipeline should be a main class of operators (Selector, Transformer, Classifier or Regressor) or a specific operator (e.g. `SelectPercentile`) defined in TPOT operator configuration. If one step is a main class, TPOT will randomly assign all subclass operators (subclasses of [`SelectorMixin`](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/base.py#L17), [`TransformerMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.TransformerMixin.html), [`ClassifierMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.ClassifierMixin.html) or [`RegressorMixin`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html) in scikit-learn) to that step. Steps in the template are delimited by \"-\", e.g. \"SelectPercentile-Transformer-Classifier\". By default value of template is None, TPOT generates tree-based pipeline randomly. See the template option in tpot section for more details. -memory MEMORY String or file path If supplied, pipeline will cache each transformer after calling fit. 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. Memory caching mode in TPOT: Path for a caching directory: TPOT uses memory caching with the provided directory and TPOT does NOT clean the caching directory up upon shutdown. string 'auto': TPOT uses memory caching with a temporary directory and cleans it up upon shutdown. -cf CHECKPOINT_FOLDER Folder path If supplied, a folder you created, in which tpot will periodically save pipelines in pareto front so far while optimizing. This is useful in multiple cases: sudden death before tpot could save an optimized pipeline progress tracking grabbing a pipeline while tpot is working Example: mkdir my_checkpoints -cf ./my_checkpoints -es EARLY_STOP Any positive integer How many generations TPOT checks whether there is no improvement in optimization process. End optimization process if there is no improvement in the set number of generations. -v VERBOSITY {0, 1, 2, 3} How much information TPOT communicates while it is running. 0 = none, 1 = minimal, 2 = high, 3 = all. A setting of 2 or higher will add a progress bar during the optimization procedure. -log LOG Folder path Save progress content to a file. --no-update-check Flag indicating whether the TPOT version checker should be disabled. --version Show TPOT's version number and exit. --help Show TPOT's help documentation and exit.","title":"TPOT on the command line"},{"location":"using/#scoring-functions","text":"TPOT makes use of sklearn.model_selection.cross_val_score for evaluating pipelines, and as such offers the same support for scoring functions. There are two ways to make use of scoring functions with TPOT: You can pass in a string to the scoring parameter from the list above. Any other strings will cause TPOT to throw an exception. You can pass the callable object/function with signature scorer(estimator, X, y) , where estimator is trained estimator to use for scoring, X are features that will be passed to estimator.predict and y are target values for X . To do this, you should implement your own function. See the example below for further explanation. from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from sklearn.metrics import make_scorer digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) # Make a custom metric function def my_custom_accuracy(y_true, y_pred): return float(sum(y_pred == y_true)) / len(y_true) # Make a custom a scorer from the custom metric function # Note: greater_is_better=False in make_scorer below would mean that the scoring function should be minimized. my_custom_scorer = make_scorer(my_custom_accuracy, greater_is_better=True) tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, scoring=my_custom_scorer) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') my_module.scorer_name : You can also use a custom score_func(y_true, y_pred) or scorer(estimator, X, y) function through the command line by adding the argument -scoring my_module.scorer to your command-line call. TPOT will import your module and use the custom scoring function from there. TPOT will include your current working directory when importing the module, so you can place it in the same directory where you are going to run TPOT. Example: -scoring sklearn.metrics.auc will use the function auc from sklearn.metrics module.","title":"Scoring functions"},{"location":"using/#built-in-tpot-configurations","text":"TPOT comes with a handful of default operators and parameter configurations that we believe work well for optimizing machine learning pipelines. Below is a list of the current built-in configurations that come with TPOT. Configuration Name Description Operators Default TPOT TPOT will search over a broad range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Some of these operators are complex and may take a long time to run, especially on larger datasets. Note: This is the default configuration for TPOT. To use this configuration, use the default value (None) for the config_dict parameter. Classification Regression TPOT light TPOT will search over a restricted range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Only simpler and fast-running operators will be used in these pipelines, so TPOT light is useful for finding quick and simple pipelines for a classification or regression problem. This configuration works for both the TPOTClassifier and TPOTRegressor. Classification Regression TPOT MDR TPOT will search over a series of feature selectors and Multifactor Dimensionality Reduction models to find a series of operators that maximize prediction accuracy. The TPOT MDR configuration is specialized for genome-wide association studies (GWAS) , and is described in detail online here . Note that TPOT MDR may be slow to run because the feature selection routines are computationally expensive, especially on large datasets. Classification Regression TPOT sparse TPOT uses a configuration dictionary with a one-hot encoder and the operators normally included in TPOT that also support sparse matrices. This configuration works for both the TPOTClassifier and TPOTRegressor. Classification Regression TPOT-NN TPOT uses the same configuration as \"Default TPOT\" plus additional neural network estimators written in PyTorch (currently only `tpot.builtins.PytorchLRClassifier` and `tpot.builtins.PytorchMLPClassifier`). Currently only classification is supported, but future releases will include regression estimators. Classification To use any of these configurations, simply pass the string name of the configuration to the config_dict parameter (or -config on the command line). For example, to use the \"TPOT light\" configuration: from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, config_dict='TPOT light') tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py')","title":"Built-in TPOT configurations"},{"location":"using/#customizing-tpots-operators-and-parameters","text":"Beyond the default configurations that come with TPOT, in some cases it is useful to limit the algorithms and parameters that TPOT considers. For that reason, we allow users to provide TPOT with a custom configuration for its operators and parameters. The custom TPOT configuration must be in nested dictionary format, where the first level key is the path and name of the operator (e.g., sklearn.naive_bayes.MultinomialNB ) and the second level key is the corresponding parameter name for that operator (e.g., fit_prior ). The second level key should point to a list of parameter values for that parameter, e.g., 'fit_prior': [True, False] . For a simple example, the configuration could be: tpot_config = { 'sklearn.naive_bayes.GaussianNB': { }, 'sklearn.naive_bayes.BernoulliNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] }, 'sklearn.naive_bayes.MultinomialNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] } } in which case TPOT would only consider pipelines containing GaussianNB , BernoulliNB , MultinomialNB , and tune those algorithm's parameters in the ranges provided. This dictionary can be passed directly within the code to the TPOTClassifier / TPOTRegressor config_dict parameter, described above. For example: from tpot import TPOTClassifier from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, train_size=0.75, test_size=0.25) tpot_config = { 'sklearn.naive_bayes.GaussianNB': { }, 'sklearn.naive_bayes.BernoulliNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] }, 'sklearn.naive_bayes.MultinomialNB': { 'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.], 'fit_prior': [True, False] } } tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2, config_dict=tpot_config) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_digits_pipeline.py') Command-line users must create a separate .py file with the custom configuration and provide the path to the file to the tpot call. For example, if the simple example configuration above is saved in tpot_classifier_config.py , that configuration could be used on the command line with the command: tpot data/mnist.csv -is , -target class -config tpot_classifier_config.py -g 5 -p 20 -v 2 -o tpot_exported_pipeline.py When using the command-line interface, the configuration file specified in the -config parameter must name its custom TPOT configuration tpot_config . Otherwise, TPOT will not be able to locate the configuration dictionary. For more detailed examples of how to customize TPOT's operator configuration, see the default configurations for classification and regression in TPOT's source code. Note that you must have all of the corresponding packages for the operators installed on your computer, otherwise TPOT will not be able to use them. For example, if XGBoost is not installed on your computer, then TPOT will simply not import nor use XGBoost in the pipelines it considers.","title":"Customizing TPOT's operators and parameters"},{"location":"using/#template-option-in-tpot","text":"Template option provides a way to specify a desired structure for machine learning pipeline, which may reduce TPOT computation time and potentially provide more interpretable results. Current implementation only supports linear pipelines. Below is a simple example to use template option. The pipelines generated/evaluated in TPOT will follow this structure: 1st step is a feature selector (a subclass of SelectorMixin ), 2nd step is a feature transformer (a subclass of TransformerMixin ) and 3rd step is a classifier for classification (a subclass of ClassifierMixin ). The last step must be Classifier for TPOTClassifier 's template but Regressor for TPOTRegressor . Note: although SelectorMixin is subclass of TransformerMixin in scikit-learn, but Transformer in this option excludes those subclasses of SelectorMixin . tpot_obj = TPOTClassifier( template='Selector-Transformer-Classifier' ) If a specific operator, e.g. SelectPercentile , is preferred for usage in the 1st step of the pipeline, the template can be defined like 'SelectPercentile-Transformer-Classifier'.","title":"Template option in TPOT"},{"location":"using/#featuresetselector-in-tpot","text":"FeatureSetSelector is a special new operator in TPOT. This operator enables feature selection based on priori expert knowledge. For example, in RNA-seq gene expression analysis, this operator can be used to select one or more gene (feature) set(s) based on GO (Gene Ontology) terms or annotated gene sets Molecular Signatures Database ( MSigDB ) in the 1st step of pipeline via template option above, in order to reduce dimensions and TPOT computation time. This operator requires a dataset list in csv format. In this csv file, there are only three columns: 1st column is feature set names, 2nd column is the total number of features in one set and 3rd column is a list of feature names (if input X is pandas.DataFrame) or indexes (if input X is numpy.ndarray) delimited by \";\". Below is a example how to use this operator in TPOT. Please check our preprint paper for more details. from tpot import TPOTClassifier import numpy as np import pandas as pd from tpot.config import classifier_config_dict test_data = pd.read_csv(\"https://raw.githubusercontent.com/EpistasisLab/tpot/master/tests/tests.csv\") test_X = test_data.drop(\"class\", axis=1) test_y = test_data['class'] # add FeatureSetSelector into tpot configuration classifier_config_dict['tpot.builtins.FeatureSetSelector'] = { 'subset_list': ['https://raw.githubusercontent.com/EpistasisLab/tpot/master/tests/subset_test.csv'], 'sel_subset': [0,1] # select only one feature set, a list of index of subset in the list above #'sel_subset': list(combinations(range(3), 2)) # select two feature sets } tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2, template='FeatureSetSelector-Transformer-Classifier', config_dict=classifier_config_dict) tpot.fit(test_X, test_y)","title":"FeatureSetSelector in TPOT"},{"location":"using/#pipeline-caching-in-tpot","text":"With the memory parameter, pipelines can cache the results of each transformer after fitting them. This feature is used to avoid repeated computation by transformers within a pipeline if the parameters and input data are identical to another fitted pipeline during optimization process. TPOT allows users to specify a custom directory path or joblib.Memory in case they want to re-use the memory cache in future TPOT runs (or a warm_start run). There are three methods for enabling memory caching in TPOT: from tpot import TPOTClassifier from tempfile import mkdtemp from joblib import Memory from shutil import rmtree # Method 1, auto mode: TPOT uses memory caching with a temporary directory and cleans it up upon shutdown tpot = TPOTClassifier(memory='auto') # Method 2, with a custom directory for memory caching tpot = TPOTClassifier(memory='/to/your/path') # Method 3, with a Memory object cachedir = mkdtemp() # Create a temporary folder memory = Memory(cachedir=cachedir, verbose=0) tpot = TPOTClassifier(memory=memory) # Clear the cache directory when you don't need it anymore rmtree(cachedir) Note: TPOT does NOT clean up memory caches if users set a custom directory path or Memory object. We recommend that you clean up the memory caches when you don't need it anymore.","title":"Pipeline caching in TPOT"},{"location":"using/#crashfreeze-issue-with-n_jobs-1-under-osx-or-linux","text":"Internally, TPOT uses joblib to fit estimators in parallel. This is the same parallelization framework used by scikit-learn. But it may crash/freeze with n_jobs > 1 under OSX or Linux as scikit-learn does , especially with large datasets. One solution is to configure Python's multiprocessing module to use the forkserver start method (instead of the default fork ) to manage the process pools. You can enable the forkserver mode globally for your program by putting the following codes into your main script: import multiprocessing # other imports, custom code, load data, define model... if __name__ == '__main__': multiprocessing.set_start_method('forkserver') # call scikit-learn utils or tpot utils with n_jobs > 1 here More information about these start methods can be found in the multiprocessing documentation .","title":"Crash/freeze issue with n_jobs > 1 under OSX or Linux"},{"location":"using/#parallel-training-with-dask","text":"For large problems or working on Jupyter notebook, we highly recommend that you can distribute the work on a Dask cluster. The dask-examples binder has a runnable example with a small dask cluster. To use your Dask cluster to fit a TPOT model, specify the use_dask keyword when you create the TPOT estimator. Note: if use_dask=True , TPOT will use as many cores as available on the your Dask cluster. If n_jobs is specified, then it will control the chunk size (10* n_jobs if it is less then offspring size) of parallel training. estimator = TPOTEstimator(use_dask=True, n_jobs=-1) This will use use all the workers on your cluster to do the training, and use Dask-ML's pipeline rewriting to avoid re-fitting estimators multiple times on the same set of data. It will also provide fine-grained diagnostics in the distributed scheduler UI . Alternatively, Dask implements a joblib backend. You can instruct TPOT to use the distributed backend during training by specifying a joblib.parallel_backend : import joblib import distributed.joblib from dask.distributed import Client # connect to the cluster client = Client('schedueler-address') # create the estimator normally estimator = TPOTClassifier(n_jobs=-1) # perform the fit in this context manager with joblib.parallel_backend(\"dask\"): estimator.fit(X, y) See dask's distributed joblib integration for more.","title":"Parallel Training with Dask"},{"location":"using/#neural-networks-in-tpot-tpotnn","text":"Support for neural network models and deep learning is an experimental feature newly added to TPOT. Available neural network architectures are provided by the tpot.nn module. Unlike regular sklearn estimators, these models need to be written by hand, and must also inherit the appropriate base classes provided by sklearn for all of their built-in modules. In other words, they need implement methods like .fit() , fit_transform() , get_params() , etc., as described in detail on Developing scikit-learn estimators .","title":"Neural Networks in TPOT (tpot.nn)"},{"location":"using/#telling-tpot-to-use-built-in-pytorch-neural-network-models","text":"Mainly due to the issues described below, TPOT won't use its neural network models unless you explicitly tell it to do so. This is done as follows: Use import tpot.nn before instantiating any TPOT estimators. Use a configuration dictionary that includes one or more tpot.nn estimators, either by writing one manually, including one from a file, or by importing the configuration in tpot/config/classifier_nn.py . A very simple example that will force TPOT to only use a PyTorch-based logistic regression classifier as its main estimator is as follows: tpot_config = { 'tpot.nn.PytorchLRClassifier': { 'learning_rate': [1e-3, 1e-2, 1e-1, 0.5, 1.] } } Alternatively, use a template string including PytorchLRClassifier or PytorchMLPClassifier while loading the TPOT-NN configuration dictionary. Neural network models are notorious for being extremely sensitive to their initialization parameters, so you may need to heavily adjust tpot.nn configuration dictionaries in order to attain good performance on your dataset. A simple example of using TPOT-NN is shown in examples .","title":"Telling TPOT to use built-in PyTorch neural network models"},{"location":"using/#important-caveats","text":"Neural network models (especially when they reach moderately large sizes) take a notoriously large amount of time and computing power to train. You should expect tpot.nn neural networks to train several orders of magnitude slower than their sklearn alternatives. This can be alleviated somewhat by training the models on computers with CUDA-enabled GPUs. TPOT will occasionally learn pipelines that stack several sklearn estimators. Mathematically, these can be nearly identical to some deep learning models. For example, by stacking several sklearn.linear_model.LogisticRegression s, you end up with a very close approximation of a Multilayer Perceptron; one of the simplest and most well known deep learning architectures. TPOT's genetic programming algorithms generally optimize these 'networks' much faster than PyTorch, which typically uses a more brute-force convex optimization approach. The problem of 'black box' model introspection is one of the most substantial criticisms and challenges of deep learning. This problem persists in tpot.nn , whereas TPOT's default estimators often are far easier to introspect.","title":"Important caveats"}]} \ No newline at end of file diff --git a/docs/sitemap.xml b/docs/sitemap.xml index f279acbc..eba5ad03 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -1,43 +1,43 @@ http://epistasislab.github.io/tpot/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/installing/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/using/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/api/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/examples/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/contributing/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/releases/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/citing/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/support/ - 2020-07-13 + 2020-07-21 daily http://epistasislab.github.io/tpot/related/ - 2020-07-13 + 2020-07-21 daily \ No newline at end of file diff --git a/docs/sitemap.xml.gz b/docs/sitemap.xml.gz index 6bb43e8c9ba16ca31749ae3825ac3bbc571aa0a4..673d2ea024131a9bd334617cca23a7a74081b66f 100644 GIT binary patch delta 250 zcmV5u@m*!DiO{KTw2)NE>PrX=}^raC67<-w2X`OGrTAGFq1|1rPVLx?$PR?_yY?1JaR7AQ4-Zgg#p=!CE>u$ zuF(ON#54xa35SgfTU`PNmI~_%OKXX?7(?R17H1ize?zM7SN`_RH@1N8z$OL&03L6A A3IG5A delta 251 zcmVg+iUYAE~e6Jas*swv!_nX%<)C3ZQCRv z!(t=JkS0aLoFAkPQMK|}m_2K%dOzBQ!5m?TNNfqo*D=e)gT4M}}3tOCJ82=5ax?lO*H{UW-HDD$N007Oi Bc8CA~ diff --git a/docs_sources/installing.md b/docs_sources/installing.md index 305f7f43..4890687c 100644 --- a/docs_sources/installing.md +++ b/docs_sources/installing.md @@ -20,7 +20,8 @@ TPOT is built on top of several existing Python libraries, including: * [joblib](https://joblib.readthedocs.io/en/latest/) -Most of the necessary Python packages can be installed via the [Anaconda Python distribution](https://www.continuum.io/downloads), which we strongly recommend that you use. We also strongly recommend that you use of Python 3 over Python 2 if you're given the choice. +Most of the necessary Python packages can be installed via the [Anaconda Python distribution](https://www.continuum.io/downloads), which we strongly recommend that you use. **Support for Python 3.4 and below has been officially dropped since version 0.11.0.** + You can install TPOT using `pip` or `conda-forge`. From 71e23920b4a4f27f570ffd167d33d9a66335de15 Mon Sep 17 00:00:00 2001 From: Weixuan Date: Tue, 21 Jul 2020 16:34:49 -0400 Subject: [PATCH 2/4] fix ananconda link --- docs_sources/installing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs_sources/installing.md b/docs_sources/installing.md index 4890687c..1c4557cb 100644 --- a/docs_sources/installing.md +++ b/docs_sources/installing.md @@ -20,7 +20,7 @@ TPOT is built on top of several existing Python libraries, including: * [joblib](https://joblib.readthedocs.io/en/latest/) -Most of the necessary Python packages can be installed via the [Anaconda Python distribution](https://www.continuum.io/downloads), which we strongly recommend that you use. **Support for Python 3.4 and below has been officially dropped since version 0.11.0.** +Most of the necessary Python packages can be installed via the [Anaconda Python distribution](https://www.anaconda.com/products/individual), which we strongly recommend that you use. **Support for Python 3.4 and below has been officially dropped since version 0.11.0.** You can install TPOT using `pip` or `conda-forge`. From 219f8c5abe43996abb2c19d6a1767083304a23d3 Mon Sep 17 00:00:00 2001 From: Weixuan Date: Tue, 21 Jul 2020 16:35:03 -0400 Subject: [PATCH 3/4] new pages --- docs/index.html | 2 +- docs/installing/index.html | 2 +- docs/sitemap.xml.gz | Bin 269 -> 269 bytes 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index b16f7491..bbf901aa 100644 --- a/docs/index.html +++ b/docs/index.html @@ -204,5 +204,5 @@ diff --git a/docs/installing/index.html b/docs/installing/index.html index b46a5b4e..86b24cb1 100644 --- a/docs/installing/index.html +++ b/docs/installing/index.html @@ -161,7 +161,7 @@

Installation

joblib

-

Most of the necessary Python packages can be installed via the Anaconda Python distribution, which we strongly recommend that you use. Support for Python 3.4 and below has been officially dropped since version 0.11.0.

+

Most of the necessary Python packages can be installed via the Anaconda Python distribution, which we strongly recommend that you use. Support for Python 3.4 and below has been officially dropped since version 0.11.0.

You can install TPOT using pip or conda-forge.

pip

NumPy, SciPy, scikit-learn, pandas, joblib, and PyTorch can be installed in Anaconda via the command:

diff --git a/docs/sitemap.xml.gz b/docs/sitemap.xml.gz index 673d2ea024131a9bd334617cca23a7a74081b66f..3ec7e0f5ba81e0aeae67fa4fe64720b6c2edd817 100644 GIT binary patch delta 15 WcmeBW>Sbb+@8;l$58TMc&IkYSbb+@8;mh^W4bB&IkY Date: Mon, 3 Aug 2020 09:30:26 -0400 Subject: [PATCH 4/4] increase MAX_EVAL_SECS in pretest for dataset with large numbers of features #1088 --- tpot/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpot/decorators.py b/tpot/decorators.py index aa949fee..3dac4b3c 100644 --- a/tpot/decorators.py +++ b/tpot/decorators.py @@ -33,7 +33,7 @@ NUM_TESTS = 10 -MAX_EVAL_SECS = 2 +MAX_EVAL_SECS = 10 def _pre_test(func):