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 |
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') | |
# tune hyperparameters of decision tree |
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 adaboost model | |
adaboost = create_model('ada') | |
# AUC plot |
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 logistic regression model | |
lr = create_model('lr') #lr is the id of the model | |
# check the model library to see all models |
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') | |
# return best model | |
best = compare_models() | |
# return best model based on Recall |
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
predict_model(xgboost, probability_threshold=0.2) |
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
# Importing dataset | |
from pycaret.datasets import get_data | |
credit = get_data('credit') | |
# Importing module and initializing setup | |
from pycaret.classification import * | |
clf1 = setup(data = credit, target = 'default') | |
# create a model | |
xgboost = create_model('xgboost') |
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
tuned_lda = tune_model(model='lda', supervised_target='status', estimator='xgboost') |
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
#tune with default n_iter i.e. 10 | |
tuned_dt1 = tune_model('dt') | |
#tune with n_iter = 50 | |
tuned_dt2 = tune_model('dt', n_iter = 50) |
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 regression module | |
from pycaret.regression import * | |
# init setup | |
reg1 = setup(data, target = 'charges', silent=True, | |
categorical_features=['sex', 'smoker', 'region', 'children'], | |
numeric_features=['age', 'bmi']) |