Last active
September 2, 2022 01:19
-
-
Save pycaret/e21f838a26923856db896df10cc3c7e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import classification module | |
from pycaret.classification import * | |
# init setup | |
clf1 = setup(data, target = 'name-of-target') | |
# train a decision tree model | |
dt = create_model('dt') | |
# train a bagging classifier on dt | |
bagged_dt = ensemble_model(dt, method = 'Bagging') | |
# train a adaboost classifier on dt with 100 estimators | |
boosted_dt = ensemble_model(dt, method = 'Boosting', n_estimators = 100) | |
# train a votingclassifier on all models in library | |
blender = blend_models() | |
# train a voting classifier on specific models | |
dt = create_model('dt') | |
rf = create_model('rf') | |
adaboost = create_model('ada') | |
blender_specific = blend_models(estimator_list = [dt,rf,adaboost], method = 'soft') | |
# train a voting classifier dynamically | |
blender_top5 = blend_models(compare_models(n_select = 5)) | |
# train a stacking classifier | |
stacker = stack_models(estimator_list = [dt,rf], meta_model = adaboost) | |
# stack multiple models dynamically | |
top7 = compare_models(n_select = 7) | |
stacker = stack_models(estimator_list = top7[1:], meta_model = top7[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment