Challenge

Unsupervised Learning - Kmeans Week 11 Challenge

Unsupervised Learning - Kmeans Week 11 Challenge

  1. How does similarity is calculated if data is categorical in nature.

There are Various methods of calculating similarity for categorical data are;

  • Jaccard Similarity
  • Hamming Distance
  • Simple Matching Coefficient
  • Cosine Similarity
  • Gower's Coefficient

1)Jaccard Similarity: This measure calculates the similarity between two sets of categorical data. It is computed as the size of the intersection divided by the size of the union of the two sets. For example, if you have two data points represented by sets A and B, the Jaccard similarity is given by J(A, B) = |A ∩ B| / |A ∪ B|.

2.Hamming Distance: This measure is used to calculate the dissimilarity between two categorical vectors of equal length. It counts the number of positions where the values in the two vectors differ. For example, if you have two categorical vectors A and B of length n, the Hamming distance is given by H(A, B) = Σ(A[i] ≠ B[i]).

3.Simple Matching Coefficient: This coefficient calculates the proportion of matching attributes between two categorical vectors. It is defined as the number of attributes that match divided by the total number of attributes. For example, if you have two categorical vectors A and B, the Simple Matching Coefficient is given by SMC(A, B) = Σ(A[i] = B[i]) / n, where n is the total number of attributes.

4.Cosine Similarity: Although more commonly used for continuous data, cosine similarity can be applied to categorical data by representing the data as binary vectors. Each attribute is transformed into a binary feature, indicating its presence or absence. The cosine similarity is then calculated as the cosine of the angle between the two binary vectors.

2. Implement K-means for “Car dataset” and come up with the business insights.

K-means is an iterative algorithm that divides the unlabeled dataset into k different clusters in such a way that each dataset belongs only one group that has similar properties. The car data set is used , applied the K-means algorithm to classify the dataset. The dataset are classified into 3 cluster.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.