Optimize
Optimization functions in PyCaret
tune_model
Example
# load dataset
from pycaret.datasets import get_data
boston = get_data('boston')
# init setup
from pycaret.regression import *
reg1 = setup(data = boston, target = 'medv')
# train model
dt = create_model('dt')
# tune model
tuned_dt = tune_model(dt)

Increasing the iteration

Comparison of 10 and 50 iterations


Choosing the metric

Passing custom grid

Changing the search algorithm




Access the tuner



Automatically choose better

ensemble_model
Example


Changing the fold param

Method: Bagging

Method: Boosting

Choosing the method


Increasing the estimators

Automatically choose better

blend_models
Example


Changing the fold param

Dynamic input estimators


Changing the method


Changing the weights



Automatically choose better

stack_models
Example

Changing the fold param

Dynamic input estimators


Changing the method

Changing the meta-model


Restacking

optimize_threshold
Example


calibrate_model
Example


Before and after calibration


Last updated
Was this helpful?