text_html_output_1.png
from sklearn.ensemble import RandomForestClassifier

from sklearn.linear_model import LogisticRegression

from sklearn.neighbors import KNeighborsClassifier

import matplotlib.pyplot as plt

import numpy as np # linear algebra

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

import seaborn as sns

df = pd.read_csv('/kaggle/input/mba-admission/Admission.csv')

from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
rfr = RandomForestClassifier()
knn = KNeighborsClassifier()
logmod = LogisticRegression()
rfr.fit(X_train, y_train)
knn.fit(X_train, y_train)
logmod.fit(X_train, y_train)

error = []
for k in range(1, 40):
    knn = KNeighborsClassifier(n_neighbors=k)
    knn.fit(X_train, y_train)
    p = knn.predict(X_test)
    error.append(np.mean(y_test != p))

plt.plot(range(1, 40), error, ls='--', marker='X', markerfacecolor='red')