{"id":60,"date":"2020-08-04T12:06:26","date_gmt":"2020-08-04T12:06:26","guid":{"rendered":"https:\/\/data-science.gotoauthority.com\/2020\/08\/04\/announcing-pycaret-2-0\/"},"modified":"2020-08-04T12:06:26","modified_gmt":"2020-08-04T12:06:26","slug":"announcing-pycaret-2-0","status":"publish","type":"post","link":"https:\/\/wealthrevelation.com\/data-science\/2020\/08\/04\/announcing-pycaret-2-0\/","title":{"rendered":"Announcing PyCaret 2.0"},"content":{"rendered":"<div id=\"post-\">\n<p><b>By <a href=\"https:\/\/www.linkedin.com\/in\/profile-moez\/\" target=\"_blank\" rel=\"noopener noreferrer\">Moez Ali<\/a>, Founder &amp; Author of PyCaret<\/b><\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/797\/1*oT-VYfpNDeKJ1L9vkpESdw.png\" alt=\"Figure\" width=\"100%\"><br \/><span><\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"tW3QorKwkC\"><p><a href=\"https:\/\/pycaret.org\/\">Home<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Home&#8221; &#8212; PyCaret\" src=\"https:\/\/pycaret.org\/embed\/#?secret=tW3QorKwkC\" data-secret=\"tW3QorKwkC\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<p>We are excited to announce the second release of PyCaret <del datetime=\"2020-08-03T11:44:49+00:00\">today<\/del> recently.<\/p>\n<p>PyCaret is an open source,\u00a0<strong>low-code<\/strong>\u00a0machine learning library in Python that automates machine learning workflow. It is an end-to-end machine learning and model management tool that speeds up machine learning experiment cycle and makes you more productive.<\/p>\n<p>In comparison with the other open source machine learning libraries, PyCaret is an alternate low-code library that can be used to replace hundreds of lines of code with few words only. This makes experiments exponentially fast and efficient.<\/p>\n<p>See detailed\u00a0<a href=\"https:\/\/github.com\/pycaret\/pycaret\/releases\/tag\/2.0\" rel=\"noopener noreferrer\" target=\"_blank\">release notes<\/a>\u00a0for PyCaret 2.0.<\/p>\n<p>\u00a0<\/p>\n<h3><strong>Why use PyCaret?<\/strong><\/h3>\n<p>\u00a0<\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/775\/1*wT0m1kx8WjY_P7hrM6KDbA.png\" alt=\"Figure\" width=\"100%\"><br \/><span><\/p>\n<p>PyCaret 2.0 Features<\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<h3>Installing PyCaret 2.0<\/h3>\n<p>\u00a0<br \/>Installing PyCaret is very easy and takes only a few minutes. We strongly recommend using virtual environment to avoid potential conflict with other libraries. See the following example code to create a\u00a0<strong><em>conda<\/em><\/strong>\u00a0<strong><em>environment\u00a0<\/em><\/strong>and install pycaret within that conda environment:<\/p>\n<div>\n<pre><code><strong># create a conda environment <\/strong>\r\nconda create --name yourenvname python=3.6  <strong># activate environment <\/strong>\r\nconda activate yourenvname  <strong># install pycaret <\/strong>\r\npip install <strong>pycaret==2.0  <\/strong><strong># create notebook kernel linked with the conda environment python -m <\/strong>ipykernel install --user --name yourenvname --display-name \"display-name\"<\/code><\/pre>\n<\/div>\n<p>If you are using Azure notebooks or Google Colab, run the following code to install PyCaret.<\/p>\n<div>\n<pre><code>!pip install <strong>pycaret==2.0<\/strong><\/code><\/pre>\n<\/div>\n<p>All hard dependencies are automatically installed when you install PyCaret using pip.\u00a0<a href=\"https:\/\/github.com\/pycaret\/pycaret\/blob\/master\/requirements.txt\" rel=\"noopener noreferrer\" target=\"_blank\">Click here<\/a>\u00a0to see the complete list of dependencies.<\/p>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49 Getting Started with PyCaret 2.0<\/h3>\n<p>\u00a0<br \/>The first step of any machine learning experiment in PyCaret is to set up an environment by importing the relevant module and initialize the\u00a0<strong>setup function\u00a0<\/strong>by passing dataframe and name of the target variable. See example code:<\/p>\n<p><strong>Sample Output:<\/strong><\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/248\/1*di8zOe7rN7kWHO8t-6C6hg.png\" alt=\"Figure\" width=\"60%\"><br \/><span><\/p>\n<p>Output is truncated<\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<p>All the preprocessing transformations are applied within\u00a0<strong>setup function.\u00a0<\/strong>PyCaret provides over 20 different pre-processing transformation that can be defined within setup function.\u00a0<a href=\"https:\/\/www.pycaret.org\/preprocessing\" rel=\"noopener noreferrer\" target=\"_blank\">Click here<\/a>\u00a0to learn more about PyCaret\u2019s preprocessing abilities.<\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/577\/1*EcfstE4cOIhazduR4iUX0w.png\" alt=\"Figure\" width=\"100%\"><br \/><span><\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"s4lLFHEzDK\"><p><a href=\"https:\/\/pycaret.org\/preprocessing\/\">Preprocessing<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Preprocessing&#8221; &#8212; PyCaret\" src=\"https:\/\/pycaret.org\/preprocessing\/embed\/#?secret=s4lLFHEzDK\" data-secret=\"s4lLFHEzDK\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49\u00a0<strong>Compare Models<\/strong><br \/>\n<\/h3>\n<p>\u00a0<br \/>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:<\/p>\n<ul>\n<li>\n<strong>For Classification:\u00a0<\/strong>Accuracy, AUC, Recall, Precision, F1, Kappa, MCC\n<\/li>\n<li>\n<strong>For Regression:\u00a0<\/strong>MAE, MSE, RMSE, R2, RMSLE, MAPE\n<\/li>\n<\/ul>\n<p>Here are few ways you can use\u00a0<strong>compare_models<\/strong>\u00a0function:<\/p>\n<p><strong>Sample Output:<\/strong><\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/600\/1*gUjKx0cQbpaWl226CzAdyw.png\" alt=\"Figure\" width=\"100%\"><br \/><span><\/p>\n<p>Sample output from compare_models function<\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49\u00a0<strong>Create Model<\/strong><br \/>\n<\/h3>\n<p>\u00a0<br \/>Create Model function trains a model using default hyperparameters and evaluates performance metrics using cross validation. This function is base to almost all other functions in PyCaret. It returns the trained model object class. Here are few ways you can use this function:<\/p>\n<p><strong>Sample Output:<\/strong><\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/391\/1*NDwHzljCyqQpkH55ogHzTA.png\" alt=\"Figure\" width=\"100%\"><br \/><span><\/p>\n<p>Sample output from create_model function<\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<p>To learn more about\u00a0<strong>create model<\/strong>\u00a0function,\u00a0<a href=\"https:\/\/www.pycaret.org\/create-model\" rel=\"noopener noreferrer\" target=\"_blank\">click here<\/a>.<\/p>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49 Tune Model<\/h3>\n<p>\u00a0<br \/>Tune Model function tunes the hyperparameter of the model passed as an estimator. It uses Random grid search with pre-defined tuning grids that are fully customizable. Here are few ways you can use this function:<\/p>\n<p>To learn more about\u00a0<strong>tune model<\/strong>\u00a0function,\u00a0<a href=\"https:\/\/www.pycaret.org\/tune-model\" rel=\"noopener noreferrer\" target=\"_blank\">click here<\/a>.<\/p>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49 Ensemble Model<\/h3>\n<p>\u00a0<br \/>There are few functions available to ensemble base learners.\u00a0<strong>ensemble_model<\/strong>,\u00a0<strong>blend_models\u00a0<\/strong>and\u00a0<strong>stack_models\u00a0<\/strong>are three of them. Here are few ways you can use this function:<\/p>\n<p>To learn more about ensemble models in PyCaret,\u00a0<a href=\"https:\/\/www.pycaret.org\/ensemble-model\" rel=\"noopener noreferrer\" target=\"_blank\">click here<\/a>.<\/p>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49 Predict Model<\/h3>\n<p>\u00a0<br \/>As the name suggests, this function is used for inference \/ prediction. Here is how you can use it:<\/p>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49 Plot Model<\/h3>\n<p>\u00a0<br \/>Plot Model function is used to evaluate performance of the trained machine learning model. Here is an example:<\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/656\/1*Do2ho2O_fg8w62VPuwVm7g.png\" alt=\"Figure\" width=\"100%\"><br \/><span><\/p>\n<p>Sample output from plot_model function<\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<p><a href=\"https:\/\/www.pycaret.org\/plot-model\" rel=\"noopener noreferrer\" target=\"_blank\">Click here<\/a>\u00a0to learn more about different visualization in PyCaret.<\/p>\n<p>Alternatively, you can use\u00a0<strong>evaluate_model\u00a0<\/strong>function to see plots\u00a0<em>via\u00a0<\/em>the user interface within notebook.<\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/960\/1*AGsJlbX6bhCOG2r_uhvkKg.gif\" alt=\"Figure\" width=\"100%\"><br \/><span><\/p>\n<p>evaluate_model function in PyCaret<\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49 Util functions<\/h3>\n<p>\u00a0<br \/>PyCaret 2.0 includes several new util functions that comes handy when managing your machine learning experiments with PyCaret. Some of them are shown below:<\/p>\n<p>To see all new functions implemented in PyCaret 2.0, See\u00a0<a href=\"https:\/\/github.com\/pycaret\/pycaret\/releases\/tag\/2.0\" rel=\"noopener noreferrer\" target=\"_blank\">release notes<\/a>.<\/p>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49 Experiment Logging<\/h3>\n<p>\u00a0<br \/>PyCaret 2.0 embeds MLflow tracking component as a backend API and UI for logging parameters, code versions, metrics, and output files when running your machine learning code and for later visualizing the results. Here is how you can log your experiment in PyCaret.<\/p>\n<p><strong>Output (on localhost:5000)<\/strong><\/p>\n<div>\n<img src=\"https:\/\/miro.medium.com\/max\/1421\/1*Z_08utFByIK_9nsps3rctA.png\" alt=\"Figure\" width=\"100%\"><br \/><span><\/p>\n<p>https:\/\/localhost:5000<\/p>\n<p><\/span>\n<\/div>\n<p>\u00a0<\/p>\n<h3>\ud83d\udc49 Putting it all together \u2014 Create your own AutoML software<\/h3>\n<p>\u00a0<br \/>Using all the functions, let\u2019s create a simple command line software that will train multiple models with default parameters, tune hyperparameters of top candidate models, try different ensembling techniques and returns \/ saves the best model. Here is the command line script:<\/p>\n<p>This script will dynamically select and saves the best model. In just few lines of code you have developed your own Auto ML software with a full fledged logging system and even a UI presenting beautiful leaderboard.<br \/>There is no limit to what you can achieve using the light weight workflow automation library in Python. If you find this useful, please do not forget to give us \u2b50\ufe0f on our github repo if you like PyCaret.<\/p>\n<p>To hear more about PyCaret follow us on\u00a0<a href=\"https:\/\/www.linkedin.com\/company\/pycaret\/\" rel=\"noopener noreferrer\" target=\"_blank\">LinkedIn<\/a>\u00a0and\u00a0<a href=\"https:\/\/www.youtube.com\/channel\/UCxA1YTYJ9BEeo50lxyI_B3g\" rel=\"noopener noreferrer\" target=\"_blank\">Youtube<\/a>.<\/p>\n<p>\u00a0<\/p>\n<h3>Important Links<\/h3>\n<p>\u00a0<br \/><a href=\"https:\/\/github.com\/pycaret\/pycaret\/releases\/tag\/2.0\" rel=\"noopener noreferrer\" target=\"_blank\">Release Notes for PyCaret 2.0<\/a><br \/><a href=\"https:\/\/www.pycaret.org\/guide\" rel=\"noopener noreferrer\" target=\"_blank\">User Guide \/ Documentation<\/a><a href=\"https:\/\/github.com\/pycaret\/pycaret\/releases\/tag\/2.0\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/><\/a><a href=\"http:\/\/www.github.com\/pycaret\/pycaret\" rel=\"noopener noreferrer\" target=\"_blank\">Github<\/a><br \/><a href=\"https:\/\/www.pycaret.org\/install\" rel=\"noopener noreferrer\" target=\"_blank\">Install PyCaret<\/a><br \/><a href=\"https:\/\/www.pycaret.org\/tutorial\" rel=\"noopener noreferrer\" target=\"_blank\">Notebook Tutorials<\/a><br \/><a href=\"https:\/\/www.pycaret.org\/contribute\" rel=\"noopener noreferrer\" target=\"_blank\">Contribute in PyCaret<\/a><\/p>\n<p>\u00a0<\/p>\n<h3>Want to learn about a specific module?<\/h3>\n<p>\u00a0<br \/>Click on the links below to see the documentation and working examples.<\/p>\n<p><a href=\"https:\/\/www.pycaret.org\/classification\" rel=\"noopener noreferrer\" target=\"_blank\">Classification<\/a><br \/><a href=\"https:\/\/www.pycaret.org\/regression\" rel=\"noopener noreferrer\" target=\"_blank\">Regression<br \/><\/a><a href=\"https:\/\/www.pycaret.org\/clustering\" rel=\"noopener noreferrer\" target=\"_blank\">Clustering<\/a><br \/><a href=\"https:\/\/www.pycaret.org\/anomaly-detection\" rel=\"noopener noreferrer\" target=\"_blank\">Anomaly Detection<br \/><\/a><a href=\"https:\/\/www.pycaret.org\/nlp\" rel=\"noopener noreferrer\" target=\"_blank\">Natural Language Processing<\/a><br \/><a href=\"https:\/\/www.pycaret.org\/association-rules\" rel=\"noopener noreferrer\" target=\"_blank\">Association Rule Mining<\/a><\/p>\n<p>\u00a0<br \/><b>Bio: <a href=\"https:\/\/www.linkedin.com\/in\/profile-moez\/\" target=\"_blank\" rel=\"noopener noreferrer\">Moez Ali<\/a><\/b> is a Data Scientist, and is Founder &amp; Author of PyCaret.<\/p>\n<p><a href=\"https:\/\/towardsdatascience.com\/announcing-pycaret-2-0-39c11014540e\" target=\"_blank\" rel=\"noopener noreferrer\">Original<\/a>. Reposted with permission.<\/p>\n<p><b>Related:<\/b><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/www.kdnuggets.com\/2020\/08\/announcing-pycaret-2.html<\/p>\n","protected":false},"author":0,"featured_media":61,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts\/60"}],"collection":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":0,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/media\/61"}],"wp:attachment":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}