Tune Model function tunes the hyperparameter of the model passed as an estimator. It uses Random grid search with pre-defined tuning grids that are fully customizable. Here are few ways you can use this function:
# import classification module
frompycaret.classificationimport*
# init setup
clf1=setup(data, target='name-of-target')
# train a decision tree model
dt=create_model('dt')
# tune hyperparameters of decision tree
tuned_dt=tune_model(dt)
# tune hyperparameters with increased n_iter
tuned_dt=tune_model(dt, n_iter=50)
# tune hyperparameters to optimize AUC
tuned_dt=tune_model(dt, optimize='AUC') #default is 'Accuracy'
Comments