Unsupervised Learning - Kmeans Week 11 Challenge
Q.1 How does similarity is calculated if data is categorical in nature
Calculating similarity for categorical data involves different techniques compared to numerical data. Here are a few common methods used for measuring similarity with categorical data:
1. **Jaccard Similarity:**
- Jaccard similarity is often used for comparing sets. In the context of categorical data, each data point is treated as a set of categories.
- The Jaccard similarity coefficient is calculated as the size of the intersection of the sets divided by the size of the union of the sets.
- It is defined as J(A, B) = |A ∩ B| / |A ∪ B|, where A and B are sets of categories.
2. **Hamming Distance:**
- Hamming distance is used to measure the minimum number of substitutions required to change one string into the other.
- For categorical data, each category is treated as a "feature," and the Hamming distance between two data points is the number of features for which they differ.
3. **Edit Distance (Levenshtein Distance):**
- Edit distance measures the minimum number of operations (insertions, deletions, or substitutions) required to transform one string into another.
- For categorical data, you can consider each category as a symbol in the string, and the edit distance is calculated based on the operations needed to transform one set of categories into another.
4. **Categorical Correlation:**
- There are several measures of correlation specifically designed for categorical data, such as Cramér's V and Theil's U. These metrics provide a measure of association between two categorical variables.
5. **Information-Theoretic Measures:**
- Mutual information and related information-theoretic measures can also be used to quantify the similarity between two categorical variables.
when choosing a method, consider the nature of your data and the specific characteristics you want to capture. Additionally, it's crucial to preprocess categorical data appropriately, such as encoding it in a way that preserves the meaningful relationships between categories. One-hot encoding, label encoding, or other categorical encoding techniques may be used depending on the algorithm and the specific requirements of your analysis.
Q.2 Implement K-means for “Car dataset” and come up with the business insights
Please Find the attachment.