Skip to content

Instantly share code, notes, and snippets.

@pycaret
Last active August 1, 2020 14:13
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 pycaret/14d287cb672f4ea8f40e0d51f5122e30 to your computer and use it in GitHub Desktop.
Save pycaret/14d287cb672f4ea8f40e0d51f5122e30 to your computer and use it in GitHub Desktop.
# select and finalize the best model in the active run
best_model = automl() #returns the best model based on CV score
# select and finalize the best model based on 'F1' on hold_out set
best_model_holdout = automl(optimize = 'F1', use_holdout = True)
# save model
save_model(model, 'c:/path-to-directory/model-name')
# load model
model = load_model('c:/path-to-directory/model-name')
# retrieve score grid as pandas df
dt = create_model('dt')
dt_results = pull() #this will store dt score grid as pandas df
# get global environment variable
X_train = get_config('X_train') #returns X_train dataset after preprocessing
seed = get_config('seed') returns seed from global environment
# set global environment variable
set_seed(seed, 999) #seed set to 999 in global environment of active run
# get experiment logs as csv file
logs = get_logs() #for active run by default
# get system logs for audit
system_logs = get_system_logs() #read logs.log file from active directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment