MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# What is jaccard similarity and how to calculate it?

# What is jaccard similarity and how to calculate it?

This recipe explains what is jaccard similarity and how to calculate it

Jaccard similarity can be defined to the size of intersection divided by the size of union of two sets. Hence it lies between values 0 & 1. In lay man's term, it is area of overlap/area of union.

So this recipe is a short example on what jaccard similarity is and how to calculate it. Let's get started.

```
x=['Ram','Shyam','Rohan']
y=['Ram','Rohan','Ganesh']
```

Let us create a two list having two common elements.

```
def jaccard(x,y):
z=set(x).intersection(set(y))
a=float(len(z))/(len(x)+len(y)-len(z))
return a
```

We have used the mathematical property of jacccard function to defined the values to be returned if two list are passed into it as arguments.

```
z=jaccard(x,y)
print(z)
```

First call the jaccard function and store the return value in any random variables. Now simply use print function to print new appended dataframe.

Once we run the above code snippet, we will see:

0.5

For above example, we can observe that the area of intersection will be 2 elements and area of overlap will be 4 elements. So jacarrad similarity is 2/4 i.e. '0.5'.

Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

There are different time series forecasting methods to forecast stock price, demand etc. In this machine learning project, you will learn to determine which forecasting method to be used when and how to apply with time series forecasting example.

In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.

In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

In this project, we are going to work on Sequence to Sequence Prediction using IMDB Movie Review Datasetâ€‹ using Keras in Python.