Explain models get metrics and add metric functions in PyCaret

In this recipe, we will see what are models, get metrics and add metric functions in the classification model in PyCaret through examples.

Recipe Objective - What are models, get_metrics, and add_metric functions in the classification model in PyCaret?

PyCaret provides models, get_metrics, and add_metric functions in the classification module.

List of Classification Algorithms in Machine Learning

Links for the more related projects:

https://www.dezyre.com/projects/data-science-projects/deep-learning-projects
https://www.dezyre.com/projects/data-science-projects/neural-network-projects

models function with Example:

PyCaret provides "pycaret.classification.models()" function. Models function returns table of models available in the model library.

from pycaret.datasets import get_data
iris = get_data('iris')
# importing classification module
from pycaret.classification import *
# setup create model
setup_data = setup(data = iris, target = 'species')
models = models()
models

get_metrics function with Example:

PyCaret provides "pycaret.classification.get_metrics()" function. The get_metrics function returns table of available metrics used for CV.

from pycaret.datasets import get_data
iris = get_data('iris')
# importing classification module
from pycaret.classification import *
# setup create model
setup_data = setup(data = iris, target = 'species')
get_models = get_metrics()
get_models

add_metric function with Example:

PyCaret provides "pycaret.classification.add_metric()" function. The add_metric function adds a custom metric to be used for CV.

from pycaret.datasets import get_data
iris = get_data('iris')
# importing classification module
from pycaret.classification import *
# setup create model
setup_data = setup(data = iris, target = 'species')
from sklearn.metrics import log_loss
add_metric('logloss', 'Log Loss', log_loss, greater_is_better = False)

What Users are saying..

profile image

Savvy Sahai

Data Science Intern, Capgemini
linkedin profile url

As a student looking to break into the field of data engineering and data science, one can get really confused as to which path to take. Very few ways to do it are Google, YouTube, etc. I was one of... Read More

Relevant Projects

Build a Face Recognition System in Python using FaceNet
In this deep learning project, you will build your own face recognition system in Python using OpenCV and FaceNet by extracting features from an image of a person's face.

Customer Market Basket Analysis using Apriori and Fpgrowth algorithms
In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

Build a Speech-Text Transcriptor with Nvidia Quartznet Model
In this Deep Learning Project, you will leverage transfer learning from Nvidia QuartzNet pre-trained models to develop a speech-to-text transcriptor.

Langchain Project for Customer Support App in Python
In this LLM Project, you will learn how to enhance customer support interactions through Large Language Models (LLMs), enabling intelligent, context-aware responses. This Langchain project aims to seamlessly integrate LLM technology with databases, PDF knowledge bases, and audio processing agents to create a comprehensive customer support application.

Forecasting Business KPI's with Tensorflow and Python
In this machine learning project, you will use the video clip of an IPL match played between CSK and RCB to forecast key performance indicators like the number of appearances of a brand logo, the frames, and the shortest and longest area percentage in the video.

Customer Churn Prediction Analysis using Ensemble Techniques
In this machine learning churn project, we implement a churn prediction model in python using ensemble techniques.

Model Deployment on GCP using Streamlit for Resume Parsing
Perform model deployment on GCP for resume parsing model using Streamlit App.

Credit Card Default Prediction using Machine learning techniques
In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

Expedia Hotel Recommendations Data Science Project
In this data science project, you will contextualize customer data and predict the likelihood a customer will stay at 100 different hotel groups.

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.