text_plain_output_1.png
from sklearn.cluster import KMeans

from sklearn.ensemble import RandomForestClassifier

from sklearn.model_selection import GridSearchCV

from sklearn.model_selection import GridSearchCV

from sklearn.model_selection import cross_validate

from sklearn.preprocessing import StandardScaler

import numpy as np

import numpy as np # linear algebra

import os

import os

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import numpy as np
import pandas as pd
import pandas as pd
import os
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import GridSearchCV
import os
data = pd.read_csv('/kaggle/input/otto-group-product-classification-challenge/train.csv')
data.sample(10)

X = np.asarray(data.iloc[:, 1:-1].dropna(), dtype=np.float32)
Y = np.asarray(data.iloc[:, -1])

from sklearn.preprocessing import StandardScaler
X_standard = StandardScaler().fit_transform(X)
X_standard

from sklearn.model_selection import cross_validate
from sklearn.cluster import KMeans
km = KMeans(n_clusters=9)
cv_results = cross_validate(knn, X_standard, Y, cv=5)
cv_results['test_score']

from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
rfc = RandomForestClassifier()
parameters = {'n_estimators': [50, 100, 200]}
clf = GridSearchCV(rfc, parameters, cv=5)
clf.fit(X_standard, Y)
cv_results = clf.cv_results_
cv_results