AutoGluon Tabular - In Depth

Open In Colab Open In SageMaker Studio Lab

Tip: If you are new to AutoGluon, review Predicting Columns in a Table - Quick Start to learn the basics of the AutoGluon API. To learn how to add your own custom models to the set that AutoGluon trains, tunes, and ensembles, review Adding a custom model to AutoGluon.

This tutorial describes how you can exert greater control when using AutoGluon’s fit() or predict(). Recall that to maximize predictive performance, you should first try TabularPredictor() and fit() with all default arguments. Then, consider non-default arguments for TabularPredictor(eval_metric=...), and fit(presets=...). Later, you can experiment with other arguments to fit() covered in this in-depth tutorial like hyperparameters, num_stack_levels, num_bag_folds, num_bag_sets, etc.

Start by importing AutoGluon’s TabularPredictor and TabularDataset, and loading the data.

from autogluon.tabular import TabularDataset, TabularPredictor

train_data = TabularDataset('https://autogluon.s3.amazonaws.com/datasets/Inc/train.csv')
subsample_size = 1000  # subsample subset of data for faster demo, try setting this to much larger values
train_data = train_data.sample(n=subsample_size, random_state=0)
test_data = TabularDataset('https://autogluon.s3.amazonaws.com/datasets/Inc/test.csv')

label = 'class'  # Now lets predict the "class" column (binary classification)
metric = "balanced_accuracy"  # Specify the evaluation metric you want to optimize
X_test = test_data.drop(columns=[label])
y_test = test_data[label]

train_data.head()
age workclass fnlwgt education education-num marital-status occupation relationship race sex capital-gain capital-loss hours-per-week native-country class
6118 51 Private 39264 Some-college 10 Married-civ-spouse Exec-managerial Wife White Female 0 0 40 United-States >50K
23204 58 Private 51662 10th 6 Married-civ-spouse Other-service Wife White Female 0 0 8 United-States <=50K
29590 40 Private 326310 Some-college 10 Married-civ-spouse Craft-repair Husband White Male 0 0 44 United-States <=50K
18116 37 Private 222450 HS-grad 9 Never-married Sales Not-in-family White Male 0 2339 40 El-Salvador <=50K
33964 62 Private 109190 Bachelors 13 Married-civ-spouse Exec-managerial Husband White Male 15024 0 40 United-States >50K

Model ensembling with stacking/bagging

Two methods to boost predictive performance are bagging and stack-ensembling. You’ll often see performance improve if you specify num_bag_folds = 8, num_stack_levels = 1 in the call to fit(), but this will increase training times and memory/disk usage.

save_path = 'agModels-predictClass'  # folder where to store trained models

predictor = TabularPredictor(label=label, eval_metric=metric, path=save_path).fit(train_data,
    calibrate_decision_threshold=False,  # Disabling for demonstration in next section
    num_bag_folds=8, num_bag_sets=1, num_stack_levels=1,  # or simply set `auto_stack=True` or a preset such as `presets="best"`
    time_limit=180,  # a brief 3-minute time limit for demonstration
)
predictor.leaderboard(test_data)
Verbosity: 2 (Standard Logging)
=================== System Info ===================
AutoGluon Version:  1.6.4.dev0
Python Version:     3.13.11
Operating System:   Linux
Platform Machine:   x86_64
Platform Version:   #1 SMP Thu Jun 25 14:43:50 UTC 2026
CPU Count:          8
Pytorch Version:    2.13.0+cu130
CUDA Version:       13.0
GPU Memory:         GPU 0: 14.57/15.00 GB
Total GPU Memory:   Free: 14.57 GB, Allocated: 0.43 GB, Total: 15.00 GB
GPU Count:          1
Memory Avail:       28.72 GB / 30.94 GB (92.8%)
Disk Space Avail:   211.70 GB / 255.99 GB (82.7%)
===================================================
No presets specified! To achieve strong results with AutoGluon, it is recommended to use the available presets. Defaulting to `'medium'`...
	Recommended Presets (For more details refer to https://auto.gluon.ai/stable/tutorials/tabular/tabular-essentials.html#presets):
	presets='extreme'  : Use this if you have a GPU. The go-to preset for best results, and the one to use for benchmark comparisons. New in v1.6: far better than 'best' on datasets <100000 samples by using Tabular Foundation Models (TFMs) meta-learned on https://tabarena.ai: Nori, TabICLv2, and TabDPT-Turbo. Every model is free for commercial use. Requires `pip install autogluon.tabular[tabarena]`.
	presets='noncommercial': New in v1.6: 'extreme' plus TabPFN-3, a frontier tabular foundation model created by Prior Labs. Stronger still, but commercial use requires a TabPFN-3 license: https://docs.priorlabs.ai/models#tabpfn-model-license
	presets='best'     : Use this if you do not have a GPU. Maximize accuracy. Use in competitions.
	presets='best_v150': New in v1.5: Better quality than 'best' and 5x+ faster to train. Give it a try!
	presets='high'     : Strong accuracy with fast inference speed.
	presets='high_v150': New in v1.5: Better quality than 'high' and 5x+ faster to train. Give it a try!
	presets='good'     : Good accuracy with very fast inference speed.
	presets='medium'   : Fast training time, ideal for initial prototyping.
Using hyperparameters preset: hyperparameters='default'
Beginning AutoGluon training ... Time limit = 180s
AutoGluon will save models to "/home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass"
Train Data Rows:    1000
Train Data Columns: 14
Label Column:       class
AutoGluon infers your prediction problem is: 'binary' (because only two unique label-values observed).
	2 unique label values:  [' >50K', ' <=50K']
	If 'binary' is not the correct problem_type, please manually specify the problem_type parameter during Predictor init (You may specify problem_type as one of: ['binary', 'multiclass', 'regression', 'quantile'])
Problem Type:       binary
Preprocessing data...
Selected class <--> label mapping:  class 1 =  >50K, class 0 =  <=50K
	Note: For your binary classification, AutoGluon arbitrarily selected which label-value represents positive ( >50K) vs negative ( <=50K) class.
	To explicitly set the positive_class, either rename classes to 1 and 0, or specify positive_class in Predictor init.
Using Feature Generators to preprocess the data ...
Fitting AutoMLPipelineFeatureGenerator...
	Available Memory:                    29410.79 MB
	Train Data (Original)  Memory Usage: 0.13 MB (0.0% of available memory)
	Inferring data type of each feature based on column values. Set feature_metadata_in to manually specify special dtypes of the features.
	Stage 1 Generators:
		Fitting AsTypeFeatureGenerator...
			Note: Converting 1 features to boolean dtype as they only contain 2 unique values.
	Stage 2 Generators:
		Fitting FillNaFeatureGenerator...
	Stage 3 Generators:
		Fitting IdentityFeatureGenerator...
		Fitting CategoryFeatureGenerator...
			Fitting CategoryMemoryMinimizeFeatureGenerator...
	Stage 4 Generators:
		Fitting DropUniqueFeatureGenerator...
	Stage 5 Generators:
		Fitting DropDuplicatesFeatureGenerator...
	Types of features in original data (raw dtype, special dtypes):
		('int', [])    : 6 | ['age', 'fnlwgt', 'education-num', 'capital-gain', 'capital-loss', ...]
		('object', []) : 8 | ['workclass', 'education', 'marital-status', 'occupation', 'relationship', ...]
	Types of features in processed data (raw dtype, special dtypes):
		('category', [])  : 7 | ['workclass', 'education', 'marital-status', 'occupation', 'relationship', ...]
		('int', [])       : 6 | ['age', 'fnlwgt', 'education-num', 'capital-gain', 'capital-loss', ...]
		('int', ['bool']) : 1 | ['sex']
	0.1s = Fit runtime
	14 features in original data used to generate 14 features in processed data.
	Train Data (Processed) Memory Usage: 0.06 MB (0.0% of available memory)
Data preprocessing and feature engineering runtime = 0.07s ...
AutoGluon will gauge predictive performance using evaluation metric: 'balanced_accuracy'
	To change this, specify the eval_metric parameter of Predictor()
User-specified model hyperparameters to be fit:
{
	'NN_TORCH': [{}],
	'GBM': [{'extra_trees': True, 'ag_args': {'name_suffix': 'XT'}}, {}, {'learning_rate': 0.03, 'num_leaves': 128, 'feature_fraction': 0.9, 'min_data_in_leaf': 3, 'ag_args': {'name_suffix': 'Large', 'priority': 0, 'hyperparameter_tune_kwargs': None}}],
	'CAT': [{}],
	'XGB': [{}],
	'FASTAI': [{}],
	'RF': [{'criterion': 'gini', 'ag_args': {'name_suffix': 'Gini', 'problem_types': ['binary', 'multiclass']}}, {'criterion': 'entropy', 'ag_args': {'name_suffix': 'Entr', 'problem_types': ['binary', 'multiclass']}}, {'criterion': 'squared_error', 'ag_args': {'name_suffix': 'MSE', 'problem_types': ['regression', 'quantile']}}],
	'XT': [{'criterion': 'gini', 'ag_args': {'name_suffix': 'Gini', 'problem_types': ['binary', 'multiclass']}}, {'criterion': 'entropy', 'ag_args': {'name_suffix': 'Entr', 'problem_types': ['binary', 'multiclass']}}, {'criterion': 'squared_error', 'ag_args': {'name_suffix': 'MSE', 'problem_types': ['regression', 'quantile']}}],
}
AutoGluon will fit 2 stack levels (L1 to L2) ...
Fitting 11 L1 models, fit_strategy="sequential" ...
Fitting model: LightGBMXT_BAG_L1 ... Training model for up to 119.93s of the 179.93s of remaining time.
/home/ci/opt/venv/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm
2026-11-28 15:58:43,927	INFO util.py:155 -- Missing packages: ['ipywidgets']. Run `pip install -U ipywidgets`, then restart the notebook server for rich notebook output.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.22%)
	0.7789	 = Validation score   (balanced_accuracy)
	1.52s	 = Training   runtime
	0.05s	 = Validation runtime
Fitting model: LightGBM_BAG_L1 ... Training model for up to 110.85s of the 170.85s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.24%)
	0.7797	 = Validation score   (balanced_accuracy)
	1.68s	 = Training   runtime
	0.04s	 = Validation runtime
Fitting model: RandomForestGini_BAG_L1 ... Training model for up to 109.08s of the 169.08s of remaining time.
	Fitting 1 model on all data (use_child_oof=True) | Fitting with cpus=8, gpus=0
	0.7482	 = Validation score   (balanced_accuracy)
	0.66s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: RandomForestEntr_BAG_L1 ... Training model for up to 108.28s of the 168.29s of remaining time.
	Fitting 1 model on all data (use_child_oof=True) | Fitting with cpus=8, gpus=0
	0.7567	 = Validation score   (balanced_accuracy)
	0.63s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: CatBoost_BAG_L1 ... Training model for up to 107.52s of the 167.53s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=1.46%)
	0.7786	 = Validation score   (balanced_accuracy)
	5.23s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: ExtraTreesGini_BAG_L1 ... Training model for up to 102.25s of the 162.25s of remaining time.
	Fitting 1 model on all data (use_child_oof=True) | Fitting with cpus=8, gpus=0
	0.7515	 = Validation score   (balanced_accuracy)
	0.62s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: ExtraTreesEntr_BAG_L1 ... Training model for up to 101.49s of the 161.50s of remaining time.
	Fitting 1 model on all data (use_child_oof=True) | Fitting with cpus=8, gpus=0
	0.7306	 = Validation score   (balanced_accuracy)
	0.62s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: NeuralNetFastAI_BAG_L1 ... Training model for up to 100.74s of the 160.74s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.00%)
	0.7166	 = Validation score   (balanced_accuracy)
	5.31s	 = Training   runtime
	0.1s	 = Validation runtime
Fitting model: XGBoost_BAG_L1 ... Training model for up to 95.38s of the 155.38s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.05%)
	0.7841	 = Validation score   (balanced_accuracy)
	1.43s	 = Training   runtime
	0.06s	 = Validation runtime
Fitting model: NeuralNetTorch_BAG_L1 ... Training model for up to 93.90s of the 153.91s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.00%)
	0.8136	 = Validation score   (balanced_accuracy)
	16.98s	 = Training   runtime
	0.13s	 = Validation runtime
Fitting model: LightGBMLarge_BAG_L1 ... Training model for up to 76.87s of the 136.88s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.52%)
	0.7468	 = Validation score   (balanced_accuracy)
	2.6s	 = Training   runtime
	0.05s	 = Validation runtime
Fitting model: WeightedEnsemble_L2 ... Training model for up to 179.93s of the 134.13s of remaining time.
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/22.4 GB
	Ensemble Weights: {'NeuralNetTorch_BAG_L1': 0.941, 'CatBoost_BAG_L1': 0.059}
	0.8142	 = Validation score   (balanced_accuracy)
	0.29s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting 11 L2 models, fit_strategy="sequential" ...
Fitting model: LightGBMXT_BAG_L2 ... Training model for up to 133.83s of the 133.83s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.29%)
	0.7914	 = Validation score   (balanced_accuracy)
	1.73s	 = Training   runtime
	0.05s	 = Validation runtime
Fitting model: LightGBM_BAG_L2 ... Training model for up to 132.05s of the 132.05s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.29%)
	0.82	 = Validation score   (balanced_accuracy)
	2.22s	 = Training   runtime
	0.05s	 = Validation runtime
Fitting model: RandomForestGini_BAG_L2 ... Training model for up to 129.76s of the 129.76s of remaining time.
	Fitting 1 model on all data (use_child_oof=True) | Fitting with cpus=8, gpus=0
	0.7928	 = Validation score   (balanced_accuracy)
	0.63s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: RandomForestEntr_BAG_L2 ... Training model for up to 129.00s of the 128.99s of remaining time.
	Fitting 1 model on all data (use_child_oof=True) | Fitting with cpus=8, gpus=0
	0.7864	 = Validation score   (balanced_accuracy)
	0.63s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: CatBoost_BAG_L2 ... Training model for up to 128.24s of the 128.23s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=1.77%)
	0.8134	 = Validation score   (balanced_accuracy)
	8.24s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: ExtraTreesGini_BAG_L2 ... Training model for up to 119.95s of the 119.95s of remaining time.
	Fitting 1 model on all data (use_child_oof=True) | Fitting with cpus=8, gpus=0
	0.768	 = Validation score   (balanced_accuracy)
	0.63s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: ExtraTreesEntr_BAG_L2 ... Training model for up to 119.18s of the 119.18s of remaining time.
	Fitting 1 model on all data (use_child_oof=True) | Fitting with cpus=8, gpus=0
	0.7764	 = Validation score   (balanced_accuracy)
	0.62s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: NeuralNetFastAI_BAG_L2 ... Training model for up to 118.43s of the 118.43s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.01%)
	0.7452	 = Validation score   (balanced_accuracy)
	1.73s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: XGBoost_BAG_L2 ... Training model for up to 116.65s of the 116.65s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.07%)
	0.8175	 = Validation score   (balanced_accuracy)
	2.12s	 = Training   runtime
	0.07s	 = Validation runtime
Fitting model: NeuralNetTorch_BAG_L2 ... Training model for up to 114.48s of the 114.48s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.00%)
	0.8071	 = Validation score   (balanced_accuracy)
	7.17s	 = Training   runtime
	0.18s	 = Validation runtime
Fitting model: LightGBMLarge_BAG_L2 ... Training model for up to 107.26s of the 107.25s of remaining time.
	Fitting 8 child models (S1F1 - S1F8) | Fitting with ParallelLocalFoldFittingStrategy (8 workers, per: cpus=1, gpus=0, memory=0.56%)
	0.8134	 = Validation score   (balanced_accuracy)
	3.67s	 = Training   runtime
	0.06s	 = Validation runtime
Fitting model: WeightedEnsemble_L3 ... Training model for up to 179.93s of the 103.40s of remaining time.
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/22.4 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.39s	 = Training   runtime
	0.0s	 = Validation runtime
AutoGluon training complete, total runtime = 77.01s ... Best model: WeightedEnsemble_L3 | Estimated inference throughput: 212.2 rows/s (125 batch size)
TabularPredictor saved. To load, use: predictor = TabularPredictor.load("/home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass")
model score_test score_val eval_metric pred_time_test pred_time_val fit_time pred_time_test_marginal pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order
0 NeuralNetTorch_BAG_L2 0.782108 0.807145 balanced_accuracy 5.481652 1.103390 41.854969 0.613793 0.176574 7.169783 2 True 22
1 WeightedEnsemble_L2 0.770005 0.814222 balanced_accuracy 0.551101 0.233257 22.499809 0.001787 0.001475 0.286859 2 True 12
2 NeuralNetTorch_BAG_L1 0.769406 0.813550 balanced_accuracy 0.385019 0.126418 16.979850 0.385019 0.126418 16.979850 1 True 10
3 CatBoost_BAG_L2 0.762368 0.813382 balanced_accuracy 5.014195 1.033091 42.922087 0.146336 0.106275 8.236901 2 True 17
4 XGBoost_BAG_L2 0.760461 0.817477 balanced_accuracy 5.164493 1.001012 36.805544 0.296634 0.074196 2.120358 2 True 21
5 ExtraTreesEntr_BAG_L2 0.758926 0.776399 balanced_accuracy 4.999730 1.037696 35.304613 0.131871 0.110880 0.619427 2 True 19
6 LightGBMXT_BAG_L1 0.758538 0.778898 balanced_accuracy 0.213234 0.049165 1.523896 0.213234 0.049165 1.523896 1 True 1
7 RandomForestEntr_BAG_L2 0.757599 0.786353 balanced_accuracy 4.985569 1.036078 35.317373 0.117710 0.109262 0.632187 2 True 16
8 LightGBM_BAG_L2 0.757110 0.819976 balanced_accuracy 5.158454 0.977384 36.901346 0.290595 0.050568 2.216160 2 True 14
9 WeightedEnsemble_L3 0.757110 0.819976 balanced_accuracy 5.159952 0.978837 37.290754 0.001498 0.001453 0.389407 3 True 24
10 RandomForestGini_BAG_L2 0.756827 0.792822 balanced_accuracy 4.986982 1.035088 35.317288 0.119123 0.108272 0.632102 2 True 15
11 XGBoost_BAG_L1 0.756678 0.784148 balanced_accuracy 0.255114 0.057585 1.433007 0.255114 0.057585 1.433007 1 True 9
12 LightGBMXT_BAG_L2 0.755724 0.791415 balanced_accuracy 5.138159 0.980628 36.413105 0.270299 0.053812 1.727919 2 True 13
13 ExtraTreesGini_BAG_L2 0.755652 0.767977 balanced_accuracy 5.001971 1.038326 35.318478 0.134112 0.111510 0.633292 2 True 18
14 CatBoost_BAG_L1 0.754272 0.778604 balanced_accuracy 0.164295 0.105365 5.233099 0.164295 0.105365 5.233099 1 True 5
15 LightGBMLarge_BAG_L2 0.754013 0.813445 balanced_accuracy 5.385544 0.985655 38.359648 0.517684 0.058839 3.674462 2 True 23
16 RandomForestGini_BAG_L1 0.745745 0.748194 balanced_accuracy 0.126129 0.109745 0.660056 0.126129 0.109745 0.660056 1 True 3
17 LightGBM_BAG_L1 0.745232 0.779696 balanced_accuracy 0.181757 0.043192 1.681311 0.181757 0.043192 1.681311 1 True 2
18 RandomForestEntr_BAG_L1 0.743132 0.756678 balanced_accuracy 0.118985 0.109414 0.627071 0.118985 0.109414 0.627071 1 True 4
19 LightGBMLarge_BAG_L1 0.735966 0.746787 balanced_accuracy 0.394704 0.051593 2.595358 0.394704 0.051593 2.595358 1 True 11
20 NeuralNetFastAI_BAG_L2 0.731819 0.745212 balanced_accuracy 5.892161 1.036627 36.413861 1.024302 0.109811 1.728674 2 True 20
21 ExtraTreesGini_BAG_L1 0.731460 0.751491 balanced_accuracy 0.126775 0.112366 0.619383 0.126775 0.112366 0.619383 1 True 6
22 ExtraTreesEntr_BAG_L1 0.725517 0.730553 balanced_accuracy 0.120979 0.112544 0.620193 0.120979 0.112544 0.620193 1 True 7
23 NeuralNetFastAI_BAG_L1 0.711150 0.716650 balanced_accuracy 3.175572 0.101023 5.307321 3.175572 0.101023 5.307321 1 True 8

You should not provide tuning_data when stacking/bagging, and instead provide all your available data as train_data (which AutoGluon will split in more intellgent ways). num_bag_sets controls how many times the k-fold bagging process is repeated to further reduce variance (increasing this may further boost accuracy but will substantially increase training times, inference latency, and memory/disk usage). Rather than manually searching for good bagging/stacking values yourself, AutoGluon will automatically select good values for you if you specify auto_stack instead (which is used in the best_quality preset):

Decision Threshold Calibration

Major metric score improvements can be achieved in binary classification for metrics such as "f1" and "balanced_accuracy" by adjusting the prediction decision threshold via calibrate_decision_threshold to a value other than the default 0.5.

Below is an example of the "balanced_accuracy" score achieved on the test data with and without calibrating the decision threshold:

print(f'Prior to calibration (predictor.decision_threshold={predictor.decision_threshold}):')
scores = predictor.evaluate(test_data)

calibrated_decision_threshold = predictor.calibrate_decision_threshold()
predictor.set_decision_threshold(calibrated_decision_threshold)

print(f'After calibration (predictor.decision_threshold={predictor.decision_threshold}):')
scores_calibrated = predictor.evaluate(test_data)
Prior to calibration (predictor.decision_threshold=0.5):
After calibration (predictor.decision_threshold=0.49):
Calibrating decision threshold to optimize metric balanced_accuracy | Checking 51 thresholds...
Calibrating decision threshold via fine-grained search | Checking 38 thresholds...
	Base Threshold: 0.500	| val: 0.8200
	Best Threshold: 0.490	| val: 0.8213
Updating predictor.decision_threshold from 0.5 -> 0.49
	This will impact how prediction probabilities are converted to predictions in binary classification.
	Prediction probabilities of the positive class >0.49 will be predicted as the positive class ( >50K). This can significantly impact metric scores.
	You can update this value via `predictor.set_decision_threshold`.
	You can calculate an optimal decision threshold on the validation data via `predictor.calibrate_decision_threshold()`.
for metric_name in scores:
    metric_score = scores[metric_name]
    metric_score_calibrated = scores_calibrated[metric_name]
    decision_threshold = predictor.decision_threshold
    print(f'decision_threshold={decision_threshold:.3f}\t| metric="{metric_name}"'
          f'\n\ttest_score uncalibrated: {metric_score:.4f}'
          f'\n\ttest_score   calibrated: {metric_score_calibrated:.4f}'
          f'\n\ttest_score        delta: {metric_score_calibrated-metric_score:.4f}')
decision_threshold=0.490	| metric="balanced_accuracy"
	test_score uncalibrated: 0.7571
	test_score   calibrated: 0.7571
	test_score        delta: 0.0000
decision_threshold=0.490	| metric="accuracy"
	test_score uncalibrated: 0.8489
	test_score   calibrated: 0.8478
	test_score        delta: -0.0011
decision_threshold=0.490	| metric="mcc"
	test_score uncalibrated: 0.5574
	test_score   calibrated: 0.5550
	test_score        delta: -0.0024
decision_threshold=0.490	| metric="roc_auc"
	test_score uncalibrated: 0.8893
	test_score   calibrated: 0.8893
	test_score        delta: 0.0000
decision_threshold=0.490	| metric="f1"
	test_score uncalibrated: 0.6466
	test_score   calibrated: 0.6457
	test_score        delta: -0.0009
decision_threshold=0.490	| metric="precision"
	test_score uncalibrated: 0.7266
	test_score   calibrated: 0.7211
	test_score        delta: -0.0055
decision_threshold=0.490	| metric="recall"
	test_score uncalibrated: 0.5824
	test_score   calibrated: 0.5846
	test_score        delta: 0.0022

Notice that calibrating for “balanced_accuracy” majorly improved the “balanced_accuracy” metric score, but it harmed the “accuracy” score. Threshold calibration will often result in a tradeoff between performance on different metrics, and the user should keep this in mind.

Instead of calibrating for “balanced_accuracy” specifically, we can calibrate for any metric if we want to maximize the score of that metric:

predictor.set_decision_threshold(0.5)  # Reset decision threshold
for metric_name in ['f1', 'balanced_accuracy', 'mcc']:
    metric_score = predictor.evaluate(test_data, silent=True)[metric_name]
    calibrated_decision_threshold = predictor.calibrate_decision_threshold(metric=metric_name, verbose=False)
    metric_score_calibrated = predictor.evaluate(
        test_data, decision_threshold=calibrated_decision_threshold, silent=True
    )[metric_name]
    print(f'decision_threshold={calibrated_decision_threshold:.3f}\t| metric="{metric_name}"'
          f'\n\ttest_score uncalibrated: {metric_score:.4f}'
          f'\n\ttest_score   calibrated: {metric_score_calibrated:.4f}'
          f'\n\ttest_score        delta: {metric_score_calibrated-metric_score:.4f}')
decision_threshold=0.490	| metric="f1"
	test_score uncalibrated: 0.6466
	test_score   calibrated: 0.6457
	test_score        delta: -0.0009
decision_threshold=0.490	| metric="balanced_accuracy"
	test_score uncalibrated: 0.7571
	test_score   calibrated: 0.7571
	test_score        delta: 0.0000
decision_threshold=0.490	| metric="mcc"
	test_score uncalibrated: 0.5574
	test_score   calibrated: 0.5550
	test_score        delta: -0.0024
Updating predictor.decision_threshold from 0.49 -> 0.5
	This will impact how prediction probabilities are converted to predictions in binary classification.
	Prediction probabilities of the positive class >0.5 will be predicted as the positive class ( >50K). This can significantly impact metric scores.
	You can update this value via `predictor.set_decision_threshold`.
	You can calculate an optimal decision threshold on the validation data via `predictor.calibrate_decision_threshold()`.

Instead of calibrating the decision threshold post-fit, you can have it automatically occur during the fit call by specifying the fit parameter predictor.fit(..., calibrate_decision_threshold=True).

Luckily, AutoGluon will automatically apply decision threshold calibration when beneficial, as the default value is calibrate_decision_threshold="auto". We recommend keeping this value as the default in most cases.

Additional usage examples are below:

# Will use the decision_threshold specified in `predictor.decision_threshold`, can be set via `predictor.set_decision_threshold`
y_pred = predictor.predict(test_data)
y_pred_08 = predictor.predict(test_data, decision_threshold=0.8)  # Specify a specific threshold to use only for this predict

y_pred_proba = predictor.predict_proba(test_data)
y_pred = predictor.predict_from_proba(y_pred_proba)  # Identical output to calling .predict(test_data)
y_pred_08 = predictor.predict_from_proba(y_pred_proba, decision_threshold=0.8)  # Identical output to calling .predict(test_data, decision_threshold=0.8)

Prediction options (inference)

Even if you’ve started a new Python session since last calling fit(), you can still load a previously trained predictor from disk:

predictor = TabularPredictor.load(save_path)  # `predictor.path` is another way to get the relative path needed to later load the predictor.

Above save_path is the same folder previously passed to TabularPredictor, in which all the trained models have been saved. You can train easily models on one machine and deploy them on another. Simply copy the save_path folder to the new machine and specify its new path in TabularPredictor.load().

To find out the required feature columns to make predictions, call predictor.features():

predictor.features()
['age',
 'workclass',
 'fnlwgt',
 'education',
 'education-num',
 'marital-status',
 'occupation',
 'relationship',
 'race',
 'sex',
 'capital-gain',
 'capital-loss',
 'hours-per-week',
 'native-country']

We can make a prediction on an individual example rather than a full dataset:

datapoint = X_test.iloc[[0]]  # Note: .iloc[0] won't work because it returns pandas Series instead of DataFrame
datapoint
age workclass fnlwgt education education-num marital-status occupation relationship race sex capital-gain capital-loss hours-per-week native-country
0 31 Private 169085 11th 7 Married-civ-spouse Sales Wife White Female 0 0 20 United-States
predictor.predict(datapoint)
0     <=50K
Name: class, dtype: object

To output predicted class probabilities instead of predicted classes, you can use:

predictor.predict_proba(datapoint)  # returns a DataFrame that shows which probability corresponds to which class
<=50K >50K
0 0.981826 0.018174

By default, predict() and predict_proba() will utilize the model that AutoGluon thinks is most accurate, which is usually an ensemble of many individual models. Here’s how to see which model this is:

predictor.model_best
'WeightedEnsemble_L3'

We can instead specify a particular model to use for predictions (e.g. to reduce inference latency). Note that a ‘model’ in AutoGluon may refer to, for example, a single Neural Network, a bagged ensemble of many Neural Network copies trained on different training/validation splits, a weighted ensemble that aggregates the predictions of many other models, or a stacker model that operates on predictions output by other models. This is akin to viewing a Random Forest as one ‘model’ when it is in fact an ensemble of many decision trees.

Before deciding which model to use, let’s evaluate all of the models AutoGluon has previously trained on our test data:

predictor.leaderboard(test_data)
model score_test score_val eval_metric pred_time_test pred_time_val fit_time pred_time_test_marginal pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order
0 NeuralNetTorch_BAG_L2 0.782108 0.807145 balanced_accuracy 3.432448 1.103390 41.854969 0.567980 0.176574 7.169783 2 True 22
1 WeightedEnsemble_L2 0.770005 0.814222 balanced_accuracy 0.524428 0.233257 22.499809 0.001790 0.001475 0.286859 2 True 12
2 NeuralNetTorch_BAG_L1 0.769406 0.813550 balanced_accuracy 0.374389 0.126418 16.979850 0.374389 0.126418 16.979850 1 True 10
3 CatBoost_BAG_L2 0.762368 0.813382 balanced_accuracy 3.012266 1.033091 42.922087 0.147798 0.106275 8.236901 2 True 17
4 XGBoost_BAG_L2 0.760461 0.817477 balanced_accuracy 3.154184 1.001012 36.805544 0.289716 0.074196 2.120358 2 True 21
5 ExtraTreesEntr_BAG_L2 0.758926 0.776399 balanced_accuracy 2.996101 1.037696 35.304613 0.131633 0.110880 0.619427 2 True 19
6 LightGBMXT_BAG_L1 0.758538 0.778898 balanced_accuracy 0.284914 0.049165 1.523896 0.284914 0.049165 1.523896 1 True 1
7 RandomForestEntr_BAG_L2 0.757599 0.786353 balanced_accuracy 2.983021 1.036078 35.317373 0.118553 0.109262 0.632187 2 True 16
8 LightGBM_BAG_L2 0.757110 0.819976 balanced_accuracy 3.154459 0.977384 36.901346 0.289991 0.050568 2.216160 2 True 14
9 WeightedEnsemble_L3 0.757110 0.819976 balanced_accuracy 3.155910 0.978837 37.290754 0.001451 0.001453 0.389407 3 True 24
10 RandomForestGini_BAG_L2 0.756827 0.792822 balanced_accuracy 2.983850 1.035088 35.317288 0.119381 0.108272 0.632102 2 True 15
11 XGBoost_BAG_L1 0.756678 0.784148 balanced_accuracy 0.239615 0.057585 1.433007 0.239615 0.057585 1.433007 1 True 9
12 LightGBMXT_BAG_L2 0.755724 0.791415 balanced_accuracy 3.136457 0.980628 36.413105 0.271989 0.053812 1.727919 2 True 13
13 ExtraTreesGini_BAG_L2 0.755652 0.767977 balanced_accuracy 3.176543 1.038326 35.318478 0.312075 0.111510 0.633292 2 True 18
14 CatBoost_BAG_L1 0.754272 0.778604 balanced_accuracy 0.148249 0.105365 5.233099 0.148249 0.105365 5.233099 1 True 5
15 LightGBMLarge_BAG_L2 0.754013 0.813445 balanced_accuracy 3.329868 0.985655 38.359648 0.465400 0.058839 3.674462 2 True 23
16 RandomForestGini_BAG_L1 0.745745 0.748194 balanced_accuracy 0.132509 0.109745 0.660056 0.132509 0.109745 0.660056 1 True 3
17 LightGBM_BAG_L1 0.745232 0.779696 balanced_accuracy 0.266173 0.043192 1.681311 0.266173 0.043192 1.681311 1 True 2
18 RandomForestEntr_BAG_L1 0.743132 0.756678 balanced_accuracy 0.129583 0.109414 0.627071 0.129583 0.109414 0.627071 1 True 4
19 LightGBMLarge_BAG_L1 0.735966 0.746787 balanced_accuracy 0.394412 0.051593 2.595358 0.394412 0.051593 2.595358 1 True 11
20 NeuralNetFastAI_BAG_L2 0.731819 0.745212 balanced_accuracy 3.879277 1.036627 36.413861 1.014809 0.109811 1.728674 2 True 20
21 ExtraTreesGini_BAG_L1 0.731460 0.751491 balanced_accuracy 0.132651 0.112366 0.619383 0.132651 0.112366 0.619383 1 True 6
22 ExtraTreesEntr_BAG_L1 0.725517 0.730553 balanced_accuracy 0.133456 0.112544 0.620193 0.133456 0.112544 0.620193 1 True 7
23 NeuralNetFastAI_BAG_L1 0.711150 0.716650 balanced_accuracy 1.022928 0.101023 5.307321 1.022928 0.101023 5.307321 1 True 8

The leaderboard shows each model’s predictive performance on the test data (score_test) and validation data (score_val), as well as the time required to: produce predictions for the test data (pred_time_val), produce predictions on the validation data (pred_time_val), and train only this model (fit_time). Below, we show that a leaderboard can be produced without new data (just uses the data previously reserved for validation inside fit) and can display extra information about each model:

predictor.leaderboard(extra_info=True)
model score_val eval_metric pred_time_val fit_time pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order ... hyperparameters hyperparameters_fit ag_args_fit features compile_time child_hyperparameters child_hyperparameters_fit child_ag_args_fit ancestors descendants
0 LightGBM_BAG_L2 0.819976 balanced_accuracy 0.977384 36.901346 0.050568 2.216160 2 True 14 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'learning_rate': 0.05, 'seed': 0} {'num_boost_round': 155} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] [WeightedEnsemble_L3]
1 WeightedEnsemble_L3 0.819976 balanced_accuracy 0.978837 37.290754 0.001453 0.389407 3 True 24 ... {'use_orig_features': False, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': False, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [LightGBM_BAG_L2] None {'ensemble_size': 25, 'subsample_size': 1000000} {'ensemble_size': 1} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, LightGBM_BAG_L2, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
2 XGBoost_BAG_L2 0.817477 balanced_accuracy 1.001012 36.805544 0.074196 2.120358 2 True 21 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'n_estimators': 10000, 'learning_rate': 0.1, 'n_jobs': -1, 'proc.max_category_levels': 100, 'objective': 'binary:logistic', 'booster': 'gbtree', 'seed': 0} {'n_estimators': 108} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
3 WeightedEnsemble_L2 0.814222 balanced_accuracy 0.233257 22.499809 0.001475 0.286859 2 True 12 ... {'use_orig_features': False, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': False, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1] None {'ensemble_size': 25, 'subsample_size': 1000000} {'ensemble_size': 17} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1] []
4 NeuralNetTorch_BAG_L1 0.813550 balanced_accuracy 0.126418 16.979850 0.126418 16.979850 1 True 10 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'num_epochs': 1000, 'epochs_wo_improve': None, 'activation': 'relu', 'embedding_size_factor': 1.0, 'embed_exponent': 0.56, 'max_embedding_dim': 100, 'y_range': None, 'y_range_extend': 0.05, 'dropout_prob': 0.1, 'optimizer': 'adam', 'learning_rate': 0.0003, 'weight_decay': 1e-06, 'proc.embed_min_categories': 4, 'proc.impute_strategy': 'median', 'proc.max_category_levels': 100, 'proc.skew_threshold': 0.99, 'use_ngram_features': False, 'num_layers': 4, 'hidden_size': 128, 'max_batch_size': 512, 'use_batchnorm': False, 'loss_function': 'auto', 'seed_value': 0} {'batch_size': 32, 'num_epochs': 27} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': ['text_ngram', 'text_as_category'], 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, WeightedEnsemble_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
5 LightGBMLarge_BAG_L2 0.813445 balanced_accuracy 0.985655 38.359648 0.058839 3.674462 2 True 23 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'learning_rate': 0.03, 'num_leaves': 128, 'feature_fraction': 0.9, 'min_data_in_leaf': 3, 'seed': 0} {'num_boost_round': 191} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
6 CatBoost_BAG_L2 0.813382 balanced_accuracy 1.033091 42.922087 0.106275 8.236901 2 True 17 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'iterations': 10000, 'learning_rate': 0.05, 'allow_writing_files': False, 'eval_metric': 'BalancedAccuracy', 'random_seed': 0} {'iterations': 160} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
7 NeuralNetTorch_BAG_L2 0.807145 balanced_accuracy 1.103390 41.854969 0.176574 7.169783 2 True 22 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'num_epochs': 1000, 'epochs_wo_improve': None, 'activation': 'relu', 'embedding_size_factor': 1.0, 'embed_exponent': 0.56, 'max_embedding_dim': 100, 'y_range': None, 'y_range_extend': 0.05, 'dropout_prob': 0.1, 'optimizer': 'adam', 'learning_rate': 0.0003, 'weight_decay': 1e-06, 'proc.embed_min_categories': 4, 'proc.impute_strategy': 'median', 'proc.max_category_levels': 100, 'proc.skew_threshold': 0.99, 'use_ngram_features': False, 'num_layers': 4, 'hidden_size': 128, 'max_batch_size': 512, 'use_batchnorm': False, 'loss_function': 'auto', 'seed_value': 0} {'batch_size': 32, 'num_epochs': 9} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': ['text_ngram', 'text_as_category'], 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
8 RandomForestGini_BAG_L2 0.792822 balanced_accuracy 1.035088 35.317288 0.108272 0.632102 2 True 15 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'use_child_oof': True, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'n_estimators': 300, 'max_leaf_nodes': 15000, 'n_jobs': -1, 'bootstrap': True, 'criterion': 'gini', 'random_state': 0} {'n_estimators': 300} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
9 LightGBMXT_BAG_L2 0.791415 balanced_accuracy 0.980628 36.413105 0.053812 1.727919 2 True 13 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'learning_rate': 0.05, 'extra_trees': True, 'seed': 0} {'num_boost_round': 166} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
10 RandomForestEntr_BAG_L2 0.786353 balanced_accuracy 1.036078 35.317373 0.109262 0.632187 2 True 16 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'use_child_oof': True, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'n_estimators': 300, 'max_leaf_nodes': 15000, 'n_jobs': -1, 'bootstrap': True, 'criterion': 'entropy', 'random_state': 0} {'n_estimators': 300} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
11 XGBoost_BAG_L1 0.784148 balanced_accuracy 0.057585 1.433007 0.057585 1.433007 1 True 9 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'n_estimators': 10000, 'learning_rate': 0.1, 'n_jobs': -1, 'proc.max_category_levels': 100, 'objective': 'binary:logistic', 'booster': 'gbtree', 'seed': 0} {'n_estimators': 68} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
12 LightGBM_BAG_L1 0.779696 balanced_accuracy 0.043192 1.681311 0.043192 1.681311 1 True 2 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'learning_rate': 0.05, 'seed': 0} {'num_boost_round': 123} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
13 LightGBMXT_BAG_L1 0.778898 balanced_accuracy 0.049165 1.523896 0.049165 1.523896 1 True 1 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'learning_rate': 0.05, 'extra_trees': True, 'seed': 0} {'num_boost_round': 178} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
14 CatBoost_BAG_L1 0.778604 balanced_accuracy 0.105365 5.233099 0.105365 5.233099 1 True 5 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'iterations': 10000, 'learning_rate': 0.05, 'allow_writing_files': False, 'eval_metric': 'BalancedAccuracy', 'random_seed': 0} {'iterations': 170} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, WeightedEnsemble_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
15 ExtraTreesEntr_BAG_L2 0.776399 balanced_accuracy 1.037696 35.304613 0.110880 0.619427 2 True 19 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'use_child_oof': True, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'n_estimators': 300, 'max_leaf_nodes': 15000, 'n_jobs': -1, 'bootstrap': True, 'criterion': 'entropy', 'random_state': 0} {'n_estimators': 300} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
16 ExtraTreesGini_BAG_L2 0.767977 balanced_accuracy 1.038326 35.318478 0.111510 0.633292 2 True 18 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'use_child_oof': True, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'n_estimators': 300, 'max_leaf_nodes': 15000, 'n_jobs': -1, 'bootstrap': True, 'criterion': 'gini', 'random_state': 0} {'n_estimators': 300} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
17 RandomForestEntr_BAG_L1 0.756678 balanced_accuracy 0.109414 0.627071 0.109414 0.627071 1 True 4 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'use_child_oof': True, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'n_estimators': 300, 'max_leaf_nodes': 15000, 'n_jobs': -1, 'bootstrap': True, 'criterion': 'entropy', 'random_state': 0} {'n_estimators': 300} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
18 ExtraTreesGini_BAG_L1 0.751491 balanced_accuracy 0.112366 0.619383 0.112366 0.619383 1 True 6 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'use_child_oof': True, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'n_estimators': 300, 'max_leaf_nodes': 15000, 'n_jobs': -1, 'bootstrap': True, 'criterion': 'gini', 'random_state': 0} {'n_estimators': 300} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
19 RandomForestGini_BAG_L1 0.748194 balanced_accuracy 0.109745 0.660056 0.109745 0.660056 1 True 3 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'use_child_oof': True, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'n_estimators': 300, 'max_leaf_nodes': 15000, 'n_jobs': -1, 'bootstrap': True, 'criterion': 'gini', 'random_state': 0} {'n_estimators': 300} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
20 LightGBMLarge_BAG_L1 0.746787 balanced_accuracy 0.051593 2.595358 0.051593 2.595358 1 True 11 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'learning_rate': 0.03, 'num_leaves': 128, 'feature_fraction': 0.9, 'min_data_in_leaf': 3, 'seed': 0} {'num_boost_round': 156} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] []
21 NeuralNetFastAI_BAG_L2 0.745212 balanced_accuracy 1.036627 36.413861 0.109811 1.728674 2 True 20 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, fnlwgt, workclass, race, age, XGBoost_BAG_L1, CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, capital-loss, ExtraTreesGini_BAG_L1, relationship, education, marital-status, NeuralNetFastAI_BAG_L1, native-country, sex, RandomForestGini_BAG_L1, capital-gain, ExtraTreesEntr_BAG_L1, LightGBMXT_BAG_L1, hours-per-week, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, education-num] None {'layers': None, 'emb_drop': 0.1, 'ps': 0.1, 'bs': 'auto', 'lr': 0.01, 'epochs': 'auto', 'early.stopping.min_delta': 0.0001, 'early.stopping.patience': 20, 'smoothing': 0.0, 'random_seed': 0} {'epochs': 30, 'best_epoch': 8} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': ['text_ngram', 'text_as_category'], 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [CatBoost_BAG_L1, NeuralNetTorch_BAG_L1, LightGBMXT_BAG_L1, ExtraTreesGini_BAG_L1, RandomForestGini_BAG_L1, NeuralNetFastAI_BAG_L1, RandomForestEntr_BAG_L1, LightGBM_BAG_L1, ExtraTreesEntr_BAG_L1, XGBoost_BAG_L1] []
22 ExtraTreesEntr_BAG_L1 0.730553 balanced_accuracy 0.112544 0.620193 0.112544 0.620193 1 True 7 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'use_child_oof': True, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'n_estimators': 300, 'max_leaf_nodes': 15000, 'n_jobs': -1, 'bootstrap': True, 'criterion': 'entropy', 'random_state': 0} {'n_estimators': 300} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]
23 NeuralNetFastAI_BAG_L1 0.716650 balanced_accuracy 0.101023 5.307321 0.101023 5.307321 1 True 8 ... {'use_orig_features': True, 'valid_stacker': True, 'max_base_models': 0, 'max_base_models_per_type': 'auto', 'save_bag_folds': True, 'stratify': 'auto', 'bin': 'auto', 'n_bins': None, 'vary_seed_across_folds': True, 'custom_splits': None, 'oof_per_fold': False, 'model_random_seed': 0} {} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': None, 'valid_special_types': None, 'ignored_type_group_special': None, 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None, 'drop_unique': False} [occupation, capital-loss, native-country, fnlwgt, relationship, education, sex, hours-per-week, marital-status, workclass, race, capital-gain, education-num, age] None {'layers': None, 'emb_drop': 0.1, 'ps': 0.1, 'bs': 'auto', 'lr': 0.01, 'epochs': 'auto', 'early.stopping.min_delta': 0.0001, 'early.stopping.patience': 20, 'smoothing': 0.0, 'random_seed': 0} {'epochs': 30, 'best_epoch': 11} {'max_memory_usage_ratio': 1.0, 'max_gpu_memory_usage_ratio': 1.0, 'max_estimated_time_ratio': 1.0, 'max_time_limit_ratio': 1.0, 'max_time_limit': None, 'min_time_limit': 0, 'valid_raw_types': ['bool', 'int', 'float', 'category'], 'valid_special_types': None, 'ignored_type_group_special': ['text_ngram', 'text_as_category'], 'ignored_type_group_raw': None, 'get_features_kwargs': None, 'get_features_kwargs_extra': None, 'predict_1_batch_size': None, 'temperature_scalar': None} [] [RandomForestEntr_BAG_L2, NeuralNetFastAI_BAG_L2, RandomForestGini_BAG_L2, LightGBM_BAG_L2, XGBoost_BAG_L2, WeightedEnsemble_L3, CatBoost_BAG_L2, LightGBMLarge_BAG_L2, LightGBMXT_BAG_L2, NeuralNetTorch_BAG_L2, ExtraTreesEntr_BAG_L2, ExtraTreesGini_BAG_L2]

24 rows × 32 columns

The expanded leaderboard shows properties like how many features are used by each model (num_features), which other models are ancestors whose predictions are required inputs for each model (ancestors), and how much memory each model and all its ancestors would occupy if simultaneously persisted (memory_size_w_ancestors). See the leaderboard documentation for full details.

To show scores for other metrics, you can specify the extra_metrics argument when passing in test_data:

predictor.leaderboard(test_data, extra_metrics=['accuracy', 'balanced_accuracy', 'log_loss'])
model score_test accuracy balanced_accuracy log_loss score_val eval_metric pred_time_test pred_time_val fit_time pred_time_test_marginal pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order
0 NeuralNetTorch_BAG_L2 0.782108 0.850548 0.782108 -0.326271 0.807145 balanced_accuracy 3.416195 1.103390 41.854969 0.570282 0.176574 7.169783 2 True 22
1 WeightedEnsemble_L2 0.770005 0.840925 0.770005 -0.342334 0.814222 balanced_accuracy 0.523507 0.233257 22.499809 0.001874 0.001475 0.286859 2 True 12
2 NeuralNetTorch_BAG_L1 0.769406 0.838878 0.769406 -0.344116 0.813550 balanced_accuracy 0.373255 0.126418 16.979850 0.373255 0.126418 16.979850 1 True 10
3 CatBoost_BAG_L2 0.762368 0.854438 0.762368 -0.350582 0.813382 balanced_accuracy 2.994394 1.033091 42.922087 0.148481 0.106275 8.236901 2 True 17
4 XGBoost_BAG_L2 0.760461 0.848807 0.760461 -0.352735 0.817477 balanced_accuracy 3.135377 1.001012 36.805544 0.289464 0.074196 2.120358 2 True 21
5 ExtraTreesEntr_BAG_L2 0.758926 0.853721 0.758926 -0.339654 0.776399 balanced_accuracy 2.977363 1.037696 35.304613 0.131450 0.110880 0.619427 2 True 19
6 LightGBMXT_BAG_L1 0.758538 0.856075 0.758538 -0.320472 0.778898 balanced_accuracy 0.283368 0.049165 1.523896 0.283368 0.049165 1.523896 1 True 1
7 RandomForestEntr_BAG_L2 0.757599 0.854642 0.757599 -0.353323 0.786353 balanced_accuracy 2.965149 1.036078 35.317373 0.119237 0.109262 0.632187 2 True 16
8 LightGBM_BAG_L2 0.757110 0.848910 0.757110 -0.361935 0.819976 balanced_accuracy 3.136799 0.977384 36.901346 0.290886 0.050568 2.216160 2 True 14
9 WeightedEnsemble_L3 0.757110 0.848910 0.757110 -0.361935 0.819976 balanced_accuracy 3.138265 0.978837 37.290754 0.001466 0.001453 0.389407 3 True 24
10 RandomForestGini_BAG_L2 0.756827 0.855052 0.756827 -0.359045 0.792822 balanced_accuracy 2.975387 1.035088 35.317288 0.129475 0.108272 0.632102 2 True 15
11 XGBoost_BAG_L1 0.756678 0.855052 0.756678 -0.319531 0.784148 balanced_accuracy 0.238557 0.057585 1.433007 0.238557 0.057585 1.433007 1 True 9
12 LightGBMXT_BAG_L2 0.755724 0.853823 0.755724 -0.324906 0.791415 balanced_accuracy 3.118717 0.980628 36.413105 0.272804 0.053812 1.727919 2 True 13
13 ExtraTreesGini_BAG_L2 0.755652 0.854847 0.755652 -0.348812 0.767977 balanced_accuracy 2.978131 1.038326 35.318478 0.132219 0.111510 0.633292 2 True 18
14 CatBoost_BAG_L1 0.754272 0.858634 0.754272 -0.345131 0.778604 balanced_accuracy 0.148378 0.105365 5.233099 0.148378 0.105365 5.233099 1 True 5
15 LightGBMLarge_BAG_L2 0.754013 0.846453 0.754013 -0.394555 0.813445 balanced_accuracy 3.313471 0.985655 38.359648 0.467559 0.058839 3.674462 2 True 23
16 RandomForestGini_BAG_L1 0.745745 0.843587 0.745745 -0.339655 0.748194 balanced_accuracy 0.131588 0.109745 0.660056 0.131588 0.109745 0.660056 1 True 3
17 LightGBM_BAG_L1 0.745232 0.846658 0.745232 -0.335439 0.779696 balanced_accuracy 0.261705 0.043192 1.681311 0.261705 0.043192 1.681311 1 True 2
18 RandomForestEntr_BAG_L1 0.743132 0.841642 0.743132 -0.342622 0.756678 balanced_accuracy 0.129789 0.109414 0.627071 0.129789 0.109414 0.627071 1 True 4
19 LightGBMLarge_BAG_L1 0.735966 0.836831 0.735966 -0.370556 0.746787 balanced_accuracy 0.407081 0.051593 2.595358 0.407081 0.051593 2.595358 1 True 11
20 NeuralNetFastAI_BAG_L2 0.731819 0.849319 0.731819 -0.343125 0.745212 balanced_accuracy 3.873693 1.036627 36.413861 1.027781 0.109811 1.728674 2 True 20
21 ExtraTreesGini_BAG_L1 0.731460 0.835398 0.731460 -0.354638 0.751491 balanced_accuracy 0.132384 0.112366 0.619383 0.132384 0.112366 0.619383 1 True 6
22 ExtraTreesEntr_BAG_L1 0.725517 0.832224 0.725517 -0.351604 0.730553 balanced_accuracy 0.133159 0.112544 0.620193 0.133159 0.112544 0.620193 1 True 7
23 NeuralNetFastAI_BAG_L1 0.711150 0.840004 0.711150 -0.345629 0.716650 balanced_accuracy 1.013729 0.101023 5.307321 1.013729 0.101023 5.307321 1 True 8

Notice that log_loss scores are negative. This is because metrics in AutoGluon are always shown in higher_is_better form. This means that metrics such as log_loss and root_mean_squared_error will have their signs FLIPPED, and values will be negative. This is necessary to avoid the user needing to know the metric to understand if higher is better when looking at leaderboard.

Here’s how to specify a particular model to use for prediction instead of AutoGluon’s default model-choice:

i = 0  # index of model to use
all_models = predictor.model_names()
model_to_use = all_models[i]
model_pred = predictor.predict(datapoint, model=model_to_use)
print("Prediction from %s model: %s" % (model_to_use, model_pred.iloc[0]))
Prediction from LightGBMXT_BAG_L1 model:  <=50K

We can easily access various information about the trained predictor or a particular model:

# Objects defined below are dicts of various information (not printed here as they are quite large):
predictor_information = predictor.info()  # access info about the predictor
model_info = predictor.model_info(model_to_use)  # access info about a model
model_info_alternative = predictor._trainer.load_model(model_to_use).get_info()  # load the inner model and access its info directly

The predictor also remembers what metric predictions should be evaluated with, which can be done with ground truth labels as follows:

y_pred_proba = predictor.predict_proba(X_test)
predictor.evaluate_predictions(y_true=y_test, y_pred=y_pred_proba)
{'balanced_accuracy': np.float64(0.757109925774479),
 'accuracy': 0.8489098167673252,
 'mcc': 0.5574094010407329,
 'roc_auc': np.float64(0.8892561977250506),
 'f1': 0.646551724137931,
 'precision': 0.7265877287405813,
 'recall': 0.5823986194995686}

Since the label columns remains in the test_data DataFrame, we can instead use the shorthand:

predictor.evaluate(test_data)
{'balanced_accuracy': np.float64(0.757109925774479),
 'accuracy': 0.8489098167673252,
 'mcc': 0.5574094010407329,
 'roc_auc': np.float64(0.8892561977250506),
 'f1': 0.646551724137931,
 'precision': 0.7265877287405813,
 'recall': 0.5823986194995686}

Interpretability (feature importance)

To better understand our trained predictor, we can estimate the overall importance of each feature:

predictor.feature_importance(test_data)
Computing feature importance via permutation shuffling for 14 features using 5000 rows with 5 shuffle sets...
	160.43s	= Expected runtime (32.09s per shuffle set)
	95.79s	= Actual runtime (Completed 5 of 5 shuffle sets)
importance stddev p_value n p99_high p99_low
marital-status 0.055951 0.008296 5.633268e-05 5 0.073032 0.038870
capital-gain 0.047191 0.002066 4.396402e-07 5 0.051445 0.042938
occupation 0.035709 0.004367 2.630361e-05 5 0.044700 0.026718
education-num 0.030355 0.007845 4.907097e-04 5 0.046508 0.014203
relationship 0.029122 0.005665 1.634793e-04 5 0.040786 0.017458
age 0.027879 0.006321 2.965123e-04 5 0.040894 0.014864
hours-per-week 0.012799 0.003570 6.569336e-04 5 0.020150 0.005448
education 0.009833 0.002992 9.136035e-04 5 0.015994 0.003671
capital-loss 0.008896 0.000948 1.526836e-05 5 0.010849 0.006943
fnlwgt 0.006258 0.001399 2.804961e-04 5 0.009138 0.003378
race 0.004679 0.001490 1.082954e-03 5 0.007747 0.001611
native-country 0.004030 0.002559 1.221486e-02 5 0.009300 -0.001240
workclass 0.003153 0.004906 1.120437e-01 5 0.013254 -0.006948
sex 0.000538 0.003214 3.635671e-01 5 0.007157 -0.006080

Computed via permutation-shuffling, these feature importance scores quantify the drop in predictive performance (of the already trained predictor) when one column’s values are randomly shuffled across rows. The top features in this list contribute most to AutoGluon’s accuracy (for predicting when/if a patient will be readmitted to the hospital). Features with non-positive importance score hardly contribute to the predictor’s accuracy, or may even be actively harmful to include in the data (consider removing these features from your data and calling fit again). These scores facilitate interpretability of the predictor’s global behavior (which features it relies on for all predictions). To get local explanations regarding which features influence a particular prediction, check out the example notebooks for explaining particular AutoGluon predictions using Shapely values.

Before making judgement on if AutoGluon is more or less interpretable than another solution, we recommend reading The Mythos of Model Interpretability by Zachary Lipton, which covers why often-claimed interpretable models such as trees and linear models are rarely meaningfully more interpretable than more advanced models.

Accelerating inference

We describe multiple ways to reduce the time it takes for AutoGluon to produce predictions.

Before providing code examples, it is important to understand that there are several ways to accelerate inference in AutoGluon. The table below lists the options in order of priority.

Optimization

Inference Speedup

Cost

Notes

refit_full

8x (requires bagging)

-Quality

Only provides speedup with bagging enabled.

persist

Up to 10x in online-inference

+Memory Usage

If memory is not sufficient to persist model, speedup is not gained. Speedup is most effective in online-inference and is not relevant in batch inference.

infer_limit

Up to 50x+

-Quality (Relative to speedup)

Best when combined with refit_full.

feature pruning

Typically at most 1.5x. More if willing to lower quality significantly.

-Quality?

Dependent on the existence of unimportant features in data. Call predictor.feature_importance(test_data) to gauge which features could be removed.

use faster hardware

Usually at most 3x. Depends on hardware (ignoring GPU).

+Hardware

As an example, an EC2 c6i.2xlarge is ~1.6x faster than an m5.2xlarge for a similar price. Laptops in particular might be slow compared to cloud instances.

manual hyperparameters adjustment

Usually at most 2x assuming infer_limit is already specified.

Manual Effort

Can be very complicated and is not recommended. Potential ways to get speedups this way is to reduce the number of trees in LightGBM, XGBoost, and CatBoost.

manual data preprocessing

Usually at most 1.2x.

Manual Effort

Only relevant for online-inference. Not recommended as AutoGluon’s default preprocessing is highly optimized.

For most scenarios, the order of inference optimizations should be:

  1. refit_full

  2. persist

  3. infer_limit

If following these recommendations does not lead to a sufficiently fast model, you may consider the more advanced options in the table.

persist: Keeping models in memory

By default, AutoGluon loads models into memory one at a time and only when they are needed for prediction. This strategy is robust for large stacked/bagged ensembles, but leads to slower prediction times. If you plan to repeatedly make predictions (e.g. on new datapoints one at a time rather than one large test dataset), you can first specify that all models required for inference should be loaded into memory as follows:

import time
import numpy as np

num_test = 20
preds = np.array(['']*num_test, dtype='object')
time_start = time.time()
for i in range(num_test):
    datapoint = X_test.iloc[[i]]
    pred_numpy = predictor.predict(datapoint, as_pandas=False)
    preds[i] = pred_numpy[0]
time_end = time.time()
time_without_persist = (time_end - time_start) / num_test
predictor.persist()

preds = np.array(['']*num_test, dtype='object')
time_start = time.time()
for i in range(num_test):
    datapoint = X_test.iloc[[i]]
    pred_numpy = predictor.predict(datapoint, as_pandas=False)
    preds[i] = pred_numpy[0]
time_end = time.time()
time_with_persist = (time_end - time_start) / num_test

predictor.unpersist()  # free memory by clearing models, future predict() calls will load models from disk
Persisting 12 models in memory. Models will require 0.26% of memory.
Unpersisted 12 models: ['CatBoost_BAG_L1', 'NeuralNetTorch_BAG_L1', 'LightGBMXT_BAG_L1', 'ExtraTreesGini_BAG_L1', 'LightGBM_BAG_L2', 'RandomForestGini_BAG_L1', 'NeuralNetFastAI_BAG_L1', 'WeightedEnsemble_L3', 'RandomForestEntr_BAG_L1', 'LightGBM_BAG_L1', 'ExtraTreesEntr_BAG_L1', 'XGBoost_BAG_L1']
['CatBoost_BAG_L1',
 'NeuralNetTorch_BAG_L1',
 'LightGBMXT_BAG_L1',
 'ExtraTreesGini_BAG_L1',
 'LightGBM_BAG_L2',
 'RandomForestGini_BAG_L1',
 'NeuralNetFastAI_BAG_L1',
 'WeightedEnsemble_L3',
 'RandomForestEntr_BAG_L1',
 'LightGBM_BAG_L1',
 'ExtraTreesEntr_BAG_L1',
 'XGBoost_BAG_L1']
print(f"Inference time unoptimized:  {time_without_persist:.3f}s")
print(f"Inference time with persist: {time_with_persist:.3f}s")
Inference time unoptimized:  0.785s
Inference time with persist: 0.582s

You can alternatively specify a particular model to persist via the models argument of persist(), or simply set models='all' to simultaneously load every single model that was trained during fit.

infer_limit: Inference speed as a fit constraint

If you know your latency constraint prior to fitting the predictor, you can specify it explicitly as a fit argument. AutoGluon will then automatically train models in a fashion that attempts to satisfy the constraint.

This constraint has two components: infer_limit and infer_limit_batch_size:

  • infer_limit is the time in seconds to predict 1 row of data. For example, infer_limit=0.05 means 50 ms per row of data, or 20 rows / second throughput.

  • infer_limit_batch_size is the amount of rows passed at once to predict when calculating per-row speed. This is very important because infer_limit_batch_size=1 (online-inference) is highly suboptimal as various operations have a fixed cost overhead regardless of data size. If you can pass your test data in bulk, you should specify infer_limit_batch_size=10000.

# At most 0.05 ms per row (20000 rows per second throughput)
infer_limit = 0.00005
# adhere to infer_limit with batches of size 10000 (batch-inference, easier to satisfy infer_limit)
infer_limit_batch_size = 10000
# adhere to infer_limit with batches of size 1 (online-inference, much harder to satisfy infer_limit)
# infer_limit_batch_size = 1  # Note that infer_limit<0.02 when infer_limit_batch_size=1 can be difficult to satisfy.
predictor_infer_limit = TabularPredictor(label=label, eval_metric=metric).fit(
    train_data=train_data,
    time_limit=30,
    infer_limit=infer_limit,
    infer_limit_batch_size=infer_limit_batch_size,
)

# NOTE: If bagging was enabled, it is important to call refit_full at this stage.
#  infer_limit assumes that the user will call refit_full after fit.
# predictor_infer_limit.refit_full()

# NOTE: To align with inference speed calculated during fit, models must be persisted.
predictor_infer_limit.persist()
# Below is an optimized version that only persists the minimum required models for prediction.
# predictor_infer_limit.persist('best')

predictor_infer_limit.leaderboard()
No path specified. Models will be saved in: "AutogluonModels/ag-20261128_160304"
Verbosity: 2 (Standard Logging)
=================== System Info ===================
AutoGluon Version:  1.6.4.dev0
Python Version:     3.13.11
Operating System:   Linux
Platform Machine:   x86_64
Platform Version:   #1 SMP Thu Jun 25 14:43:50 UTC 2026
CPU Count:          8
Pytorch Version:    2.13.0+cu130
CUDA Version:       13.0
GPU Memory:         GPU 0: 14.57/14.57 GB
Total GPU Memory:   Free: 14.57 GB, Allocated: 0.00 GB, Total: 14.57 GB
GPU Count:          1
Memory Avail:       21.93 GB / 30.94 GB (70.9%)
Disk Space Avail:   211.58 GB / 255.99 GB (82.7%)
===================================================
No presets specified! To achieve strong results with AutoGluon, it is recommended to use the available presets. Defaulting to `'medium'`...
	Recommended Presets (For more details refer to https://auto.gluon.ai/stable/tutorials/tabular/tabular-essentials.html#presets):
	presets='extreme'  : Use this if you have a GPU. The go-to preset for best results, and the one to use for benchmark comparisons. New in v1.6: far better than 'best' on datasets <100000 samples by using Tabular Foundation Models (TFMs) meta-learned on https://tabarena.ai: Nori, TabICLv2, and TabDPT-Turbo. Every model is free for commercial use. Requires `pip install autogluon.tabular[tabarena]`.
	presets='noncommercial': New in v1.6: 'extreme' plus TabPFN-3, a frontier tabular foundation model created by Prior Labs. Stronger still, but commercial use requires a TabPFN-3 license: https://docs.priorlabs.ai/models#tabpfn-model-license
	presets='best'     : Use this if you do not have a GPU. Maximize accuracy. Use in competitions.
	presets='best_v150': New in v1.5: Better quality than 'best' and 5x+ faster to train. Give it a try!
	presets='high'     : Strong accuracy with fast inference speed.
	presets='high_v150': New in v1.5: Better quality than 'high' and 5x+ faster to train. Give it a try!
	presets='good'     : Good accuracy with very fast inference speed.
	presets='medium'   : Fast training time, ideal for initial prototyping.
Using hyperparameters preset: hyperparameters='default'
Beginning AutoGluon training ... Time limit = 30s
AutoGluon will save models to "/home/ci/autogluon/docs/tutorials/tabular/AutogluonModels/ag-20261128_160304"
Train Data Rows:    1000
Train Data Columns: 14
Label Column:       class
AutoGluon infers your prediction problem is: 'binary' (because only two unique label-values observed).
	2 unique label values:  [' >50K', ' <=50K']
	If 'binary' is not the correct problem_type, please manually specify the problem_type parameter during Predictor init (You may specify problem_type as one of: ['binary', 'multiclass', 'regression', 'quantile'])
Problem Type:       binary
Preprocessing data...
Selected class <--> label mapping:  class 1 =  >50K, class 0 =  <=50K
	Note: For your binary classification, AutoGluon arbitrarily selected which label-value represents positive ( >50K) vs negative ( <=50K) class.
	To explicitly set the positive_class, either rename classes to 1 and 0, or specify positive_class in Predictor init.
Using Feature Generators to preprocess the data ...
Fitting AutoMLPipelineFeatureGenerator...
	Available Memory:                    22454.13 MB
	Train Data (Original)  Memory Usage: 0.13 MB (0.0% of available memory)
	Inferring data type of each feature based on column values. Set feature_metadata_in to manually specify special dtypes of the features.
	Stage 1 Generators:
		Fitting AsTypeFeatureGenerator...
			Note: Converting 1 features to boolean dtype as they only contain 2 unique values.
	Stage 2 Generators:
		Fitting FillNaFeatureGenerator...
	Stage 3 Generators:
		Fitting IdentityFeatureGenerator...
		Fitting CategoryFeatureGenerator...
			Fitting CategoryMemoryMinimizeFeatureGenerator...
	Stage 4 Generators:
		Fitting DropUniqueFeatureGenerator...
	Stage 5 Generators:
		Fitting DropDuplicatesFeatureGenerator...
	Types of features in original data (raw dtype, special dtypes):
		('int', [])    : 6 | ['age', 'fnlwgt', 'education-num', 'capital-gain', 'capital-loss', ...]
		('object', []) : 8 | ['workclass', 'education', 'marital-status', 'occupation', 'relationship', ...]
	Types of features in processed data (raw dtype, special dtypes):
		('category', [])  : 7 | ['workclass', 'education', 'marital-status', 'occupation', 'relationship', ...]
		('int', [])       : 6 | ['age', 'fnlwgt', 'education-num', 'capital-gain', 'capital-loss', ...]
		('int', ['bool']) : 1 | ['sex']
	0.1s = Fit runtime
	14 features in original data used to generate 14 features in processed data.
	Train Data (Processed) Memory Usage: 0.06 MB (0.0% of available memory)
	1.562μs	= Feature Preprocessing Time (1 row | 10000 batch size)
		Feature Preprocessing requires 3.12% of the overall inference constraint (0.05ms)
		0.048ms inference time budget remaining for models...
Data preprocessing and feature engineering runtime = 0.23s ...
AutoGluon will gauge predictive performance using evaluation metric: 'balanced_accuracy'
	To change this, specify the eval_metric parameter of Predictor()
Automatically generating train/validation split with holdout_frac=0.2, Train Rows: 800, Val Rows: 200
User-specified model hyperparameters to be fit:
{
	'NN_TORCH': [{}],
	'GBM': [{'extra_trees': True, 'ag_args': {'name_suffix': 'XT'}}, {}, {'learning_rate': 0.03, 'num_leaves': 128, 'feature_fraction': 0.9, 'min_data_in_leaf': 3, 'ag_args': {'name_suffix': 'Large', 'priority': 0, 'hyperparameter_tune_kwargs': None}}],
	'CAT': [{}],
	'XGB': [{}],
	'FASTAI': [{}],
	'RF': [{'criterion': 'gini', 'ag_args': {'name_suffix': 'Gini', 'problem_types': ['binary', 'multiclass']}}, {'criterion': 'entropy', 'ag_args': {'name_suffix': 'Entr', 'problem_types': ['binary', 'multiclass']}}, {'criterion': 'squared_error', 'ag_args': {'name_suffix': 'MSE', 'problem_types': ['regression', 'quantile']}}],
	'XT': [{'criterion': 'gini', 'ag_args': {'name_suffix': 'Gini', 'problem_types': ['binary', 'multiclass']}}, {'criterion': 'entropy', 'ag_args': {'name_suffix': 'Entr', 'problem_types': ['binary', 'multiclass']}}, {'criterion': 'squared_error', 'ag_args': {'name_suffix': 'MSE', 'problem_types': ['regression', 'quantile']}}],
}
Fitting 11 L1 models, fit_strategy="sequential" ...
Fitting model: LightGBMXT ... Training model for up to 29.77s of the 29.77s of remaining time.
	Fitting with cpus=4, gpus=0, mem=0.1/21.9 GB
	0.7575	 = Validation score   (balanced_accuracy)
	0.82s	 = Training   runtime
	0.0s	 = Validation runtime
	2.508μs	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	2.508μs	 = Validation runtime (1 row | 10000 batch size)
	2.508μs	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	2.508μs	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: LightGBM ... Training model for up to 28.94s of the 28.94s of remaining time.
	Fitting with cpus=4, gpus=0, mem=0.1/21.9 GB
	0.7314	 = Validation score   (balanced_accuracy)
	0.92s	 = Training   runtime
	0.0s	 = Validation runtime
	1.354μs	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	1.354μs	 = Validation runtime (1 row | 10000 batch size)
	1.354μs	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	1.354μs	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: RandomForestGini ... Training model for up to 28.02s of the 28.01s of remaining time.
	Fitting with cpus=8, gpus=0
	0.7314	 = Validation score   (balanced_accuracy)
	0.76s	 = Training   runtime
	0.08s	 = Validation runtime
	0.012ms	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: RandomForestEntr ... Training model for up to 27.16s of the 27.16s of remaining time.
	Fitting with cpus=8, gpus=0
	0.7281	 = Validation score   (balanced_accuracy)
	0.75s	 = Training   runtime
	0.08s	 = Validation runtime
	0.012ms	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: CatBoost ... Training model for up to 26.31s of the 26.31s of remaining time.
	Fitting with cpus=4, gpus=0
	0.7771	 = Validation score   (balanced_accuracy)
	2.11s	 = Training   runtime
	0.01s	 = Validation runtime
	1.811μs	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	1.811μs	 = Validation runtime (1 row | 10000 batch size)
	1.811μs	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	1.811μs	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: ExtraTreesGini ... Training model for up to 24.18s of the 24.18s of remaining time.
	Fitting with cpus=8, gpus=0
	0.6824	 = Validation score   (balanced_accuracy)
	0.75s	 = Training   runtime
	0.08s	 = Validation runtime
	0.012ms	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: ExtraTreesEntr ... Training model for up to 23.33s of the 23.33s of remaining time.
	Fitting with cpus=8, gpus=0
	0.6922	 = Validation score   (balanced_accuracy)
	0.75s	 = Training   runtime
	0.08s	 = Validation runtime
	0.012ms	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: NeuralNetFastAI ... Training model for up to 22.49s of the 22.48s of remaining time.
	Fitting with cpus=4, gpus=0, mem=0.0/21.9 GB
Metric balanced_accuracy is not supported by this model - using log_loss instead
No improvement since epoch 7: early stopping
	0.751	 = Validation score   (balanced_accuracy)
	1.06s	 = Training   runtime
	0.01s	 = Validation runtime
	0.012ms	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	0.012ms	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: XGBoost ... Training model for up to 21.40s of the 21.40s of remaining time.
	Fitting with cpus=4, gpus=0
	0.7577	 = Validation score   (balanced_accuracy)
	0.73s	 = Training   runtime
	0.01s	 = Validation runtime
	2.507μs	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	2.507μs	 = Validation runtime (1 row | 10000 batch size)
	2.507μs	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	2.507μs	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: NeuralNetTorch ... Training model for up to 20.65s of the 20.65s of remaining time.
	Fitting with cpus=4, gpus=0, mem=0.0/21.9 GB
	0.799	 = Validation score   (balanced_accuracy)
	4.25s	 = Training   runtime
	0.01s	 = Validation runtime
	4.516μs	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	4.516μs	 = Validation runtime (1 row | 10000 batch size)
	4.516μs	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	4.516μs	 = Validation runtime (1 row | 10000 batch size | REFIT)
Fitting model: LightGBMLarge ... Training model for up to 16.39s of the 16.38s of remaining time.
	Fitting with cpus=4, gpus=0, mem=0.1/21.8 GB
	0.685	 = Validation score   (balanced_accuracy)
	1.54s	 = Training   runtime
	0.0s	 = Validation runtime
	1.934μs	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	1.934μs	 = Validation runtime (1 row | 10000 batch size)
	1.934μs	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	1.934μs	 = Validation runtime (1 row | 10000 batch size | REFIT)
Removing 4/11 base models to satisfy inference constraint (constraint=0.046ms) ...
	0.074ms	-> 0.062ms	(ExtraTreesGini)
	0.062ms	-> 0.061ms	(LightGBMLarge)
	0.061ms	-> 0.049ms	(ExtraTreesEntr)
	0.049ms	-> 0.037ms	(RandomForestEntr)
Fitting model: WeightedEnsemble_L2 ... Training model for up to 29.77s of the 14.82s of remaining time.
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'NeuralNetTorch': 0.667, 'RandomForestGini': 0.333}
	0.7995	 = Validation score   (balanced_accuracy)
	0.15s	 = Training   runtime
	0.0s	 = Validation runtime
	0.08μs	 = Validation runtime (1 row | 10000 batch size | MARGINAL)
	0.016ms	 = Validation runtime (1 row | 10000 batch size)
	0.08μs	 = Validation runtime (1 row | 10000 batch size | REFIT | MARGINAL)
	0.016ms	 = Validation runtime (1 row | 10000 batch size | REFIT)
AutoGluon training complete, total runtime = 15.35s ... Best model: WeightedEnsemble_L2 | Estimated inference throughput: 2115.3 rows/s (200 batch size)
Enabling decision threshold calibration (calibrate_decision_threshold='auto', metric is valid, problem_type is 'binary')
Calibrating decision threshold to optimize metric balanced_accuracy | Checking 51 thresholds...
Calibrating decision threshold via fine-grained search | Checking 38 thresholds...
	Base Threshold: 0.500	| val: 0.7995
	Best Threshold: 0.507	| val: 0.8029
Updating predictor.decision_threshold from 0.5 -> 0.507
	This will impact how prediction probabilities are converted to predictions in binary classification.
	Prediction probabilities of the positive class >0.507 will be predicted as the positive class ( >50K). This can significantly impact metric scores.
	You can update this value via `predictor.set_decision_threshold`.
	You can calculate an optimal decision threshold on the validation data via `predictor.calibrate_decision_threshold()`.
TabularPredictor saved. To load, use: predictor = TabularPredictor.load("/home/ci/autogluon/docs/tutorials/tabular/AutogluonModels/ag-20261128_160304")
Persisting 3 models in memory. Models will require 0.03% of memory.
model score_val eval_metric pred_time_val fit_time pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order
0 WeightedEnsemble_L2 0.799513 balanced_accuracy 0.094547 5.151400 0.001326 0.149103 2 True 12
1 NeuralNetTorch 0.798987 balanced_accuracy 0.010785 4.246732 0.010785 4.246732 1 True 10
2 CatBoost 0.777076 balanced_accuracy 0.010566 2.112734 0.010566 2.112734 1 True 5
3 XGBoost 0.757731 balanced_accuracy 0.005569 0.731380 0.005569 0.731380 1 True 9
4 LightGBMXT 0.757468 balanced_accuracy 0.003470 0.820853 0.003470 0.820853 1 True 1
5 NeuralNetFastAI 0.751020 balanced_accuracy 0.008437 1.062692 0.008437 1.062692 1 True 8
6 LightGBM 0.731412 balanced_accuracy 0.003098 0.916112 0.003098 0.916112 1 True 2
7 RandomForestGini 0.731412 balanced_accuracy 0.082436 0.755565 0.082436 0.755565 1 True 3
8 RandomForestEntr 0.728056 balanced_accuracy 0.081156 0.748297 0.081156 0.748297 1 True 4
9 ExtraTreesEntr 0.692196 balanced_accuracy 0.079634 0.748630 0.079634 0.748630 1 True 7
10 LightGBMLarge 0.684959 balanced_accuracy 0.003269 1.543235 0.003269 1.543235 1 True 11
11 ExtraTreesGini 0.682392 balanced_accuracy 0.080359 0.747261 0.080359 0.747261 1 True 6

Now we can test the inference speed of the final model and check if it satisfies the inference constraints.

test_data_batch = test_data.sample(infer_limit_batch_size, replace=True, ignore_index=True)

import time
time_start = time.time()
predictor_infer_limit.predict(test_data_batch)
time_end = time.time()

infer_time_per_row = (time_end - time_start) / len(test_data_batch)
rows_per_second = 1 / infer_time_per_row
infer_time_per_row_ratio = infer_time_per_row / infer_limit
is_constraint_satisfied = infer_time_per_row_ratio <= 1

print(f'Model is able to predict {round(rows_per_second, 1)} rows per second. (User-specified Throughput = {1 / infer_limit})')
print(f'Model uses {round(infer_time_per_row_ratio * 100, 1)}% of infer_limit time per row.')
print(f'Model satisfies inference constraint: {is_constraint_satisfied}')
Model is able to predict 54278.5 rows per second. (User-specified Throughput = 20000.0)
Model uses 36.8% of infer_limit time per row.
Model satisfies inference constraint: True

Using smaller ensembles for prediction

Without having to retrain any models, one can construct alternative ensembles that aggregate individual models’ predictions with different weighting schemes. These ensembles become smaller (and hence faster for prediction) if they assign nonzero weight to less models. You can produce a wide variety of ensembles with different accuracy-speed tradeoffs like this:

additional_ensembles = predictor.fit_weighted_ensemble(expand_pareto_frontier=True)
print("Alternative ensembles you can use for prediction:", additional_ensembles)

predictor.leaderboard(only_pareto_frontier=True)
Alternative ensembles you can use for prediction: ['WeightedEnsemble_L2Best_Pareto1', 'WeightedEnsemble_L2Best_Pareto2', 'WeightedEnsemble_L2Best_Pareto3', 'WeightedEnsemble_L2Best_Pareto4', 'WeightedEnsemble_L2Best_Pareto5', 'WeightedEnsemble_L2Best_Pareto6', 'WeightedEnsemble_L2Best_Pareto7', 'WeightedEnsemble_L2Best_Pareto8', 'WeightedEnsemble_L2Best_Pareto9', 'WeightedEnsemble_L2Best_Pareto10', 'WeightedEnsemble_L3Best_Pareto11', 'WeightedEnsemble_L3Best_Pareto12', 'WeightedEnsemble_L3Best_Pareto13', 'WeightedEnsemble_L3Best_Pareto14', 'WeightedEnsemble_L3Best_Pareto15', 'WeightedEnsemble_L3Best_Pareto16', 'WeightedEnsemble_L3Best_Pareto17', 'WeightedEnsemble_L3Best_Pareto18', 'WeightedEnsemble_L3Best_Pareto19', 'WeightedEnsemble_L3Best_Pareto20', 'WeightedEnsemble_L3Best']
Fitting model: WeightedEnsemble_L2Best_Pareto1 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L1': 1.0}
	0.7797	 = Validation score   (balanced_accuracy)
	0.05s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto2 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L1': 1.0}
	0.7797	 = Validation score   (balanced_accuracy)
	0.05s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto3 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'XGBoost_BAG_L1': 1.0}
	0.7841	 = Validation score   (balanced_accuracy)
	0.07s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto4 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'XGBoost_BAG_L1': 1.0}
	0.7841	 = Validation score   (balanced_accuracy)
	0.1s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto5 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'XGBoost_BAG_L1': 1.0}
	0.7841	 = Validation score   (balanced_accuracy)
	0.12s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto6 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'XGBoost_BAG_L1': 1.0}
	0.7841	 = Validation score   (balanced_accuracy)
	0.14s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto7 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'XGBoost_BAG_L1': 1.0}
	0.7841	 = Validation score   (balanced_accuracy)
	0.16s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto8 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'XGBoost_BAG_L1': 1.0}
	0.7841	 = Validation score   (balanced_accuracy)
	0.18s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto9 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'XGBoost_BAG_L1': 1.0}
	0.7841	 = Validation score   (balanced_accuracy)
	0.21s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L2Best_Pareto10 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'NeuralNetTorch_BAG_L1': 0.941, 'CatBoost_BAG_L1': 0.059}
	0.8142	 = Validation score   (balanced_accuracy)
	0.23s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto11 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.23s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto12 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.23s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto13 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.23s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto14 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.25s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto15 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.28s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto16 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.27s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto17 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.28s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto18 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.3s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto19 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.3s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best_Pareto20 ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.3s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: WeightedEnsemble_L3Best ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.82	 = Validation score   (balanced_accuracy)
	0.32s	 = Training   runtime
	0.0s	 = Validation runtime
model score_val eval_metric pred_time_val fit_time pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order
0 LightGBM_BAG_L2 0.819976 balanced_accuracy 0.977384 36.901346 0.050568 2.216160 2 True 14
1 WeightedEnsemble_L2 0.814222 balanced_accuracy 0.233257 22.499809 0.001475 0.286859 2 True 12
2 NeuralNetTorch_BAG_L1 0.813550 balanced_accuracy 0.126418 16.979850 0.126418 16.979850 1 True 10
3 XGBoost_BAG_L1 0.784148 balanced_accuracy 0.057585 1.433007 0.057585 1.433007 1 True 9
4 LightGBM_BAG_L1 0.779696 balanced_accuracy 0.043192 1.681311 0.043192 1.681311 1 True 2

The resulting leaderboard will contain the most accurate model for a given inference-latency. You can select whichever model exhibits acceptable latency from the leaderboard and use it for prediction.

model_for_prediction = additional_ensembles[0]
predictions = predictor.predict(test_data, model=model_for_prediction)
predictor.delete_models(models_to_delete=additional_ensembles)  # delete these extra models so they don't affect rest of tutorial
Deleting model WeightedEnsemble_L2Best_Pareto1. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto1 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto2. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto2 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto3. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto3 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto4. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto4 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto5. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto5 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto6. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto6 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto7. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto7 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto8. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto8 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto9. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto9 will be removed.
Deleting model WeightedEnsemble_L2Best_Pareto10. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L2Best_Pareto10 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto11. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto11 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto12. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto12 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto13. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto13 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto14. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto14 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto15. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto15 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto16. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto16 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto17. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto17 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto18. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto18 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto19. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto19 will be removed.
Deleting model WeightedEnsemble_L3Best_Pareto20. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best_Pareto20 will be removed.
Deleting model WeightedEnsemble_L3Best. All files under /home/ci/autogluon/docs/tutorials/tabular/agModels-predictClass/models/WeightedEnsemble_L3Best will be removed.

Collapsing bagged ensembles via refit_full

For an ensemble predictor trained with bagging (as done above), recall there are ~10 bagged copies of each individual model trained on different train/validation folds. We can collapse this bag of ~10 models into a single model that’s fit to the full dataset, which can greatly reduce its memory/latency requirements (but may also reduce accuracy). Below we refit such a model for each original model but you can alternatively do this for just a particular model by specifying the model argument of refit_full().

refit_model_map = predictor.refit_full()
print("Name of each refit-full model corresponding to a previous bagged ensemble:")
print(refit_model_map)
predictor.leaderboard(test_data)
Name of each refit-full model corresponding to a previous bagged ensemble:
{'LightGBMXT_BAG_L1': 'LightGBMXT_BAG_L1_FULL', 'LightGBM_BAG_L1': 'LightGBM_BAG_L1_FULL', 'RandomForestGini_BAG_L1': 'RandomForestGini_BAG_L1_FULL', 'RandomForestEntr_BAG_L1': 'RandomForestEntr_BAG_L1_FULL', 'CatBoost_BAG_L1': 'CatBoost_BAG_L1_FULL', 'ExtraTreesGini_BAG_L1': 'ExtraTreesGini_BAG_L1_FULL', 'ExtraTreesEntr_BAG_L1': 'ExtraTreesEntr_BAG_L1_FULL', 'NeuralNetFastAI_BAG_L1': 'NeuralNetFastAI_BAG_L1_FULL', 'XGBoost_BAG_L1': 'XGBoost_BAG_L1_FULL', 'NeuralNetTorch_BAG_L1': 'NeuralNetTorch_BAG_L1_FULL', 'LightGBMLarge_BAG_L1': 'LightGBMLarge_BAG_L1_FULL', 'WeightedEnsemble_L2': 'WeightedEnsemble_L2_FULL', 'LightGBMXT_BAG_L2': 'LightGBMXT_BAG_L2_FULL', 'LightGBM_BAG_L2': 'LightGBM_BAG_L2_FULL', 'RandomForestGini_BAG_L2': 'RandomForestGini_BAG_L2_FULL', 'RandomForestEntr_BAG_L2': 'RandomForestEntr_BAG_L2_FULL', 'CatBoost_BAG_L2': 'CatBoost_BAG_L2_FULL', 'ExtraTreesGini_BAG_L2': 'ExtraTreesGini_BAG_L2_FULL', 'ExtraTreesEntr_BAG_L2': 'ExtraTreesEntr_BAG_L2_FULL', 'NeuralNetFastAI_BAG_L2': 'NeuralNetFastAI_BAG_L2_FULL', 'XGBoost_BAG_L2': 'XGBoost_BAG_L2_FULL', 'NeuralNetTorch_BAG_L2': 'NeuralNetTorch_BAG_L2_FULL', 'LightGBMLarge_BAG_L2': 'LightGBMLarge_BAG_L2_FULL', 'WeightedEnsemble_L3': 'WeightedEnsemble_L3_FULL'}
Refitting models via `predictor.refit_full` using all of the data (combined train and validation)...
	Models trained in this way will have the suffix "_FULL" and have NaN validation score.
	This process is not bound by time_limit, but should take less time than the original `predictor.fit` call.
	To learn more, refer to the `.refit_full` method docstring which explains how "_FULL" models differ from normal models.
Fitting 1 L1 models, fit_strategy="sequential" ...
Fitting model: LightGBMXT_BAG_L1_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	0.31s	 = Training   runtime
Fitting 1 L1 models, fit_strategy="sequential" ...
Fitting model: LightGBM_BAG_L1_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	0.32s	 = Training   runtime
Fitting model: RandomForestGini_BAG_L1_FULL | Skipping fit via cloning parent ...
	0.66s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: RandomForestEntr_BAG_L1_FULL | Skipping fit via cloning parent ...
	0.63s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting 1 L1 models, fit_strategy="sequential" ...
Fitting model: CatBoost_BAG_L1_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0
	0.29s	 = Training   runtime
Fitting model: ExtraTreesGini_BAG_L1_FULL | Skipping fit via cloning parent ...
	0.62s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: ExtraTreesEntr_BAG_L1_FULL | Skipping fit via cloning parent ...
	0.62s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting 1 L1 models, fit_strategy="sequential" ...
Fitting model: NeuralNetFastAI_BAG_L1_FULL ...
	Fitting 1 model on all data | Fitting with cpus=4, gpus=0, mem=0.0/21.8 GB
Metric balanced_accuracy is not supported by this model - using log_loss instead
	Stopping at the best epoch learned earlier - 11.
	0.45s	 = Training   runtime
Fitting 1 L1 models, fit_strategy="sequential" ...
Fitting model: XGBoost_BAG_L1_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0
	0.05s	 = Training   runtime
Fitting 1 L1 models, fit_strategy="sequential" ...
Fitting model: NeuralNetTorch_BAG_L1_FULL ...
	Fitting 1 model on all data | Fitting with cpus=4, gpus=0, mem=0.0/21.8 GB
	2.74s	 = Training   runtime
Fitting 1 L1 models, fit_strategy="sequential" ...
Fitting model: LightGBMLarge_BAG_L1_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.1/21.8 GB
	0.62s	 = Training   runtime
Fitting model: WeightedEnsemble_L2_FULL | Skipping fit via cloning parent ...
	Ensemble Weights: {'NeuralNetTorch_BAG_L1': 0.941, 'CatBoost_BAG_L1': 0.059}
	0.29s	 = Training   runtime
Fitting 1 L2 models, fit_strategy="sequential" ...
Fitting model: LightGBMXT_BAG_L2_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.1/21.8 GB
	0.32s	 = Training   runtime
Fitting 1 L2 models, fit_strategy="sequential" ...
Fitting model: LightGBM_BAG_L2_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.1/21.8 GB
	0.36s	 = Training   runtime
Fitting model: RandomForestGini_BAG_L2_FULL | Skipping fit via cloning parent ...
	0.63s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: RandomForestEntr_BAG_L2_FULL | Skipping fit via cloning parent ...
	0.63s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting 1 L2 models, fit_strategy="sequential" ...
Fitting model: CatBoost_BAG_L2_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0
	0.51s	 = Training   runtime
Fitting model: ExtraTreesGini_BAG_L2_FULL | Skipping fit via cloning parent ...
	0.63s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting model: ExtraTreesEntr_BAG_L2_FULL | Skipping fit via cloning parent ...
	0.62s	 = Training   runtime
	0.11s	 = Validation runtime
Fitting 1 L2 models, fit_strategy="sequential" ...
Fitting model: NeuralNetFastAI_BAG_L2_FULL ...
	Fitting 1 model on all data | Fitting with cpus=4, gpus=0, mem=0.0/21.8 GB
Metric balanced_accuracy is not supported by this model - using log_loss instead
	Stopping at the best epoch learned earlier - 8.
	0.34s	 = Training   runtime
Fitting 1 L2 models, fit_strategy="sequential" ...
Fitting model: XGBoost_BAG_L2_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0
	0.1s	 = Training   runtime
Fitting 1 L2 models, fit_strategy="sequential" ...
Fitting model: NeuralNetTorch_BAG_L2_FULL ...
	Fitting 1 model on all data | Fitting with cpus=4, gpus=0, mem=0.0/21.8 GB
	0.94s	 = Training   runtime
Fitting 1 L2 models, fit_strategy="sequential" ...
Fitting model: LightGBMLarge_BAG_L2_FULL ...
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.1/21.8 GB
	0.86s	 = Training   runtime
Fitting model: WeightedEnsemble_L3_FULL | Skipping fit via cloning parent ...
	Ensemble Weights: {'LightGBM_BAG_L2': 1.0}
	0.39s	 = Training   runtime
Updated best model to "WeightedEnsemble_L3_FULL" (Previously "WeightedEnsemble_L3"). AutoGluon will default to using "WeightedEnsemble_L3_FULL" for predict() and predict_proba().
Refit complete, total runtime = 9.03s ... Best model: "WeightedEnsemble_L3_FULL"
model score_test score_val eval_metric pred_time_test pred_time_val fit_time pred_time_test_marginal pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order
0 NeuralNetTorch_BAG_L2 0.782108 0.807145 balanced_accuracy 3.369036 1.103390 41.854969 0.567834 0.176574 7.169783 2 True 22
1 CatBoost_BAG_L2_FULL 0.770853 NaN balanced_accuracy 0.838898 NaN 7.197465 0.018886 NaN 0.513218 2 True 41
2 WeightedEnsemble_L2 0.770005 0.814222 balanced_accuracy 0.526278 0.233257 22.499809 0.001796 0.001475 0.286859 2 True 12
3 NeuralNetTorch_BAG_L1_FULL 0.769426 NaN balanced_accuracy 0.048835 NaN 2.738576 0.048835 NaN 2.738576 1 True 34
4 NeuralNetTorch_BAG_L1 0.769406 0.813550 balanced_accuracy 0.373977 0.126418 16.979850 0.373977 0.126418 16.979850 1 True 10
5 WeightedEnsemble_L2_FULL 0.769344 NaN balanced_accuracy 0.068047 NaN 3.312262 0.002158 NaN 0.286859 2 True 36
6 NeuralNetTorch_BAG_L2_FULL 0.767483 NaN balanced_accuracy 0.893064 NaN 7.625997 0.073052 NaN 0.941750 2 True 46
7 LightGBMXT_BAG_L2_FULL 0.765892 NaN balanced_accuracy 0.855575 NaN 6.999865 0.035563 NaN 0.315619 2 True 37
8 ExtraTreesEntr_BAG_L2_FULL 0.764286 NaN balanced_accuracy 0.952527 NaN 7.303673 0.132515 0.110880 0.619427 2 True 43
9 LightGBMXT_BAG_L1_FULL 0.764170 NaN balanced_accuracy 0.037146 NaN 0.307283 0.037146 NaN 0.307283 1 True 25
10 RandomForestEntr_BAG_L2_FULL 0.763576 NaN balanced_accuracy 0.937861 NaN 7.316433 0.117849 0.109262 0.632187 2 True 40
11 CatBoost_BAG_L2 0.762368 0.813382 balanced_accuracy 2.946713 1.033091 42.922087 0.145511 0.106275 8.236901 2 True 17
12 ExtraTreesGini_BAG_L2_FULL 0.760925 NaN balanced_accuracy 0.950714 NaN 7.317538 0.130702 0.111510 0.633292 2 True 42
13 XGBoost_BAG_L2 0.760461 0.817477 balanced_accuracy 3.082883 1.001012 36.805544 0.281681 0.074196 2.120358 2 True 21
14 RandomForestGini_BAG_L2_FULL 0.759919 NaN balanced_accuracy 0.939571 NaN 7.316348 0.119559 0.108272 0.632102 2 True 39
15 XGBoost_BAG_L2_FULL 0.759349 NaN balanced_accuracy 0.855633 NaN 6.781680 0.035621 NaN 0.097434 2 True 45
16 ExtraTreesEntr_BAG_L2 0.758926 0.776399 balanced_accuracy 2.931892 1.037696 35.304613 0.130690 0.110880 0.619427 2 True 19
17 LightGBMXT_BAG_L1 0.758538 0.778898 balanced_accuracy 0.275192 0.049165 1.523896 0.275192 0.049165 1.523896 1 True 1
18 XGBoost_BAG_L1_FULL 0.758260 NaN balanced_accuracy 0.027380 NaN 0.049957 0.027380 NaN 0.049957 1 True 33
19 RandomForestEntr_BAG_L2 0.757599 0.786353 balanced_accuracy 2.920566 1.036078 35.317373 0.119364 0.109262 0.632187 2 True 16
20 LightGBM_BAG_L2 0.757110 0.819976 balanced_accuracy 3.085178 0.977384 36.901346 0.283976 0.050568 2.216160 2 True 14
21 WeightedEnsemble_L3 0.757110 0.819976 balanced_accuracy 3.086620 0.978837 37.290754 0.001441 0.001453 0.389407 3 True 24
22 RandomForestGini_BAG_L2 0.756827 0.792822 balanced_accuracy 2.930293 1.035088 35.317288 0.129091 0.108272 0.632102 2 True 15
23 XGBoost_BAG_L1 0.756678 0.784148 balanced_accuracy 0.230923 0.057585 1.433007 0.230923 0.057585 1.433007 1 True 9
24 LightGBMLarge_BAG_L2_FULL 0.755907 NaN balanced_accuracy 0.870379 NaN 7.543880 0.050368 NaN 0.859634 2 True 47
25 LightGBM_BAG_L2_FULL 0.755744 NaN balanced_accuracy 0.856277 NaN 7.049231 0.036265 NaN 0.364984 2 True 38
26 WeightedEnsemble_L3_FULL 0.755744 NaN balanced_accuracy 0.857908 NaN 7.438638 0.001631 NaN 0.389407 3 True 48
27 LightGBMXT_BAG_L2 0.755724 0.791415 balanced_accuracy 3.072897 0.980628 36.413105 0.271695 0.053812 1.727919 2 True 13
28 ExtraTreesGini_BAG_L2 0.755652 0.767977 balanced_accuracy 2.933023 1.038326 35.318478 0.131821 0.111510 0.633292 2 True 18
29 CatBoost_BAG_L1_FULL 0.755427 NaN balanced_accuracy 0.017054 NaN 0.286827 0.017054 NaN 0.286827 1 True 29
30 CatBoost_BAG_L1 0.754272 0.778604 balanced_accuracy 0.150505 0.105365 5.233099 0.150505 0.105365 5.233099 1 True 5
31 LightGBMLarge_BAG_L2 0.754013 0.813445 balanced_accuracy 3.263626 0.985655 38.359648 0.462424 0.058839 3.674462 2 True 23
32 LightGBM_BAG_L1_FULL 0.750874 NaN balanced_accuracy 0.032181 NaN 0.324386 0.032181 NaN 0.324386 1 True 26
33 RandomForestGini_BAG_L1_FULL 0.745745 NaN balanced_accuracy 0.129952 0.109745 0.660056 0.129952 0.109745 0.660056 1 True 27
34 RandomForestGini_BAG_L1 0.745745 0.748194 balanced_accuracy 0.130939 0.109745 0.660056 0.130939 0.109745 0.660056 1 True 3
35 LightGBM_BAG_L1 0.745232 0.779696 balanced_accuracy 0.254917 0.043192 1.681311 0.254917 0.043192 1.681311 1 True 2
36 RandomForestEntr_BAG_L1 0.743132 0.756678 balanced_accuracy 0.128554 0.109414 0.627071 0.128554 0.109414 0.627071 1 True 4
37 RandomForestEntr_BAG_L1_FULL 0.743132 NaN balanced_accuracy 0.129848 0.109414 0.627071 0.129848 0.109414 0.627071 1 True 28
38 LightGBMLarge_BAG_L1_FULL 0.739355 NaN balanced_accuracy 0.045191 NaN 0.624610 0.045191 NaN 0.624610 1 True 35
39 NeuralNetFastAI_BAG_L2_FULL 0.736977 NaN balanced_accuracy 0.948412 NaN 7.029160 0.128401 NaN 0.344914 2 True 44
40 LightGBMLarge_BAG_L1 0.735966 0.746787 balanced_accuracy 0.383912 0.051593 2.595358 0.383912 0.051593 2.595358 1 True 11
41 NeuralNetFastAI_BAG_L2 0.731819 0.745212 balanced_accuracy 3.797984 1.036627 36.413861 0.996782 0.109811 1.728674 2 True 20
42 ExtraTreesGini_BAG_L1_FULL 0.731460 NaN balanced_accuracy 0.131895 0.112366 0.619383 0.131895 0.112366 0.619383 1 True 30
43 ExtraTreesGini_BAG_L1 0.731460 0.751491 balanced_accuracy 0.132619 0.112366 0.619383 0.132619 0.112366 0.619383 1 True 6
44 ExtraTreesEntr_BAG_L1_FULL 0.725517 NaN balanced_accuracy 0.131948 0.112544 0.620193 0.131948 0.112544 0.620193 1 True 31
45 ExtraTreesEntr_BAG_L1 0.725517 0.730553 balanced_accuracy 0.132374 0.112544 0.620193 0.132374 0.112544 0.620193 1 True 7
46 NeuralNetFastAI_BAG_L1 0.711150 0.716650 balanced_accuracy 0.991201 0.101023 5.307321 0.991201 0.101023 5.307321 1 True 8
47 NeuralNetFastAI_BAG_L1_FULL 0.708605 NaN balanced_accuracy 0.133773 NaN 0.450514 0.133773 NaN 0.450514 1 True 32

This adds the refit-full models to the leaderboard and we can opt to use any of them for prediction just like any other model. Note pred_time_test and pred_time_val list the time taken to produce predictions with each model (in seconds) on the test/validation data. Since the refit-full models were trained using all of the data, there is no internal validation score (score_val) available for them. You can also call refit_full() with non-bagged models to refit the same models to your full dataset (there won’t be memory/latency gains in this case but test accuracy may improve).

Model distillation

While computationally-favorable, single individual models will usually have lower accuracy than weighted/stacked/bagged ensembles. Model Distillation offers one way to retain the computational benefits of a single model, while enjoying some of the accuracy-boost that comes with ensembling. The idea is to train the individual model (which we can call the student) to mimic the predictions of the full stack ensemble (the teacher). Like refit_full(), the distill() function will produce additional models we can opt to use for prediction.

student_models = predictor.distill(time_limit=120)
predictor.leaderboard(test_data)
Distilling with teacher='WeightedEnsemble_L3_FULL', teacher_preds=soft, augment_method=spunge ...
SPUNGE: Augmenting training data with 4000 synthetic samples for distillation...
Distilling with each of these student models: ['LightGBM_DSTL', 'CatBoost_DSTL', 'RandomForestMSE_DSTL', 'NeuralNetTorch_DSTL']
Fitting 4 L1 models, fit_strategy="sequential" ...
Fitting model: LightGBM_DSTL ... Training model for up to 120.00s of the 120.00s of remaining time.
	Fitting with cpus=4, gpus=0, mem=0.1/21.8 GB
	Note: model has different eval_metric than default.
	-0.1114	 = Validation score   (-mean_squared_error)
	0.6s	 = Training   runtime
	0.0s	 = Validation runtime
Fitting model: CatBoost_DSTL ... Training model for up to 119.39s of the 119.39s of remaining time.
	Fitting with cpus=4, gpus=0
	Note: model has different eval_metric than default.
	-0.1077	 = Validation score   (-mean_squared_error)
	3.31s	 = Training   runtime
	0.01s	 = Validation runtime
Fitting model: RandomForestMSE_DSTL ... Training model for up to 116.06s of the 116.06s of remaining time.
	Fitting with cpus=8, gpus=0, mem=0.0/21.8 GB
	Note: model has different eval_metric than default.
	-0.1253	 = Validation score   (-mean_squared_error)
	1.07s	 = Training   runtime
	0.08s	 = Validation runtime
Fitting model: NeuralNetTorch_DSTL ... Training model for up to 114.86s of the 114.86s of remaining time.
	Fitting with cpus=4, gpus=0, mem=0.0/21.7 GB
	Note: model has different eval_metric than default.
	-0.1317	 = Validation score   (-mean_squared_error)
	6.43s	 = Training   runtime
	0.01s	 = Validation runtime
Distilling with each of these student models: ['WeightedEnsemble_L2_DSTL']
Fitting model: WeightedEnsemble_L2_DSTL ... Training model for up to 120.00s of the 108.41s of remaining time.
	Fitting 1 model on all data | Fitting with cpus=8, gpus=0, mem=0.0/21.7 GB
	Ensemble Weights: {'CatBoost_DSTL': 0.6, 'NeuralNetTorch_DSTL': 0.2, 'LightGBM_DSTL': 0.15, 'RandomForestMSE_DSTL': 0.05}
	Note: model has different eval_metric than default.
	-0.1052	 = Validation score   (-mean_squared_error)
	0.05s	 = Training   runtime
	0.0s	 = Validation runtime
Distilled model leaderboard:
                      model  score_val         eval_metric  pred_time_val   fit_time  pred_time_val_marginal  fit_time_marginal  stack_level  can_infer  fit_order
0             CatBoost_DSTL   0.763653  mean_squared_error       0.011402   3.309451                0.011402           3.309451            1       True         50
1  WeightedEnsemble_L2_DSTL   0.757731  mean_squared_error       0.108647  11.456110                0.000773           0.050496            2       True         53
2             LightGBM_DSTL   0.734768  mean_squared_error       0.003421   0.598240                0.003421           0.598240            1       True         49
3       NeuralNetTorch_DSTL   0.705356  mean_squared_error       0.011438   6.429616                0.011438           6.429616            1       True         52
4      RandomForestMSE_DSTL   0.698381  mean_squared_error       0.081613   1.068306                0.081613           1.068306            1       True         51
model score_test score_val eval_metric pred_time_test pred_time_val fit_time pred_time_test_marginal pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order
0 NeuralNetTorch_BAG_L2 0.782108 0.807145 balanced_accuracy 3.378675 1.103390 41.854969 0.576273 0.176574 7.169783 2 True 22
1 CatBoost_DSTL 0.774601 0.763653 mean_squared_error 0.021562 0.011402 3.309451 0.021562 0.011402 3.309451 1 True 50
2 CatBoost_BAG_L2_FULL 0.770853 NaN balanced_accuracy 0.838437 NaN 7.197465 0.019608 NaN 0.513218 2 True 41
3 WeightedEnsemble_L2 0.770005 0.814222 balanced_accuracy 0.525852 0.233257 22.499809 0.001776 0.001475 0.286859 2 True 12
4 NeuralNetTorch_BAG_L1_FULL 0.769426 NaN balanced_accuracy 0.048233 NaN 2.738576 0.048233 NaN 2.738576 1 True 34
5 NeuralNetTorch_BAG_L1 0.769406 0.813550 balanced_accuracy 0.377852 0.126418 16.979850 0.377852 0.126418 16.979850 1 True 10
6 WeightedEnsemble_L2_FULL 0.769344 NaN balanced_accuracy 0.067300 NaN 3.312262 0.001987 NaN 0.286859 2 True 36
7 NeuralNetTorch_BAG_L2_FULL 0.767483 NaN balanced_accuracy 0.893387 NaN 7.625997 0.074557 NaN 0.941750 2 True 46
8 LightGBMXT_BAG_L2_FULL 0.765892 NaN balanced_accuracy 0.856376 NaN 6.999865 0.037547 NaN 0.315619 2 True 37
9 ExtraTreesEntr_BAG_L2_FULL 0.764286 NaN balanced_accuracy 0.950312 NaN 7.303673 0.131483 0.110880 0.619427 2 True 43
10 LightGBMXT_BAG_L1_FULL 0.764170 NaN balanced_accuracy 0.037593 NaN 0.307283 0.037593 NaN 0.307283 1 True 25
11 RandomForestEntr_BAG_L2_FULL 0.763576 NaN balanced_accuracy 0.947747 NaN 7.316433 0.128918 0.109262 0.632187 2 True 40
12 CatBoost_BAG_L2 0.762368 0.813382 balanced_accuracy 2.949306 1.033091 42.922087 0.146904 0.106275 8.236901 2 True 17
13 ExtraTreesGini_BAG_L2_FULL 0.760925 NaN balanced_accuracy 0.951540 NaN 7.317538 0.132710 0.111510 0.633292 2 True 42
14 XGBoost_BAG_L2 0.760461 0.817477 balanced_accuracy 3.097850 1.001012 36.805544 0.295448 0.074196 2.120358 2 True 21
15 WeightedEnsemble_L2_DSTL 0.759986 0.757731 mean_squared_error 0.321119 0.108647 11.456110 0.002882 0.000773 0.050496 2 True 53
16 RandomForestGini_BAG_L2_FULL 0.759919 NaN balanced_accuracy 0.938727 NaN 7.316348 0.119898 0.108272 0.632102 2 True 39
17 XGBoost_BAG_L2_FULL 0.759349 NaN balanced_accuracy 0.854644 NaN 6.781680 0.035815 NaN 0.097434 2 True 45
18 ExtraTreesEntr_BAG_L2 0.758926 0.776399 balanced_accuracy 2.933756 1.037696 35.304613 0.131354 0.110880 0.619427 2 True 19
19 LightGBMXT_BAG_L1 0.758538 0.778898 balanced_accuracy 0.275527 0.049165 1.523896 0.275527 0.049165 1.523896 1 True 1
20 XGBoost_BAG_L1_FULL 0.758260 NaN balanced_accuracy 0.027487 NaN 0.049957 0.027487 NaN 0.049957 1 True 33
21 RandomForestEntr_BAG_L2 0.757599 0.786353 balanced_accuracy 2.930112 1.036078 35.317373 0.127710 0.109262 0.632187 2 True 16
22 LightGBM_BAG_L2 0.757110 0.819976 balanced_accuracy 3.093433 0.977384 36.901346 0.291031 0.050568 2.216160 2 True 14
23 WeightedEnsemble_L3 0.757110 0.819976 balanced_accuracy 3.094905 0.978837 37.290754 0.001472 0.001453 0.389407 3 True 24
24 RandomForestGini_BAG_L2 0.756827 0.792822 balanced_accuracy 2.931520 1.035088 35.317288 0.129119 0.108272 0.632102 2 True 15
25 XGBoost_BAG_L1 0.756678 0.784148 balanced_accuracy 0.234468 0.057585 1.433007 0.234468 0.057585 1.433007 1 True 9
26 LightGBMLarge_BAG_L2_FULL 0.755907 NaN balanced_accuracy 0.870235 NaN 7.543880 0.051406 NaN 0.859634 2 True 47
27 LightGBM_BAG_L2_FULL 0.755744 NaN balanced_accuracy 0.855892 NaN 7.049231 0.037063 NaN 0.364984 2 True 38
28 WeightedEnsemble_L3_FULL 0.755744 NaN balanced_accuracy 0.857552 NaN 7.438638 0.001659 NaN 0.389407 3 True 48
29 LightGBMXT_BAG_L2 0.755724 0.791415 balanced_accuracy 3.072057 0.980628 36.413105 0.269655 0.053812 1.727919 2 True 13
30 ExtraTreesGini_BAG_L2 0.755652 0.767977 balanced_accuracy 2.934782 1.038326 35.318478 0.132380 0.111510 0.633292 2 True 18
31 CatBoost_BAG_L1_FULL 0.755427 NaN balanced_accuracy 0.017081 NaN 0.286827 0.017081 NaN 0.286827 1 True 29
32 CatBoost_BAG_L1 0.754272 0.778604 balanced_accuracy 0.146224 0.105365 5.233099 0.146224 0.105365 5.233099 1 True 5
33 LightGBMLarge_BAG_L2 0.754013 0.813445 balanced_accuracy 3.285807 0.985655 38.359648 0.483406 0.058839 3.674462 2 True 23
34 LightGBM_BAG_L1_FULL 0.750874 NaN balanced_accuracy 0.032758 NaN 0.324386 0.032758 NaN 0.324386 1 True 26
35 LightGBM_DSTL 0.746766 0.734768 mean_squared_error 0.020338 0.003421 0.598240 0.020338 0.003421 0.598240 1 True 49
36 RandomForestGini_BAG_L1 0.745745 0.748194 balanced_accuracy 0.130061 0.109745 0.660056 0.130061 0.109745 0.660056 1 True 3
37 RandomForestGini_BAG_L1_FULL 0.745745 NaN balanced_accuracy 0.130922 0.109745 0.660056 0.130922 0.109745 0.660056 1 True 27
38 LightGBM_BAG_L1 0.745232 0.779696 balanced_accuracy 0.259497 0.043192 1.681311 0.259497 0.043192 1.681311 1 True 2
39 RandomForestEntr_BAG_L1 0.743132 0.756678 balanced_accuracy 0.129572 0.109414 0.627071 0.129572 0.109414 0.627071 1 True 4
40 RandomForestEntr_BAG_L1_FULL 0.743132 NaN balanced_accuracy 0.129909 0.109414 0.627071 0.129909 0.109414 0.627071 1 True 28
41 LightGBMLarge_BAG_L1_FULL 0.739355 NaN balanced_accuracy 0.045878 NaN 0.624610 0.045878 NaN 0.624610 1 True 35
42 NeuralNetFastAI_BAG_L2_FULL 0.736977 NaN balanced_accuracy 0.947285 NaN 7.029160 0.128456 NaN 0.344914 2 True 44
43 LightGBMLarge_BAG_L1 0.735966 0.746787 balanced_accuracy 0.387921 0.051593 2.595358 0.387921 0.051593 2.595358 1 True 11
44 NeuralNetFastAI_BAG_L2 0.731819 0.745212 balanced_accuracy 3.816771 1.036627 36.413861 1.014369 0.109811 1.728674 2 True 20
45 ExtraTreesGini_BAG_L1_FULL 0.731460 NaN balanced_accuracy 0.131707 0.112366 0.619383 0.131707 0.112366 0.619383 1 True 30
46 ExtraTreesGini_BAG_L1 0.731460 0.751491 balanced_accuracy 0.133513 0.112366 0.619383 0.133513 0.112366 0.619383 1 True 6
47 ExtraTreesEntr_BAG_L1 0.725517 0.730553 balanced_accuracy 0.133816 0.112544 0.620193 0.133816 0.112544 0.620193 1 True 7
48 ExtraTreesEntr_BAG_L1_FULL 0.725517 NaN balanced_accuracy 0.134561 0.112544 0.620193 0.134561 0.112544 0.620193 1 True 31
49 RandomForestMSE_DSTL 0.723782 0.698381 mean_squared_error 0.222430 0.081613 1.068306 0.222430 0.081613 1.068306 1 True 51
50 NeuralNetFastAI_BAG_L1 0.711150 0.716650 balanced_accuracy 0.981872 0.101023 5.307321 0.981872 0.101023 5.307321 1 True 8
51 NeuralNetFastAI_BAG_L1_FULL 0.708605 NaN balanced_accuracy 0.128581 NaN 0.450514 0.128581 NaN 0.450514 1 True 32
52 NeuralNetTorch_DSTL 0.706971 0.705356 mean_squared_error 0.053907 0.011438 6.429616 0.053907 0.011438 6.429616 1 True 52

While distillation might produce efficient models, we recommend first focusing on refit_full, infer_limit, and persist to try satisfying your requirements, as distillation may come with a significant accuracy drop.

Faster presets or hyperparameters

Instead of trying to speed up a cumbersome trained model at prediction time, if you know inference latency or memory will be an issue at the outset, then you can adjust the training process accordingly to ensure fit() does not produce unwieldy models.

One option is to specify more lightweight presets:

presets = ['good_quality', 'optimize_for_deployment']
predictor_light = TabularPredictor(label=label, eval_metric=metric).fit(train_data, presets=presets, time_limit=30)

You may also exclude specific unwieldy models from being trained at all. Below we exclude models that tend to be slower (K Nearest Neighbors, Neural Networks):

excluded_model_types = ['KNN', 'NN_TORCH']
predictor_light = TabularPredictor(label=label, eval_metric=metric).fit(train_data, excluded_model_types=excluded_model_types, time_limit=30)

(Advanced) Cache preprocessed data

If you are repeatedly predicting on the same data you can cache the preprocessed version of the data and directly send the preprocessed data to predictor.predict for faster inference:

test_data_preprocessed = predictor.transform_features(test_data)

# The following call will be faster than a normal predict call because we are skipping the preprocessing stage.
predictions = predictor.predict(test_data_preprocessed, transform_features=False)

Note that this is only useful in situations where you are repeatedly predicting on the same data. If this significantly speeds up your use-case, consider whether your current approach makes sense or if a cache on the predictions is a better solution.

(Advanced) Disable preprocessing

If you would rather do data preprocessing outside of TabularPredictor, you can disable TabularPredictor’s preprocessing entirely via:

predictor.fit(..., feature_generator=None, feature_metadata=YOUR_CUSTOM_FEATURE_METADATA)

Be warned that this removes ALL guardrails on data sanitization. It is very likely that you will run into errors doing this unless you are very familiar with AutoGluon.

One instance where this can be helpful is if you have many problems that re-use the exact same data with the exact same features. If you had 30 tasks that re-use the same features, you could fit a autogluon.features feature generator once on the data, and then when you need to predict on the 30 tasks, preprocess the data only once and then send the preprocessed data to all 30 predictors.

If you encounter memory issues

To reduce memory usage during training, you may try each of the following strategies individually or combinations of them (these may harm accuracy):

  • In fit(), set excluded_model_types = ['KNN', 'XT' ,'RF'] (or some subset of these models).

  • Try different presets in fit().

  • Text fields in your table require substantial memory for N-gram featurization. To mitigate this in fit(), you can either: (1) add 'ignore_text' to your presets list (to ignore text features), or (2) specify the argument:

from sklearn.feature_extraction.text import CountVectorizer
from autogluon.features.generators import AutoMLPipelineFeatureGenerator
MAX_NGRAM = 1000
feature_generator = AutoMLPipelineFeatureGenerator(vectorizer=CountVectorizer(min_df=30, ngram_range=(1, 3), max_features=MAX_NGRAM, dtype=np.uint8))
predictor = TabularPredictor(...).fit(..., feature_generator=feature_generator)

For example using MAX_NGRAM = 1000 (try various values under 10000 to reduce the number of N-gram features used to represent each text field)

In addition to reducing memory usage, many of the above strategies can also be used to reduce training times.

To reduce memory usage during inference:

  • If trying to produce predictions for a large test dataset, break the test data into smaller chunks as demonstrated in FAQ.

  • If models have been previously persisted in memory but inference-speed is not a major concern, call predictor.unpersist().

  • If models have been previously persisted in memory, bagging was used in fit(), and inference-speed is a concern: call predictor.refit_full() and use one of the refit-full models for prediction (ensure this is the only model persisted in memory).

If you encounter disk space issues

To reduce disk usage, you may try each of the following strategies individually or combinations of them:

  • Make sure to delete all predictor.path folders from previous fit() runs! These can eat up your free space if you call fit() many times. If you didn’t specify path, AutoGluon still automatically saved its models to a folder called: “AutogluonModels/ag-[TIMESTAMP]”, where TIMESTAMP records when fit() was called, so make sure to also delete these folders if you run low on free space.

  • Call predictor.save_space() to delete auxiliary files produced during fit().

  • Call predictor.delete_models(models_to_keep='best') if you only intend to use this predictor for inference going forward (will delete files required for non-prediction-related functionality like fit_summary).

  • In fit(), you can add 'optimize_for_deployment' to the presets list, which will automatically invoke the previous two strategies after training.

  • Most of the above strategies to reduce memory usage will also reduce disk usage (but may harm accuracy).

References

The following paper describes how AutoGluon internally operates on tabular data:

Erickson et al. AutoGluon-Tabular: Robust and Accurate AutoML for Structured Data. Arxiv, 2020.

Next Steps

If you are interested in deployment optimization, refer to the Predicting Columns in a Table - Deployment Optimization tutorial.