Automated Machine Learning (AutoML) Search¶
Background¶
Machine Learning¶
Machine learning (ML) is the process of constructing a mathematical model of a system based on a sample dataset collected from that system.
One of the main goals of training an ML model is to teach the model to separate the signal present in the data from the noise inherent in system and in the data collection process. If this is done effectively, the model can then be used to make accurate predictions about the system when presented with new, similar data. Additionally, introspecting on an ML model can reveal key information about the system being modeled, such as which inputs and transformations of the inputs are most useful to the ML model for learning the signal in the data, and are therefore the most predictive.
There are a variety of ML problem types. Supervised learning describes the case where the collected data contains an output value to be modeled and a set of inputs with which to train the model. EvalML focuses on training supervised learning models.
EvalML supports three common supervised ML problem types. The first is regression, where the target value to model is a continuous numeric value. Next are binary and multiclass classification, where the target value to model consists of two or more discrete values or categories. The choice of which supervised ML problem type is most appropriate depends on domain expertise and on how the model will be evaluated and used.
EvalML is currently building support for supervised time series problems: time series regression, time series binary classification, and time series multiclass classification. While we’ve added some features to tackle these kinds of problems, our functionality is still being actively developed so please be mindful of that before using it.
AutoML and Search¶
AutoML is the process of automating the construction, training and evaluation of ML models. Given a data and some configuration, AutoML searches for the most effective and accurate ML model or models to fit the dataset. During the search, AutoML will explore different combinations of model type, model parameters and model architecture.
An effective AutoML solution offers several advantages over constructing and tuning ML models by hand. AutoML can assist with many of the difficult aspects of ML, such as avoiding overfitting and underfitting, imbalanced data, detecting data leakage and other potential issues with the problem setup, and automatically applying best-practice data cleaning, feature engineering, feature selection and various modeling techniques. AutoML can also leverage search algorithms to optimally sweep the hyperparameter search space, resulting in model performance which would be difficult to achieve by manual training.
AutoML in EvalML¶
EvalML supports all of the above and more.
In its simplest usage, the AutoML search interface requires only the input data, the target data and a problem_type
specifying what kind of supervised ML problem to model.
** Graphing methods, like AutoMLSearch, on Jupyter Notebook and Jupyter Lab require ipywidgets to be installed.
** If graphing on Jupyter Lab, jupyterlab-plotly required. To download this, make sure you have npm installed.
[1]:
import evalml
from evalml.utils import infer_feature_types
X, y = evalml.demos.load_fraud(n_rows=1000, return_pandas=True)
Number of Features
Boolean 1
Categorical 6
Numeric 5
Number of training examples: 1000
Targets
False 85.90%
True 14.10%
Name: fraud, dtype: object
To provide data to EvalML, it is recommended that you create a DataTable
object using the Woodwork project. This allows you to easily control how EvalML will treat each of your features before training a model.
EvalML also accepts pandas
input, and will run type inference on top of the input pandas
data. If you’d like to change the types inferred by EvalML, you can use the infer_feature_types
utility method, which takes pandas or numpy input and converts it to a Woodwork data structure. The feature_types
parameter can be used to specify what types specific columns should be.
In the example below, we reformat a couple features to make them easily consumable by the model, and then specify that the provider, which would have otherwise been inferred as a column with natural language, is a categorical column.
[2]:
X['expiration_date'] = X['expiration_date'].apply(lambda x: '20{}-01-{}'.format(x.split("/")[1], x.split("/")[0]))
X[['lat', 'lng']] = X[['lat', 'lng']].astype('str')
X = infer_feature_types(X, feature_types= {'store_id': 'categorical',
'expiration_date': 'datetime',
'lat': 'categorical',
'lng': 'categorical',
'provider': 'categorical'})
In order to validate the results of the pipeline creation and optimization process, we will save some of our data as a holdout set.
[3]:
X_train, X_holdout, y_train, y_holdout = evalml.preprocessing.split_data(X, y, problem_type='binary', test_size=.2)
Data Checks¶
Before calling AutoMLSearch.search
, we should run some sanity checks on our data to ensure that the input data being passed will not run into some common issues before running a potentially time-consuming search. EvalML has various data checks that makes this easy. Each data check will return a collection of warnings and errors if it detects potential issues with the input data. This allows users to inspect their data to avoid confusing errors that may arise during the search process. You
can learn about each of the data checks available through our data checks guide
Here, we will run the DefaultDataChecks
class, which contains a series of data checks that are generally useful.
[4]:
from evalml.data_checks import DefaultDataChecks
data_checks = DefaultDataChecks("binary", "log loss binary")
data_checks.validate(X_train, y_train)
[4]:
{'warnings': [], 'errors': [], 'actions': []}
Since there were no warnings or errors returned, we can safely continue with the search process.
[5]:
automl = evalml.automl.AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary')
automl.search()
Using default limit of max_batches=1.
Generating pipelines to search over...
*****************************
* Beginning pipeline search *
*****************************
Optimizing for Log Loss Binary.
Lower score is better.
Using SequentialEngine to train and score pipelines.
Searching up to 1 batches for a total of 9 pipelines.
Allowed model families: xgboost, decision_tree, extra_trees, catboost, linear_model, random_forest, lightgbm
Evaluating Baseline Pipeline: Mode Baseline Binary Classification Pipeline
Mode Baseline Binary Classification Pipeline:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 4.879
*****************************
* Evaluating Batch Number 1 *
*****************************
Elastic Net Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.422
Decision Tree Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 1.682
High coefficient of variation (cv >= 0.2) within cross validation scores.
Decision Tree Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler may not perform as estimated on unseen data.
Random Forest Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.287
LightGBM Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.311
Logistic Regression Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.416
XGBoost Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.257
Extra Trees Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.366
CatBoost Classifier w/ Imputer + DateTime Featurization Component + Undersampler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.554
Search finished after 00:33
Best pipeline: XGBoost Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler
Best pipeline Log Loss Binary: 0.257048
The AutoML search will log its progress, reporting each pipeline and parameter set evaluated during the search.
There are a number of mechanisms to control the AutoML search time. One way is to set the max_batches
parameter which controls the maximum number of rounds of AutoML to evaluate, where each round may train and score a variable number of pipelines. Another way is to set the max_iterations
parameter which controls the maximum number of candidate models to be evaluated during AutoML. By default, AutoML will search for a single batch. The first pipeline to be evaluated will always be a
baseline model representing a trivial solution.
The AutoML interface supports a variety of other parameters. For a comprehensive list, please refer to the API reference.
We also provide a standalone ``search` method <../generated/evalml.automl.search.html>`__ which does all of the above in a single line, and returns the AutoMLSearch
instance and data check results. If there were data check errors, AutoML will not be run and no AutoMLSearch
instance will be returned.
Detecting Problem Type¶
EvalML includes a simple method, detect_problem_type
, to help determine the problem type given the target data.
This function can return the predicted problem type as a ProblemType enum, choosing from ProblemType.BINARY, ProblemType.MULTICLASS, and ProblemType.REGRESSION. If the target data is invalid (for instance when there is only 1 unique label), the function will throw an error instead.
[6]:
import pandas as pd
from evalml.problem_types import detect_problem_type
y_binary = pd.Series([0, 1, 1, 0, 1, 1])
detect_problem_type(y_binary)
[6]:
<ProblemTypes.BINARY: 'binary'>
Objective parameter¶
AutoMLSearch takes in an objective
parameter to determine which objective
to optimize for. By default, this parameter is set to auto
, which allows AutoML to choose LogLossBinary
for binary classification problems, LogLossMulticlass
for multiclass classification problems, and R2
for regression problems.
It should be noted that the objective
parameter is only used in ranking and helping choose the pipelines to iterate over, but is not used to optimize each individual pipeline during fit-time.
To get the default objective for each problem type, you can use the get_default_primary_search_objective
function.
[7]:
from evalml.automl import get_default_primary_search_objective
binary_objective = get_default_primary_search_objective("binary")
multiclass_objective = get_default_primary_search_objective("multiclass")
regression_objective = get_default_primary_search_objective("regression")
print(binary_objective.name)
print(multiclass_objective.name)
print(regression_objective.name)
Log Loss Binary
Log Loss Multiclass
R2
Using custom pipelines¶
EvalML’s AutoML algorithm generates a set of pipelines to search with. To provide a custom set instead, set allowed_pipelines to a list of custom pipeline instances. Note: this will prevent AutoML from generating other pipelines to search over.
[8]:
from evalml.pipelines import MulticlassClassificationPipeline
automl_custom = evalml.automl.AutoMLSearch(X_train=X_train,
y_train=y_train,
problem_type='multiclass',
allowed_pipelines=[MulticlassClassificationPipeline(component_graph=['Simple Imputer', 'Random Forest Classifier'])])
Using default limit of max_batches=1.
Stopping the search early¶
To stop the search early, hit Ctrl-C
. This will bring up a prompt asking for confirmation. Responding with y
will immediately stop the search. Responding with n
will continue the search.
Callback functions¶
AutoMLSearch
supports several callback functions, which can be specified as parameters when initializing an AutoMLSearch
object. They are:
start_iteration_callback
add_result_callback
error_callback
Start Iteration Callback¶
Users can set start_iteration_callback
to set what function is called before each pipeline training iteration. This callback function must take three positional parameters: the pipeline class, the pipeline parameters, and the AutoMLSearch
object.
[9]:
## start_iteration_callback example function
def start_iteration_callback_example(pipeline_class, pipeline_params, automl_obj):
print ("Training pipeline with the following parameters:", pipeline_params)
Add Result Callback¶
Users can set add_result_callback
to set what function is called after each pipeline training iteration. This callback function must take three positional parameters: a dictionary containing the training results for the new pipeline, an untrained_pipeline containing the parameters used during training, and the AutoMLSearch
object.
[10]:
## add_result_callback example function
def add_result_callback_example(pipeline_results_dict, untrained_pipeline, automl_obj):
print ("Results for trained pipeline with the following parameters:", pipeline_results_dict)
Error Callback¶
Users can set the error_callback
to set what function called when search()
errors and raises an Exception
. This callback function takes three positional parameters: the Exception raised
, the traceback, and the AutoMLSearch object
. This callback function must also accept kwargs
, so AutoMLSearch
is able to pass along other parameters used by default.
Evalml defines several error callback functions, which can be found under evalml.automl.callbacks
. They are:
silent_error_callback
raise_error_callback
log_and_save_error_callback
raise_and_save_error_callback
log_error_callback
(default used whenerror_callback
is None)
[11]:
# error_callback example; this is implemented in the evalml library
def raise_error_callback(exception, traceback, automl, **kwargs):
"""Raises the exception thrown by the AutoMLSearch object. Also logs the exception as an error."""
logger.error(f'AutoMLSearch raised a fatal exception: {str(exception)}')
logger.error("\n".join(traceback))
raise exception
View Rankings¶
A summary of all the pipelines built can be returned as a pandas DataFrame which is sorted by score. The score column contains the average score across all cross-validation folds while the validation_score column is computed from the first cross-validation fold.
[12]:
automl.rankings
[12]:
id | pipeline_name | mean_cv_score | standard_deviation_cv_score | validation_score | percent_better_than_baseline | high_variance_cv | parameters | |
---|---|---|---|---|---|---|---|---|
0 | 6 | XGBoost Classifier w/ Imputer + DateTime Featu... | 0.257048 | 0.037160 | 0.238569 | 94.731004 | False | {'Imputer': {'categorical_impute_strategy': 'm... |
1 | 3 | Random Forest Classifier w/ Imputer + DateTime... | 0.287116 | 0.007627 | 0.290727 | 94.114670 | False | {'Imputer': {'categorical_impute_strategy': 'm... |
2 | 4 | LightGBM Classifier w/ Imputer + DateTime Feat... | 0.311382 | 0.054463 | 0.284126 | 93.617280 | False | {'Imputer': {'categorical_impute_strategy': 'm... |
3 | 7 | Extra Trees Classifier w/ Imputer + DateTime F... | 0.365657 | 0.006928 | 0.364276 | 92.504731 | False | {'Imputer': {'categorical_impute_strategy': 'm... |
4 | 5 | Logistic Regression Classifier w/ Imputer + Da... | 0.416033 | 0.023057 | 0.442581 | 91.472125 | False | {'Imputer': {'categorical_impute_strategy': 'm... |
5 | 1 | Elastic Net Classifier w/ Imputer + DateTime F... | 0.421828 | 0.006208 | 0.416619 | 91.353340 | False | {'Imputer': {'categorical_impute_strategy': 'm... |
6 | 8 | CatBoost Classifier w/ Imputer + DateTime Feat... | 0.554321 | 0.007156 | 0.546288 | 88.637500 | False | {'Imputer': {'categorical_impute_strategy': 'm... |
7 | 2 | Decision Tree Classifier w/ Imputer + DateTime... | 1.682102 | 0.528201 | 2.071687 | 65.520174 | True | {'Imputer': {'categorical_impute_strategy': 'm... |
8 | 0 | Mode Baseline Binary Classification Pipeline | 4.878509 | 0.064297 | 4.915631 | 0.000000 | False | {'Baseline Classifier': {'strategy': 'mode'}} |
Describe Pipeline¶
Each pipeline is given an id
. We can get more information about any particular pipeline using that id
. Here, we will get more information about the pipeline with id = 1
.
[13]:
automl.describe_pipeline(1)
***************************************************************************************************************************
* Elastic Net Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler *
***************************************************************************************************************************
Problem Type: binary
Model Family: Linear
Pipeline Steps
==============
1. Imputer
* categorical_impute_strategy : most_frequent
* numeric_impute_strategy : mean
* categorical_fill_value : None
* numeric_fill_value : None
2. DateTime Featurization Component
* features_to_extract : ['year', 'month', 'day_of_week', 'hour']
* encode_as_categories : False
* date_index : None
3. One Hot Encoder
* top_n : 10
* features_to_encode : None
* categories : None
* drop : if_binary
* handle_unknown : ignore
* handle_missing : error
4. Undersampler
* sampling_ratio : 0.25
* min_samples : 100
* min_percentage : 0.1
5. Standard Scaler
6. Elastic Net Classifier
* alpha : 0.5
* l1_ratio : 0.5
* n_jobs : -1
* max_iter : 1000
* penalty : elasticnet
* loss : log
Training
========
Training for binary problems.
Total training time (including CV): 5.0 seconds
Cross Validation
----------------
Log Loss Binary MCC Binary AUC Precision F1 Balanced Accuracy Binary Accuracy Binary Sensitivity at Low Alert Rates # Training # Validation
0 0.417 0.000 0.500 0.000 0.000 0.500 0.858 0.000 533 267
1 0.420 0.000 0.500 0.000 0.000 0.500 0.858 0.000 533 267
2 0.429 0.000 0.500 0.000 0.000 0.500 0.861 0.000 534 266
mean 0.422 0.000 0.500 0.000 0.000 0.500 0.859 0.000 - -
std 0.006 0.000 0.000 0.000 0.000 0.000 0.002 0.000 - -
coef of var 0.015 inf 0.000 inf inf 0.000 0.002 inf - -
Get Pipeline¶
We can get the object of any pipeline via their id
as well:
[14]:
pipeline = automl.get_pipeline(1)
print(pipeline.name)
print(pipeline.parameters)
Elastic Net Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler
{'Imputer': {'categorical_impute_strategy': 'most_frequent', 'numeric_impute_strategy': 'mean', 'categorical_fill_value': None, 'numeric_fill_value': None}, 'DateTime Featurization Component': {'features_to_extract': ['year', 'month', 'day_of_week', 'hour'], 'encode_as_categories': False, 'date_index': None}, 'One Hot Encoder': {'top_n': 10, 'features_to_encode': None, 'categories': None, 'drop': 'if_binary', 'handle_unknown': 'ignore', 'handle_missing': 'error'}, 'Undersampler': {'sampling_ratio': 0.25, 'min_samples': 100, 'min_percentage': 0.1}, 'Elastic Net Classifier': {'alpha': 0.5, 'l1_ratio': 0.5, 'n_jobs': -1, 'max_iter': 1000, 'penalty': 'elasticnet', 'loss': 'log'}}
Get best pipeline¶
If you specifically want to get the best pipeline, there is a convenient accessor for that. The pipeline returned is already fitted on the input X, y data that we passed to AutoMLSearch. To turn off this default behavior, set train_best_pipeline=False
when initializing AutoMLSearch.
[15]:
best_pipeline = automl.best_pipeline
print(best_pipeline.name)
print(best_pipeline.parameters)
best_pipeline.predict(X_train)
XGBoost Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler
{'Imputer': {'categorical_impute_strategy': 'most_frequent', 'numeric_impute_strategy': 'mean', 'categorical_fill_value': None, 'numeric_fill_value': None}, 'DateTime Featurization Component': {'features_to_extract': ['year', 'month', 'day_of_week', 'hour'], 'encode_as_categories': False, 'date_index': None}, 'One Hot Encoder': {'top_n': 10, 'features_to_encode': None, 'categories': None, 'drop': 'if_binary', 'handle_unknown': 'ignore', 'handle_missing': 'error'}, 'Undersampler': {'sampling_ratio': 0.25, 'min_samples': 100, 'min_percentage': 0.1}, 'XGBoost Classifier': {'eta': 0.1, 'max_depth': 6, 'min_child_weight': 1, 'n_estimators': 100}}
[15]:
<DataColumn: fraud (Physical Type = boolean) (Logical Type = Boolean) (Semantic Tags = set())>
Training and Scoring Multiple Pipelines using AutoMLSearch¶
AutoMLSearch will automatically fit the best pipeline on the entire training data. It also provides an easy API for training and scoring other pipelines.
If you’d like to train one or more pipelines on the entire training data, you can use the train_pipelines
method
Similarly, if you’d like to score one or more pipelines on a particular dataset, you can use the train_pipelines
method
[16]:
trained_pipelines = automl.train_pipelines([automl.get_pipeline(i) for i in [0, 1, 2]])
trained_pipelines
[16]:
{'Mode Baseline Binary Classification Pipeline': pipeline = BinaryClassificationPipeline(component_graph=['Baseline Classifier'], parameters={'Baseline Classifier':{'strategy': 'mode'}}, custom_name='Mode Baseline Binary Classification Pipeline', random_seed=0),
'Elastic Net Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler': pipeline = BinaryClassificationPipeline(component_graph=[Imputer, DateTimeFeaturizer, OneHotEncoder, Undersampler, StandardScaler, ElasticNetClassifier], parameters={'Imputer':{'categorical_impute_strategy': 'most_frequent', 'numeric_impute_strategy': 'mean', 'categorical_fill_value': None, 'numeric_fill_value': None}, 'DateTime Featurization Component':{'features_to_extract': ['year', 'month', 'day_of_week', 'hour'], 'encode_as_categories': False, 'date_index': None}, 'One Hot Encoder':{'top_n': 10, 'features_to_encode': None, 'categories': None, 'drop': 'if_binary', 'handle_unknown': 'ignore', 'handle_missing': 'error'}, 'Undersampler':{'sampling_ratio': 0.25, 'min_samples': 100, 'min_percentage': 0.1}, 'Elastic Net Classifier':{'alpha': 0.5, 'l1_ratio': 0.5, 'n_jobs': -1, 'max_iter': 1000, 'penalty': 'elasticnet', 'loss': 'log'}}, random_seed=0),
'Decision Tree Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler': pipeline = BinaryClassificationPipeline(component_graph=[Imputer, DateTimeFeaturizer, OneHotEncoder, Undersampler, DecisionTreeClassifier], parameters={'Imputer':{'categorical_impute_strategy': 'most_frequent', 'numeric_impute_strategy': 'mean', 'categorical_fill_value': None, 'numeric_fill_value': None}, 'DateTime Featurization Component':{'features_to_extract': ['year', 'month', 'day_of_week', 'hour'], 'encode_as_categories': False, 'date_index': None}, 'One Hot Encoder':{'top_n': 10, 'features_to_encode': None, 'categories': None, 'drop': 'if_binary', 'handle_unknown': 'ignore', 'handle_missing': 'error'}, 'Undersampler':{'sampling_ratio': 0.25, 'min_samples': 100, 'min_percentage': 0.1}, 'Decision Tree Classifier':{'criterion': 'gini', 'max_features': 'auto', 'max_depth': 6, 'min_samples_split': 2, 'min_weight_fraction_leaf': 0.0}}, random_seed=0)}
[17]:
pipeline_holdout_scores = automl.score_pipelines([trained_pipelines[name] for name in trained_pipelines.keys()],
X_holdout,
y_holdout,
['Accuracy Binary', 'F1', 'AUC'])
pipeline_holdout_scores
[17]:
{'Mode Baseline Binary Classification Pipeline': OrderedDict([('Accuracy Binary',
0.86),
('F1', 0.0),
('AUC', 0.5)]),
'Elastic Net Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler': OrderedDict([('Accuracy Binary',
0.86),
('F1', 0.0),
('AUC', 0.5)]),
'Decision Tree Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler': OrderedDict([('Accuracy Binary',
0.945),
('F1', 0.7755102040816326),
('AUC', 0.8661752491694352)])}
Saving AutoMLSearch and pipelines from AutoMLSearch¶
There are two ways to save results from AutoMLSearch.
You can save the AutoMLSearch object itself, calling
.save(<filepath>)
to do so. This will allow you to save the AutoMLSearch state and reload all pipelines from this.If you want to save a pipeline from AutoMLSearch for future use, pipeline classes themselves have a
.save(<filepath>)
method.
[18]:
# saving the entire automl search
automl.save("automl.cloudpickle")
automl2 = evalml.automl.AutoMLSearch.load("automl.cloudpickle")
# saving the best pipeline using .save()
best_pipeline.save("pipeline.cloudpickle")
best_pipeline_copy = evalml.pipelines.PipelineBase.load("pipeline.cloudpickle")
Limiting the AutoML Search Space¶
The AutoML search algorithm first trains each component in the pipeline with their default values. After the first iteration, it then tweaks the parameters of these components using the pre-defined hyperparameter ranges that these components have. To limit the search over certain hyperparameter ranges, you can specify a pipeline_parameters
argument with your pipeline parameters. These parameters will also limit the hyperparameter search space. Hyperparameter ranges can be found through the
API reference for each component. Parameter arguments must be specified as dictionaries, but the associated values can be single values or skopt.space
Real, Integer, Categorical values.
[19]:
from evalml import AutoMLSearch
from evalml.demos import load_fraud
from skopt.space import Categorical
from evalml.model_family import ModelFamily
import woodwork as ww
X, y = load_fraud(n_rows=1000)
# example of setting parameter to just one value
pipeline_hyperparameters = {'Imputer': {
'numeric_impute_strategy': 'mean'
}}
# limit the numeric impute strategy to include only `median` and `most_frequent`
# `mean` is the default value for this argument, but it doesn't need to be included in the specified hyperparameter range for this to work
pipeline_hyperparameters = {'Imputer': {
'numeric_impute_strategy': Categorical(['median', 'most_frequent'])
}}
# using this pipeline parameter means that our Imputer components in the pipelines will only search through 'median' and 'most_frequent' stretegies for 'numeric_impute_strategy'
automl_constrained = AutoMLSearch(X_train=X, y_train=y, problem_type='binary', pipeline_parameters=pipeline_hyperparameters)
Number of Features
Boolean 1
Categorical 6
Numeric 5
Number of training examples: 1000
Targets
False 85.90%
True 14.10%
Name: fraud, dtype: object
Using default limit of max_batches=1.
Generating pipelines to search over...
Adding ensemble methods to AutoML¶
Stacking¶
Stacking is an ensemble machine learning algorithm that involves training a model to best combine the predictions of several base learning algorithms. First, each base learning algorithms is trained using the given data. Then, the combining algorithm or meta-learner is trained on the predictions made by those base learning algorithms to make a final prediction.
AutoML enables stacking using the ensembling
flag during initalization; this is set to False
by default. The stacking ensemble pipeline runs in its own batch after a whole cycle of training has occurred (each allowed pipeline trains for one batch). Note that this means a large number of iterations may need to run before the stacking ensemble runs. It is also important to note that only the first CV fold is calculated for stacking ensembles because the model internally uses CV
folds.
[20]:
X, y = evalml.demos.load_breast_cancer()
automl_with_ensembling = AutoMLSearch(X_train=X, y_train=y,
problem_type="binary",
allowed_model_families=[ModelFamily.RANDOM_FOREST, ModelFamily.LINEAR_MODEL],
max_batches=5,
ensembling=True)
automl_with_ensembling.search()
Generating pipelines to search over...
Ensembling will run every 4 batches.
*****************************
* Beginning pipeline search *
*****************************
Optimizing for Log Loss Binary.
Lower score is better.
Using SequentialEngine to train and score pipelines.
Searching up to 5 batches for a total of 20 pipelines.
Allowed model families: random_forest, linear_model
Evaluating Baseline Pipeline: Mode Baseline Binary Classification Pipeline
Mode Baseline Binary Classification Pipeline:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 12.904
*****************************
* Evaluating Batch Number 1 *
*****************************
Elastic Net Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.508
Random Forest Classifier w/ Imputer:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.116
High coefficient of variation (cv >= 0.2) within cross validation scores.
Random Forest Classifier w/ Imputer may not perform as estimated on unseen data.
Logistic Regression Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.074
High coefficient of variation (cv >= 0.2) within cross validation scores.
Logistic Regression Classifier w/ Imputer + Standard Scaler may not perform as estimated on unseen data.
*****************************
* Evaluating Batch Number 2 *
*****************************
Logistic Regression Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.106
High coefficient of variation (cv >= 0.2) within cross validation scores.
Logistic Regression Classifier w/ Imputer + Standard Scaler may not perform as estimated on unseen data.
Logistic Regression Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.091
High coefficient of variation (cv >= 0.2) within cross validation scores.
Logistic Regression Classifier w/ Imputer + Standard Scaler may not perform as estimated on unseen data.
Logistic Regression Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.107
High coefficient of variation (cv >= 0.2) within cross validation scores.
Logistic Regression Classifier w/ Imputer + Standard Scaler may not perform as estimated on unseen data.
Logistic Regression Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.098
High coefficient of variation (cv >= 0.2) within cross validation scores.
Logistic Regression Classifier w/ Imputer + Standard Scaler may not perform as estimated on unseen data.
Logistic Regression Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.075
High coefficient of variation (cv >= 0.2) within cross validation scores.
Logistic Regression Classifier w/ Imputer + Standard Scaler may not perform as estimated on unseen data.
*****************************
* Evaluating Batch Number 3 *
*****************************
Random Forest Classifier w/ Imputer:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.121
High coefficient of variation (cv >= 0.2) within cross validation scores.
Random Forest Classifier w/ Imputer may not perform as estimated on unseen data.
Random Forest Classifier w/ Imputer:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.165
Random Forest Classifier w/ Imputer:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.117
High coefficient of variation (cv >= 0.2) within cross validation scores.
Random Forest Classifier w/ Imputer may not perform as estimated on unseen data.
Random Forest Classifier w/ Imputer:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.165
Random Forest Classifier w/ Imputer:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.117
High coefficient of variation (cv >= 0.2) within cross validation scores.
Random Forest Classifier w/ Imputer may not perform as estimated on unseen data.
*****************************
* Evaluating Batch Number 4 *
*****************************
Elastic Net Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.663
Elastic Net Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.662
Elastic Net Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.324
Elastic Net Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.458
Elastic Net Classifier w/ Imputer + Standard Scaler:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.217
*****************************
* Evaluating Batch Number 5 *
*****************************
Stacked Ensemble Classification Pipeline:
Starting cross validation
Finished cross validation - mean Log Loss Binary: 0.111
Search finished after 00:43
Best pipeline: Logistic Regression Classifier w/ Imputer + Standard Scaler
Best pipeline Log Loss Binary: 0.073615
We can view more information about the stacking ensemble pipeline (which was the best performing pipeline) by calling .describe()
.
[21]:
automl_with_ensembling.best_pipeline.describe()
***************************************************************
* Logistic Regression Classifier w/ Imputer + Standard Scaler *
***************************************************************
Problem Type: binary
Model Family: Linear
Number of features: 30
Pipeline Steps
==============
1. Imputer
* categorical_impute_strategy : most_frequent
* numeric_impute_strategy : mean
* categorical_fill_value : None
* numeric_fill_value : None
2. Standard Scaler
3. Logistic Regression Classifier
* penalty : l2
* C : 1.0
* n_jobs : -1
* multi_class : auto
* solver : lbfgs
Access raw results¶
The AutoMLSearch
class records detailed results information under the results
field, including information about the cross-validation scoring and parameters.
[22]:
automl.results
[22]:
{'pipeline_results': {0: {'id': 0,
'pipeline_name': 'Mode Baseline Binary Classification Pipeline',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'Baseline Classifier',
'parameters': {'Baseline Classifier': {'strategy': 'mode'}},
'mean_cv_score': 4.87850936144123,
'standard_deviation_cv_score': 0.06429673275097571,
'high_variance_cv': False,
'training_time': 0.1217200756072998,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
4.915631097403019),
('MCC Binary', 0.0),
('AUC', 0.5),
('Precision', 0.0),
('F1', 0.0),
('Balanced Accuracy Binary', 0.5),
('Accuracy Binary', 0.8576779026217228),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 4.915631097403019,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
4.915631097403019),
('MCC Binary', 0.0),
('AUC', 0.5),
('Precision', 0.0),
('F1', 0.0),
('Balanced Accuracy Binary', 0.5),
('Accuracy Binary', 0.8576779026217228),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 4.915631097403019,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
4.8042658895176515),
('MCC Binary', 0.0),
('AUC', 0.5),
('Precision', 0.0),
('F1', 0.0),
('Balanced Accuracy Binary', 0.5),
('Accuracy Binary', 0.8609022556390977),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 4.8042658895176515,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 0,
'MCC Binary': 0,
'AUC': 0,
'Precision': 0,
'F1': 0,
'Balanced Accuracy Binary': 0,
'Accuracy Binary': 0,
'Sensitivity at Low Alert Rates': 0},
'percent_better_than_baseline': 0,
'validation_score': 4.915631097403019},
1: {'id': 1,
'pipeline_name': 'Elastic Net Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'Elastic Net Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler',
'parameters': {'Imputer': {'categorical_impute_strategy': 'most_frequent',
'numeric_impute_strategy': 'mean',
'categorical_fill_value': None,
'numeric_fill_value': None},
'DateTime Featurization Component': {'features_to_extract': ['year',
'month',
'day_of_week',
'hour'],
'encode_as_categories': False,
'date_index': None},
'One Hot Encoder': {'top_n': 10,
'features_to_encode': None,
'categories': None,
'drop': 'if_binary',
'handle_unknown': 'ignore',
'handle_missing': 'error'},
'Undersampler': {'sampling_ratio': 0.25,
'min_samples': 100,
'min_percentage': 0.1},
'Elastic Net Classifier': {'alpha': 0.5,
'l1_ratio': 0.5,
'n_jobs': -1,
'max_iter': 1000,
'penalty': 'elasticnet',
'loss': 'log'}},
'mean_cv_score': 0.4218280943497952,
'standard_deviation_cv_score': 0.006207629702067246,
'high_variance_cv': False,
'training_time': 4.961756944656372,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.41661936246816145),
('MCC Binary', 0.0),
('AUC', 0.5),
('Precision', 0.0),
('F1', 0.0),
('Balanced Accuracy Binary', 0.5),
('Accuracy Binary', 0.8576779026217228),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.41661936246816145,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.42016789692997036),
('MCC Binary', 0.0),
('AUC', 0.5),
('Precision', 0.0),
('F1', 0.0),
('Balanced Accuracy Binary', 0.5),
('Accuracy Binary', 0.8576779026217228),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.42016789692997036,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.4286970236512536),
('MCC Binary', 0.0),
('AUC', 0.5),
('Precision', 0.0),
('F1', 0.0),
('Balanced Accuracy Binary', 0.5),
('Accuracy Binary', 0.8609022556390977),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 0.4286970236512536,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 91.35334047560018,
'MCC Binary': 0,
'AUC': 0,
'Precision': 0,
'F1': 0,
'Balanced Accuracy Binary': 0,
'Accuracy Binary': 0,
'Sensitivity at Low Alert Rates': 0},
'percent_better_than_baseline': 91.35334047560018,
'validation_score': 0.41661936246816145},
2: {'id': 2,
'pipeline_name': 'Decision Tree Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'Decision Tree Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'parameters': {'Imputer': {'categorical_impute_strategy': 'most_frequent',
'numeric_impute_strategy': 'mean',
'categorical_fill_value': None,
'numeric_fill_value': None},
'DateTime Featurization Component': {'features_to_extract': ['year',
'month',
'day_of_week',
'hour'],
'encode_as_categories': False,
'date_index': None},
'One Hot Encoder': {'top_n': 10,
'features_to_encode': None,
'categories': None,
'drop': 'if_binary',
'handle_unknown': 'ignore',
'handle_missing': 'error'},
'Undersampler': {'sampling_ratio': 0.25,
'min_samples': 100,
'min_percentage': 0.1},
'Decision Tree Classifier': {'criterion': 'gini',
'max_features': 'auto',
'max_depth': 6,
'min_samples_split': 2,
'min_weight_fraction_leaf': 0.0}},
'mean_cv_score': 1.6821015276287887,
'standard_deviation_cv_score': 0.5282007996298796,
'high_variance_cv': True,
'training_time': 3.4392073154449463,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
2.071687101424033),
('MCC Binary', 0.4447320349588407),
('AUC', 0.7234543783038383),
('Precision', 0.6153846153846154),
('F1', 0.5),
('Balanced Accuracy Binary', 0.6886922546541026),
('Accuracy Binary', 0.8801498127340824),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 2.071687101424033,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
1.8937117368416978),
('MCC Binary', 0.555084745402998),
('AUC', 0.7523557802803953),
('Precision', 0.6774193548387096),
('F1', 0.6086956521739131),
('Balanced Accuracy Binary', 0.7544817283383131),
('Accuracy Binary', 0.898876404494382),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 1.8937117368416978,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
1.0809057446206345),
('MCC Binary', 0.41276863605545144),
('AUC', 0.6469963413194855),
('Precision', 0.7692307692307693),
('F1', 0.4),
('Balanced Accuracy Binary', 0.6285849167945238),
('Accuracy Binary', 0.8872180451127819),
('Sensitivity at Low Alert Rates', 0.14285714285714285),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 1.0809057446206345,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 65.52017423756966,
'MCC Binary': inf,
'AUC': 20.7602166634573,
'Precision': 68.73449131513647,
'F1': 50.289855072463766,
'Balanced Accuracy Binary': 19.05862999289799,
'Accuracy Binary': 2.999540048623428,
'Sensitivity at Low Alert Rates': 10.317460317460318},
'percent_better_than_baseline': 65.52017423756966,
'validation_score': 2.071687101424033},
3: {'id': 3,
'pipeline_name': 'Random Forest Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'Random Forest Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'parameters': {'Imputer': {'categorical_impute_strategy': 'most_frequent',
'numeric_impute_strategy': 'mean',
'categorical_fill_value': None,
'numeric_fill_value': None},
'DateTime Featurization Component': {'features_to_extract': ['year',
'month',
'day_of_week',
'hour'],
'encode_as_categories': False,
'date_index': None},
'One Hot Encoder': {'top_n': 10,
'features_to_encode': None,
'categories': None,
'drop': 'if_binary',
'handle_unknown': 'ignore',
'handle_missing': 'error'},
'Undersampler': {'sampling_ratio': 0.25,
'min_samples': 100,
'min_percentage': 0.1},
'Random Forest Classifier': {'n_estimators': 100,
'max_depth': 6,
'n_jobs': -1}},
'mean_cv_score': 0.2871163580963231,
'standard_deviation_cv_score': 0.00762743158232367,
'high_variance_cv': False,
'training_time': 4.165416955947876,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.29072746376050984),
('MCC Binary', 0.7714866705983852),
('AUC', 0.7948747414387497),
('Precision', 1.0),
('F1', 0.7741935483870968),
('Balanced Accuracy Binary', 0.8157894736842105),
('Accuracy Binary', 0.947565543071161),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.29072746376050984,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.2783539633474842),
('MCC Binary', 0.7714866705983852),
('AUC', 0.8519880487244311),
('Precision', 1.0),
('F1', 0.7741935483870968),
('Balanced Accuracy Binary', 0.8157894736842105),
('Accuracy Binary', 0.947565543071161),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.2783539633474842,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.2922676471809752),
('MCC Binary', 0.7283556346331993),
('AUC', 0.7559306030921752),
('Precision', 1.0),
('F1', 0.7241379310344828),
('Balanced Accuracy Binary', 0.7837837837837838),
('Accuracy Binary', 0.9398496240601504),
('Sensitivity at Low Alert Rates', 0.14285714285714285),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 0.2922676471809752,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 94.11467034652769,
'MCC Binary': inf,
'AUC': 30.093113108511858,
'Precision': 100.0,
'F1': 75.7508342602892,
'Balanced Accuracy Binary': 30.51209103840682,
'Accuracy Binary': 8.624088310664302,
'Sensitivity at Low Alert Rates': 15.873015873015872},
'percent_better_than_baseline': 94.11467034652769,
'validation_score': 0.29072746376050984},
4: {'id': 4,
'pipeline_name': 'LightGBM Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'LightGBM Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'parameters': {'Imputer': {'categorical_impute_strategy': 'most_frequent',
'numeric_impute_strategy': 'mean',
'categorical_fill_value': None,
'numeric_fill_value': None},
'DateTime Featurization Component': {'features_to_extract': ['year',
'month',
'day_of_week',
'hour'],
'encode_as_categories': False,
'date_index': None},
'One Hot Encoder': {'top_n': 10,
'features_to_encode': None,
'categories': None,
'drop': 'if_binary',
'handle_unknown': 'ignore',
'handle_missing': 'error'},
'Undersampler': {'sampling_ratio': 0.25,
'min_samples': 100,
'min_percentage': 0.1},
'LightGBM Classifier': {'boosting_type': 'gbdt',
'learning_rate': 0.1,
'n_estimators': 100,
'max_depth': 0,
'num_leaves': 31,
'min_child_samples': 20,
'n_jobs': -1,
'bagging_freq': 0,
'bagging_fraction': 0.9}},
'mean_cv_score': 0.31138161080515986,
'standard_deviation_cv_score': 0.05446341943882893,
'high_variance_cv': False,
'training_time': 3.9878180027008057,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.2841256938003925),
('MCC Binary', 0.7558627454336151),
('AUC', 0.8225695242472995),
('Precision', 0.8709677419354839),
('F1', 0.782608695652174),
('Balanced Accuracy Binary', 0.8465295334405883),
('Accuracy Binary', 0.9438202247191011),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.2841256938003925,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.2759269828013116),
('MCC Binary', 0.7002916432603479),
('AUC', 0.8460124109400138),
('Precision', 0.8571428571428571),
('F1', 0.7272727272727273),
('Balanced Accuracy Binary', 0.807055849230062),
('Accuracy Binary', 0.9325842696629213),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.2759269828013116,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.37409215581377536),
('MCC Binary', 0.6697012435894811),
('AUC', 0.7680868641567332),
('Precision', 0.875),
('F1', 0.6885245901639344),
('Balanced Accuracy Binary', 0.7772335654431723),
('Accuracy Binary', 0.9285714285714286),
('Sensitivity at Low Alert Rates', 0.14285714285714285),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 0.37409215581377536,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 93.61727962917816,
'MCC Binary': inf,
'AUC': 31.22229331146822,
'Precision': 86.77035330261135,
'F1': 73.28020043629452,
'Balanced Accuracy Binary': 31.027298270460747,
'Accuracy Binary': 7.623928735696928,
'Sensitivity at Low Alert Rates': 15.873015873015872},
'percent_better_than_baseline': 93.61727962917816,
'validation_score': 0.2841256938003925},
5: {'id': 5,
'pipeline_name': 'Logistic Regression Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'Logistic Regression Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler + Standard Scaler',
'parameters': {'Imputer': {'categorical_impute_strategy': 'most_frequent',
'numeric_impute_strategy': 'mean',
'categorical_fill_value': None,
'numeric_fill_value': None},
'DateTime Featurization Component': {'features_to_extract': ['year',
'month',
'day_of_week',
'hour'],
'encode_as_categories': False,
'date_index': None},
'One Hot Encoder': {'top_n': 10,
'features_to_encode': None,
'categories': None,
'drop': 'if_binary',
'handle_unknown': 'ignore',
'handle_missing': 'error'},
'Undersampler': {'sampling_ratio': 0.25,
'min_samples': 100,
'min_percentage': 0.1},
'Logistic Regression Classifier': {'penalty': 'l2',
'C': 1.0,
'n_jobs': -1,
'multi_class': 'auto',
'solver': 'lbfgs'}},
'mean_cv_score': 0.4160331593945871,
'standard_deviation_cv_score': 0.02305698741605786,
'high_variance_cv': False,
'training_time': 6.21952486038208,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.4425809902120305),
('MCC Binary', 0.3067765296982964),
('AUC', 0.6354860951505401),
('Precision', 0.5),
('F1', 0.3666666666666667),
('Balanced Accuracy Binary', 0.6207193748563549),
('Accuracy Binary', 0.8576779026217228),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.4425809902120305,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.4045011331529915),
('MCC Binary', 0.24575248627985688),
('AUC', 0.7101815674557573),
('Precision', 0.375),
('F1', 0.34285714285714286),
('Balanced Accuracy Binary', 0.6142266145713629),
('Accuracy Binary', 0.8277153558052435),
('Sensitivity at Low Alert Rates', 0.08333333333333333),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.4045011331529915,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.40101735481873924),
('MCC Binary', 0.40605561581443284),
('AUC', 0.6998701758527087),
('Precision', 0.6190476190476191),
('F1', 0.4482758620689656),
('Balanced Accuracy Binary', 0.6582084267673788),
('Accuracy Binary', 0.8796992481203008),
('Sensitivity at Low Alert Rates', 0.2857142857142857),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 0.40101735481873924,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 91.47212542661431,
'MCC Binary': inf,
'AUC': 18.18459461530021,
'Precision': 49.801587301587304,
'F1': 38.59332238642584,
'Balanced Accuracy Binary': 13.10514720650322,
'Accuracy Binary': -0.37218514450920726,
'Sensitivity at Low Alert Rates': 12.3015873015873},
'percent_better_than_baseline': 91.47212542661431,
'validation_score': 0.4425809902120305},
6: {'id': 6,
'pipeline_name': 'XGBoost Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'XGBoost Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'parameters': {'Imputer': {'categorical_impute_strategy': 'most_frequent',
'numeric_impute_strategy': 'mean',
'categorical_fill_value': None,
'numeric_fill_value': None},
'DateTime Featurization Component': {'features_to_extract': ['year',
'month',
'day_of_week',
'hour'],
'encode_as_categories': False,
'date_index': None},
'One Hot Encoder': {'top_n': 10,
'features_to_encode': None,
'categories': None,
'drop': 'if_binary',
'handle_unknown': 'ignore',
'handle_missing': 'error'},
'Undersampler': {'sampling_ratio': 0.25,
'min_samples': 100,
'min_percentage': 0.1},
'XGBoost Classifier': {'eta': 0.1,
'max_depth': 6,
'min_child_weight': 1,
'n_estimators': 100}},
'mean_cv_score': 0.2570484812116729,
'standard_deviation_cv_score': 0.037160183094829415,
'high_variance_cv': False,
'training_time': 4.175675630569458,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.23856891318148268),
('MCC Binary', 0.737621190359052),
('AUC', 0.8311882325902091),
('Precision', 0.8666666666666667),
('F1', 0.7647058823529413),
('Balanced Accuracy Binary', 0.8333716387037462),
('Accuracy Binary', 0.9400749063670412),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.23856891318148268,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.23275084759057502),
('MCC Binary', 0.7522224738613313),
('AUC', 0.8418754309354171),
('Precision', 0.96),
('F1', 0.7619047619047619),
('Balanced Accuracy Binary', 0.8136060675706733),
('Accuracy Binary', 0.9438202247191011),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.23275084759057502,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.2998256828629609),
('MCC Binary', 0.688072697187691),
('AUC', 0.7802431252212911),
('Precision', 0.9130434782608695),
('F1', 0.6999999999999998),
('Balanced Accuracy Binary', 0.7794169715567095),
('Accuracy Binary', 0.9323308270676691),
('Sensitivity at Low Alert Rates', 0.14285714285714285),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 0.2998256828629609,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 94.731003629032,
'MCC Binary': inf,
'AUC': 31.776892958230572,
'Precision': 91.32367149758454,
'F1': 74.2203548085901,
'Balanced Accuracy Binary': 30.879822594370975,
'Accuracy Binary': 7.998929909042274,
'Sensitivity at Low Alert Rates': 15.873015873015872},
'percent_better_than_baseline': 94.731003629032,
'validation_score': 0.23856891318148268},
7: {'id': 7,
'pipeline_name': 'Extra Trees Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'Extra Trees Classifier w/ Imputer + DateTime Featurization Component + One Hot Encoder + Undersampler',
'parameters': {'Imputer': {'categorical_impute_strategy': 'most_frequent',
'numeric_impute_strategy': 'mean',
'categorical_fill_value': None,
'numeric_fill_value': None},
'DateTime Featurization Component': {'features_to_extract': ['year',
'month',
'day_of_week',
'hour'],
'encode_as_categories': False,
'date_index': None},
'One Hot Encoder': {'top_n': 10,
'features_to_encode': None,
'categories': None,
'drop': 'if_binary',
'handle_unknown': 'ignore',
'handle_missing': 'error'},
'Undersampler': {'sampling_ratio': 0.25,
'min_samples': 100,
'min_percentage': 0.1},
'Extra Trees Classifier': {'n_estimators': 100,
'max_features': 'auto',
'max_depth': 6,
'min_samples_split': 2,
'min_weight_fraction_leaf': 0.0,
'n_jobs': -1}},
'mean_cv_score': 0.36565741316856354,
'standard_deviation_cv_score': 0.0069277661015592264,
'high_variance_cv': False,
'training_time': 4.081199884414673,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.3642761539597304),
('MCC Binary', 0.0),
('AUC', 0.7808549758676167),
('Precision', 0.0),
('F1', 0.0),
('Balanced Accuracy Binary', 0.5),
('Accuracy Binary', 0.8576779026217228),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.3642761539597304,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.3595243315095676),
('MCC Binary', 0.08893769977744442),
('AUC', 0.8060216042289129),
('Precision', 0.5),
('F1', 0.05),
('Balanced Accuracy Binary', 0.510974488623305),
('Accuracy Binary', 0.8576779026217228),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.3595243315095676,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.3731717540363927),
('MCC Binary', 0.15282483732234337),
('AUC', 0.7156851174318423),
('Precision', 1.0),
('F1', 0.052631578947368425),
('Balanced Accuracy Binary', 0.5135135135135135),
('Accuracy Binary', 0.8646616541353384),
('Sensitivity at Low Alert Rates', 0.0),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 0.3731717540363927,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 92.5047307265894,
'MCC Binary': inf,
'AUC': 26.75205658427906,
'Precision': 50.0,
'F1': 3.421052631578948,
'Balanced Accuracy Binary': 0.8162667378939559,
'Accuracy Binary': 0.12531328320801727,
'Sensitivity at Low Alert Rates': 0},
'percent_better_than_baseline': 92.5047307265894,
'validation_score': 0.3642761539597304},
8: {'id': 8,
'pipeline_name': 'CatBoost Classifier w/ Imputer + DateTime Featurization Component + Undersampler',
'pipeline_class': evalml.pipelines.binary_classification_pipeline.BinaryClassificationPipeline,
'pipeline_summary': 'CatBoost Classifier w/ Imputer + DateTime Featurization Component + Undersampler',
'parameters': {'Imputer': {'categorical_impute_strategy': 'most_frequent',
'numeric_impute_strategy': 'mean',
'categorical_fill_value': None,
'numeric_fill_value': None},
'DateTime Featurization Component': {'features_to_extract': ['year',
'month',
'day_of_week',
'hour'],
'encode_as_categories': False,
'date_index': None},
'Undersampler': {'sampling_ratio': 0.25,
'min_samples': 100,
'min_percentage': 0.1},
'CatBoost Classifier': {'n_estimators': 10,
'eta': 0.03,
'max_depth': 6,
'bootstrap_type': None,
'silent': True,
'allow_writing_files': False}},
'mean_cv_score': 0.5543206139812201,
'standard_deviation_cv_score': 0.007156039310181719,
'high_variance_cv': False,
'training_time': 1.2582554817199707,
'cv_data': [{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.5462884486679269),
('MCC Binary', 0.8063138051598471),
('AUC', 0.853252125948058),
('Precision', 1.0),
('F1', 0.8125000000000001),
('Balanced Accuracy Binary', 0.8421052631578947),
('Accuracy Binary', 0.9550561797752809),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.5462884486679269,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.5566567743498382),
('MCC Binary', 0.7714866705983852),
('AUC', 0.8011951275568835),
('Precision', 1.0),
('F1', 0.7741935483870968),
('Balanced Accuracy Binary', 0.8157894736842105),
('Accuracy Binary', 0.947565543071161),
('Sensitivity at Low Alert Rates', 0.16666666666666666),
('# Training', 533),
('# Validation', 267)]),
'mean_cv_score': 0.5566567743498382,
'binary_classification_threshold': None},
{'all_objective_scores': OrderedDict([('Log Loss Binary',
0.5600166189258949),
('MCC Binary', 0.7283556346331993),
('AUC', 0.7711554349108934),
('Precision', 1.0),
('F1', 0.7241379310344828),
('Balanced Accuracy Binary', 0.7837837837837838),
('Accuracy Binary', 0.9398496240601504),
('Sensitivity at Low Alert Rates', 0.14285714285714285),
('# Training', 534),
('# Validation', 266)]),
'mean_cv_score': 0.5600166189258949,
'binary_classification_threshold': None}],
'percent_better_than_baseline_all_objectives': {'Log Loss Binary': 88.63750025033342,
'MCC Binary': inf,
'AUC': 30.8534229471945,
'Precision': 100.0,
'F1': 77.02771598071932,
'Balanced Accuracy Binary': 31.389284020862974,
'Accuracy Binary': 8.87377620080162,
'Sensitivity at Low Alert Rates': 15.873015873015872},
'percent_better_than_baseline': 88.63750025033342,
'validation_score': 0.5462884486679269}},
'search_order': [0, 1, 2, 3, 4, 5, 6, 7, 8]}