text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import pandas as pd

import pandas as pd

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
train = pd.read_excel('/kaggle/input/products/ABBREV_with_CLASS.xlsx')
train

train.isnull().sum()

Q1 = train['Protein_(g)'].quantile(0.25)
Q3 = train['Protein_(g)'].quantile(0.75)
IQR = Q3 - Q1
train = train[(train['Protein_(g)'] >= Q1 - 1.5 * IQR) & (train['Protein_(g)'] <= Q3 + 1.5 * IQR)]

from sklearn.preprocessing import LabelEncoder
labelencoder_Shrt_Desc = LabelEncoder()
train['Shrt_Desc'] = labelencoder_Shrt_Desc.fit_transform(train['Shrt_Desc'])
labelencoder_GmWt_Desc1 = LabelEncoder()
train['GmWt_Desc1'] = labelencoder_GmWt_Desc1.fit_transform(train['GmWt_Desc1'])
labelencoder_GmWt_Desc2 = LabelEncoder()
train['GmWt_Desc2'] = labelencoder_GmWt_Desc2.fit_transform(train['GmWt_Desc2'])

train.isnull().sum()

centers = [[1, 1], [-1, -1]]
X = train.drop('CLASS', axis=1)
y = train['CLASS']

centers = [[1, 1], [-1, -1], [1, -1]]
X = train.drop('CLASS', axis=1)
y = train['CLASS']

y