PyCaret — The easy ML library

Sharon Abishek
featurepreneur
Published in
3 min readAug 8, 2021

PyCaret is an open source machine learning library in Python to train and deploy supervised and unsupervised machine learning models in a low-code environment. It can be used to perform complex machine learning tasks with only a few lines of code.

The name Caret is short for Classification And REgression Training. It is commendable for its ease of use and efficiency. In comparison with the other open source machine learning libraries, PyCaret is an alternate low-code library. It helps beginners as well as professional data scientists perform end-to-end machine learning experiments.

Compare Models

This is one of the most useful functions of the PyCaret library. If you do not want to try the different models one by one, you can use the compare models function and it will train and compare the common evaluation metrics for all the available models in the library of the module you have imported.

  • compare_models function — trains all the models in the model library using default hyper parameters and evaluates performance metrics using cross-validation. Metrics used for classification: Accuracy, AUC, Recall, Precision, F1, Kappa, MCC. Metrics used for regression: MAE, MSE, RMSE, R2, RMSLE, MAPE.

Experiment Logging

PyCaret embeds the MLflow tracking component as a backend API and UI for logging parameters, code versions, metrics, and output files when running the machine learning code and for visualizing the results.

Hyperparameter Tuning

PyCaret comes with a lot of flexibility. For example, we can define the number of folds using the fold parameter within the tune_model function. Or one can control the total number of evaluations via the n_iter argument. The function takes an instance of the model to tune as input and knows what hyper parameters to tune automatically.

Evaluate Models

If we do not want to plot all visualizations individually to understand and evaluate the performance, then the PyCaret library has another stunning function — evaluate_model. In this function, one just need to pass the model object and PyCaret will create an interactive window to visualize and analyze the model in all the possible ways

  • evaluate_model — used to evaluate the performance of the trained machine learning model.

PyCaret lets us create machine learning models quickly and easily, making it an ideal choice for beginners than other libraries like scikit-learn. Furthermore, PyCaret can also be used by experienced data scientists to help build rapid prototypes quickly and efficiently.

Thanks for reading.

Reach out to me on Linkedin at

https://www.linkedin.com/in/sharon-abishek-608a361a6/

--

--

Sharon Abishek
featurepreneur

Trainee Decision Scientist @ Mu Sigma. Data enthusiast and an Electronics engineer.