text_html_output_1.png
from sklearn.ensemble import RandomForestClassifier

from sklearn.linear_model import LinearRegression

from sklearn.naive_bayes import GaussianNB

from sklearn.neighbors import KNeighborsClassifier

from sklearn.svm import SVC

from sklearn.tree import DecisionTreeClassifier

import matplotlib.pyplot as plt

import pandas as pd

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/wine-quality/winequalityN.csv')

df.shape

missing_val_count_by_column = df.isnull().sum()

df.fillna(df.mean(), inplace=True)

df['type'] = pd.get_dummies(df['type'], drop_first=True)

from sklearn.linear_model import LinearRegression
lr = LinearRegression()
lr.fit(X_train, y_train)
lr = lr.score(X_test, y_test)

from sklearn.svm import SVC
svm = SVC()
svm.fit(X_train, y_train)
svm = svm.score(X_test, y_test)

from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(n_estimators=100)
rf.fit(X_train, y_train)
rf = rf.score(X_test, y_test)

from sklearn.neighbors import KNeighborsClassifier
knn = KNeighborsClassifier(n_neighbors=5)
knn.fit(X_train, y_train)
knn = knn.score(X_test, y_test)

from sklearn.tree import DecisionTreeClassifier
dt = DecisionTreeClassifier()
dt.fit(X_train, y_train)
dt = dt.score(X_test, y_test)

from sklearn.naive_bayes import GaussianNB
nb = GaussianNB()
nb.fit(X_train, y_train)
nb = nb.score(X_test, y_test)

models = pd.DataFrame({'Model': ['Linear Regression', 'KNN', 'SVM', 'Random Forest', 'Naive Bayes', 'Decision Tree'], 'Score': [lr, knn, svm, rf, nb, dt]})

models.sort_values(by='Score', ascending=False)

plt.figure(figsize=(10, 5))
sns.barplot(x='Model', y='Score', data=models)
plt.show()