Python PyCaret Compare Models














































Python PyCaret Compare Models




 Compare Models-PyCaret

 
This is the first step we recommend in any supervised machine learning task. This function trains all the models in the model library using default hyperparameters and evaluates performance metrics using cross validation. It returns the trained model object class. The evaluation metrics used are:

  • For Classification: Accuracy, AUC, Recall, Precision, F1, Kappa, MCC
  • For Regression: MAE, MSE, RMSE, R2, RMSLE, MAPE

Here are few ways you can use compare_models function:

# 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
best = compare_models(sort = 'Recall') #default is 'Accuracy'
# compare specific models
best_specific = compare_models(whitelist = ['dt','rf','xgboost'])
# blacklist certain models
best_specific = compare_models(blacklist = ['catboost','svm'])
# return top 3 models based on Accuracy
top3 = compare_models(n_select = 3)

Sample Output:

Figure

Sample output from compare_models function

In the next article, we'll see how to train model using Create Model Function.
Until then ,Happy Pythoning....!!


More Articles of Aditi Kothiyal:

Name Views Likes
Python AdaBoost Mathematics Behind AdaBoost 435 1
Python PyCaret How to optimize the probability threshold % in binary classification 2097 0
Python K-means Predicting Iris Flower Species 1349 2
Python PyCaret How to ignore certain columns for model building 2865 0
Python PyCaret Experiment Logging 710 0
Python PyWin32 Open a File in Excel 970 0
Python Guppy GSL Introduction 234 2
Python Usage of Guppy With Example 1122 2
Python Naive Bayes Tutorial 562 2
Python Guppy Recent Memory Usage of a Program 911 2
Introduction to AdaBoost 311 1
Python AdaBoost Implementation of AdaBoost 522 1
Python AdaBoost Advantages and Disadvantages of AdaBoost 3772 1
Python K-Means Clustering Applications 353 2
Python Random Forest Algorithm Decision Trees 458 0
Python K-means Clustering PREDICTING IRIS FLOWER SPECIES 474 1
Python Random Forest Algorithm Bootstrap 509 0
Python PyCaret Util Functions 462 0
Python K-means Music Genre Classification 1800 1
Python PyWin Attach an Excel file to Outlook 1562 0
Python Guppy GSL Document and Test Example 262 2
Python Random Forest Algorithm Bagging 405 0
Python AdaBoost An Example of How AdaBoost Works 299 1
Python PyWin32 Getting Started PyWin32 623 0
Python Naive Bayes in Machine Learning 386 2
Python PyCaret How to improve results from hyperparameter tuning by increasing "n_iter" 1749 0
Python PyCaret Getting Started with PyCaret 2.0 369 1
Python PyCaret Tune Model 1386 1
Python PyCaret Create your own AutoML software 340 0
Python PyCaret Intoduction to PyCaret 308 1
Python PyCaret Compare Models 2737 1
Python PyWin Copying Data into Excel 1171 0
Python Guppy Error: expected function body after function declarator 424 2
Python Coding Random forest classifier using xgBoost 257 0
Python PyCaret How to tune "n parameter" in unsupervised experiments 681 0
Python PyCaret How to programmatically define data types in the setup function 1426 0
Python PyCaret Ensemble Model 824 1
Python Random forest algorithm Introduction 238 0
Python k-means Clustering Example 352 1
Python PyCaret Plot Model 1268 1
Python Hamming Distance 735 0
Python Understanding Random forest algorithm 320 0
Python PyCaret Sort a Dictionary by Keys 257 0
Python Coding Random forest classifier using sklearn 353 0
Python Guppy Introduction 380 2
Python How to use Guppy/Heapy for tracking down Memory Usage 1089 2
Python AdaBoost Summary and Conclusion 246 1
Python PyCaret Create Model 378 1
Python k -means Clusturing Introduction 338 2
Python k-means Clustering With Example 364 2

Comments