<jupyter_start><jupyter_text>Gaussian Mixture Model on Mushroom Dataset[Dataset](https://github.com/heenalsapovadia/ml_practices_2018/blob/master/Labs/Lab1/Heenal/Data/mushroom_new.csv)[EDA on dataset](https://github.com/heenalsapovadia/ml_practices_2018/blob/master/Labs/Lab1/Heenal/PythonNotebooks/Mushroom.ipynb)<jupyter_code># importing the necessary libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

from sklearn.mixture import GaussianMixture
# loading the data
mush = pd.read_csv('../../Lab1/Heenal/Data/mushroom_new.csv')
mush.head()
X = mush[['gill-color', 'cap-color']]
y = mush['class']
X.shape, y.shape
X = mush.drop(['class'], axis=1)
sns.pairplot(X)
sns.heatmap(mush.corr(), annot=True)
gmm = GaussianMixture(n_components=2)
gmm.fit(X)
labels = gmm.predict(X)
X['labels'] = labels
x0 = X[X['labels'] == 0]
x1 = X[X['labels'] == 1]
x0.shape
plt.scatter(x0['gill-color'], x0['cap-color'], c='r')
plt.scatter(x1['gill-color'], x1['cap-color'], c='b')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17320574162679425, 'fraction_numerical': 0.021052631578947368, 'mean_word_length': 6.418439716312057, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '452200', 'license': 'Apache-2.0', 'n_tokens_mistral': 445, 'n_tokens_neox': 421, 'n_words': 71, 'path': 'Labs/Lab2/Heenal/GMM_Mushroom.ipynb', 'repo_name': 'heenalsapovadia/ml_practices_2018', 'size': '1045'}