Skip to content

Instantly share code, notes, and snippets.

@3catz
Last active November 5, 2020 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3catz/b883b5bb1f9433d51e8abca23d1e4e7f to your computer and use it in GitHub Desktop.
Save 3catz/b883b5bb1f9433d51e8abca23d1e4e7f to your computer and use it in GitHub Desktop.
Using Pycaret library for autoML
from pycaret.datasets import get_data
from pycaret.classification import *
report["Scores"] = np.round(report["Scores"], 3)
report.sort_values(by = "Scores", ascending = False, inplace = True)
#report.index
ga_feats = report.iloc[0]["Chosen Feats"]
ename = setup(data = D[used_feats], target = "DEATH_EVENT",
test_data = None,
fold_strategy = "stratifiedkfold",
fold_shuffle = True,
use_gpu = True,
normalize = True,
categorical_features = None,
#pca = True,
#pca_method = "kernel",
#pca_components = 5,
preprocess = False,
html = True,
#POLYNOMIAL
#polynomial_features = True,
#polynomial_degree = 2,
#transformation
#transformation = True,
#feature_selection = True,
feature_interaction = True,
fix_imbalance = True,
#fix_imbalance_method = imblearn.over_sampling.SMOTE(),
imputation_type='simple',
verbose = True,
)
rskf = RepeatedStratifiedKFold(n_splits = 5, n_repeats = 20)
best_model = compare_models(sort = "MCC", round = 2,
fold = rskf,
#include = ["rf","catboost"],
#n_select = 1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment