Stack model, plot model, evaluate model functions in PyCaret

In this recipe, we shall see what are stack models plot model and evaluate model functions in the classification model in PyCaret.

Recipe Objective - What are stack_models, plot_model, and evaluate_model functions in the classification model in PyCaret?

PyCaret provides stack_models, plot_model and evaluate_model functions in the classification module.

 

For more related projects:

https://www.dezyre.com/projects/data-science-projects/tensorflow-projects
https://www.dezyre.com/projects/data-science-projects/keras-deep-learning-projects

stack_models function with Example:

PyCaret provides "pycaret.classification.stack_models()" function. Stack models function trains a meta-model over select estimators passed in the estimator_list parameter

The output of this function is a scoring grid with CV scores by fold.

from pycaret.datasets import get_data
iris = get_data('iris')
# importing classification module
from pycaret.classification import *
set_up = setup(data = iris, target = 'species')
comp_top3 = compare_models(n_select = 3)
stack = stack_models(comp_top3)
stack

plot_model function with Example:

PyCaret provides "pycaret.classification.plot_model()" function. Plot model function analyzes the performance of a trained model on holdout set.

from pycaret.datasets import get_data
iris = get_data('iris')
# importing classification module
from pycaret.classification import *
set_up = setup(data = iris, target = 'species')
# logistic regression
log_reg = create_model('lr')
# area under the curve
plot_model(log_reg, plot = 'auc')

List of plots in PyCaret:

‘auc’ - Area Under the Curve

‘threshold’ - Discrimination Threshold

‘pr’ - Precision-Recall Curve

‘confusion_matrix’ - Confusion Matrix

‘error’ - Class Prediction Error

‘class_report’ - Classification Report

‘boundary’ - Decision Boundary

‘rfe’ - Recursive Feature Selection

‘learning’ - Learning Curve

‘manifold’ - Manifold Learning

‘calibration’ - Calibration Curve

‘vc’ - Validation Curve

‘dimension’ - Dimension Learning

‘feature’ - Feature Importance

‘feature_all’ - Feature Importance

‘parameter’ - Model Hyperparameter

‘lift’ - Lift Curve

‘gain’ - Gain Chart

‘tree’ - Decision Tree

‘ks’ - KS Statistic Plot

evaluate_model function with Example:

PyCaret provides "pycaret.classification.evaluate_model()" function. evaluate_model function displays a user interface for analyzing performance of a trained model.

from pycaret.datasets import get_data
iris = get_data('iris')
# importing classification module
from pycaret.classification import *
set_up = setup(data = iris, target = 'species')
# creating model
svm = create_model('svm')
# evaluate_model function
evaluate_model(svm)

What Users are saying..

profile image

Gautam Vermani

Data Consultant at Confidential
linkedin profile url

Having worked in the field of Data Science, I wanted to explore how I can implement projects in other domains, So I thought of connecting with ProjectPro. A project that helped me absorb this topic... Read More

Relevant Projects

Build Deep Autoencoders Model for Anomaly Detection in Python
In this deep learning project , you will build and deploy a deep autoencoders model using Flask.

Loan Eligibility Prediction in Python using H2O.ai
In this loan prediction project you will build predictive models in Python using H2O.ai to predict if an applicant is able to repay the loan or not.

ML Model Deployment on AWS for Customer Churn Prediction
MLOps Project-Deploy Machine Learning Model to Production Python on AWS for Customer Churn Prediction

End-to-End ML Model Monitoring using Airflow and Docker
In this MLOps Project, you will learn to build an end to end pipeline to monitor any changes in the predictive power of model or degradation of data.

CycleGAN Implementation for Image-To-Image Translation
In this GAN Deep Learning Project, you will learn how to build an image to image translation model in PyTorch with Cycle GAN.

LLM Project to Build and Fine Tune a Large Language Model
In this LLM project for beginners, you will learn to build a knowledge-grounded chatbot using LLM's and learn how to fine tune it.

BigMart Sales Prediction ML Project in Python
The goal of the BigMart Sales Prediction ML project is to build and evaluate different predictive models and determine the sales of each product at a store.

Loan Eligibility Prediction Project using Machine learning on GCP
Loan Eligibility Prediction Project - Use SQL and Python to build a predictive model on GCP to determine whether an application requesting loan is eligible or not.

Ola Bike Rides Request Demand Forecast
Given big data at taxi service (ride-hailing) i.e. OLA, you will learn multi-step time series forecasting and clustering with Mini-Batch K-means Algorithm on geospatial data to predict future ride requests for a particular region at a given time.

A/B Testing Approach for Comparing Performance of ML Models
The objective of this project is to compare the performance of BERT and DistilBERT models for building an efficient Question and Answering system. Using A/B testing approach, we explore the effectiveness and efficiency of both models and determine which one is better suited for Q&A tasks.