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 408 1
Python PyCaret How to optimize the probability threshold % in binary classification 2051 0
Python K-means Predicting Iris Flower Species 1307 2
Python PyCaret How to ignore certain columns for model building 2470 0
Python PyCaret Experiment Logging 660 0
Python PyWin32 Open a File in Excel 851 0
Python Guppy GSL Introduction 216 2
Python Usage of Guppy With Example 1084 2
Python Naive Bayes Tutorial 540 2
Python Guppy Recent Memory Usage of a Program 885 2
Introduction to AdaBoost 282 1
Python AdaBoost Implementation of AdaBoost 506 1
Python AdaBoost Advantages and Disadvantages of AdaBoost 3643 1
Python K-Means Clustering Applications 317 2
Python Random Forest Algorithm Decision Trees 432 0
Python K-means Clustering PREDICTING IRIS FLOWER SPECIES 450 1
Python Random Forest Algorithm Bootstrap 466 0
Python PyCaret Util Functions 434 0
Python K-means Music Genre Classification 1735 1
Python PyWin Attach an Excel file to Outlook 1520 0
Python Guppy GSL Document and Test Example 243 2
Python Random Forest Algorithm Bagging 379 0
Python AdaBoost An Example of How AdaBoost Works 270 1
Python PyWin32 Getting Started PyWin32 594 0
Python Naive Bayes in Machine Learning 369 2
Python PyCaret How to improve results from hyperparameter tuning by increasing "n_iter" 1714 0
Python PyCaret Getting Started with PyCaret 2.0 343 1
Python PyCaret Tune Model 1238 1
Python PyCaret Create your own AutoML software 312 0
Python PyCaret Intoduction to PyCaret 288 1
Python PyCaret Compare Models 2671 1
Python PyWin Copying Data into Excel 1137 0
Python Guppy Error: expected function body after function declarator 401 2
Python Coding Random forest classifier using xgBoost 232 0
Python PyCaret How to tune "n parameter" in unsupervised experiments 638 0
Python PyCaret How to programmatically define data types in the setup function 1389 0
Python PyCaret Ensemble Model 796 1
Python Random forest algorithm Introduction 218 0
Python k-means Clustering Example 329 1
Python PyCaret Plot Model 1227 1
Python Hamming Distance 701 0
Python Understanding Random forest algorithm 305 0
Python PyCaret Sort a Dictionary by Keys 238 0
Python Coding Random forest classifier using sklearn 331 0
Python Guppy Introduction 361 2
Python How to use Guppy/Heapy for tracking down Memory Usage 1061 2
Python AdaBoost Summary and Conclusion 228 1
Python PyCaret Create Model 355 1
Python k -means Clusturing Introduction 316 2
Python k-means Clustering With Example 344 2

Comments