Skip to content

Instantly share code, notes, and snippets.

@pycaret
Last active August 2, 2020 09:47
Show Gist options
  • Save pycaret/78c3ce61c9ef47635a4fd78215c7fae1 to your computer and use it in GitHub Desktop.
Save pycaret/78c3ce61c9ef47635a4fd78215c7fae1 to your computer and use it in GitHub Desktop.
# 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
models()
# train rf model using 5 fold CV
rf = create_model('rf', fold = 5)
# train svm model without CV
svm = create_model('svm', cross_validation = False)
# train xgboost model with max_depth = 10
xgboost = create_model('xgboost', max_depth = 10)
# train xgboost model on gpu
xgboost_gpu = create_model('xgboost', tree_method = 'gpu_hist', gpu_id = 0) #0 is gpu-id
# train multiple lightgbm models with n learning_rate
lgbms = [create_model('lightgbm', learning_rate = i) for i in np.arange(0.1,1,0.1)]
# train custom model
from gplearn.genetic import SymbolicClassifier
symclf = SymbolicClassifier(generation = 50)
sc = create_model(symclf)
@BV-RaviKiran
Copy link

how can e resolve this

TypeError Traceback (most recent call last)
in
28 # train custom model
29 from gplearn.genetic import SymbolicClassifier
---> 30 symclf = SymbolicClassifier(generation = 50)
31 sc = create_model(symclf)

TypeError: init() got an unexpected keyword argument 'generation'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment