import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib.pyplot as plt

from subprocess import check_output
print(check_output(["ls", "../input"]).decode("utf8"))

df=pd.read_csv('../input/Wine.csv',header=None)
#df.head(3)
df.columns = [  'name','alcohol','malicAcid','ash','ashalcalinity','magnesium','totalPhenols','flavanoids','nonFlavanoidPhenols','proanthocyanins','colorIntensity','hue','od280_od315','proline']
df.head(3)

import seaborn as sns
corr = df[df.columns].corr()
sns.heatmap(corr, cmap="YlGnBu", annot = True)

X= df.drop(['name','ash'], axis=1)
#X.head(3)
Y=df.iloc[:,:1]
#Y.head(3)

from sklearn.model_selection import train_test_split
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3, random_state=0)
print(X_train.shape)
print(X_test.shape)

from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import SVC
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import GradientBoostingClassifier

models = []
models.append(("Logistic Regression:",LogisticRegression()))
models.append(("Naive Bayes:",GaussianNB()))
models.append(("K-Nearest Neighbour:",KNeighborsClassifier(n_neighbors=3)))
models.append(("Decision Tree:",DecisionTreeClassifier()))
models.append(("Support Vector Machine-linear:",SVC(kernel="linear")))
models.append(("Support Vector Machine-rbf:",SVC(kernel="rbf")))
models.append(("Random Forest:",RandomForestClassifier(n_estimators=7)))
models.append(("Xtreme Gradient Boost:",XGBClassifier()))
models.append(("MLP:",MLPClassifier(hidden_layer_sizes=(45,30,15),solver='sgd',learning_rate_init=0.01,max_iter=500)))
models.append(("AdaBoostClassifier:",AdaBoostClassifier()))
models.append(("GradientBoostingClassifier:",GradientBoostingClassifier()))

results = []
names = []
for name,model in models:
    kfold = KFold(n_splits=10, random_state=0)
    cv_result = cross_val_score(model,X_train,Y_train.values.ravel(), cv = kfold,scoring = "accuracy")
    names.append(name)
    results.append(cv_result)
for i in range(len(names)):
    print(names[i],results[i].mean()*100)

1726b6b4ecde8a49d6e7f8984a9456034b1d75ee
<mask token>

<mask token>
print(check_output(['ls', '../input']).decode('utf8'))
<mask token>
df.head(3)
<mask token>
sns.heatmap(corr, cmap='YlGnBu', annot=True)
<mask token>
print(X_train.shape)
print(X_test.shape)
<mask token>
models.append(('Logistic Regression:', LogisticRegression()))
models.append(('Naive Bayes:', GaussianNB()))
models.append(('K-Nearest Neighbour:', KNeighborsClassifier(n_neighbors=3)))
models.append(('Decision Tree:', DecisionTreeClassifier()))
models.append(('Support Vector Machine-linear:', SVC(kernel='linear')))
models.append(('Support Vector Machine-rbf:', SVC(kernel='rbf')))
models.append(('Random Forest:', RandomForestClassifier(n_estimators=7)))
models.append(('Xtreme Gradient Boost:', XGBClassifier()))
models.append(('MLP:', MLPClassifier(hidden_layer_sizes=(45, 30, 15),
    solver='sgd', learning_rate_init=0.01, max_iter=500)))
models.append(('AdaBoostClassifier:', AdaBoostClassifier()))
models.append(('GradientBoostingClassifier:', GradientBoostingClassifier()))
<mask token>
for name, model in models:
    kfold = KFold(n_splits=10, random_state=0)
    cv_result = cross_val_score(model, X_train, Y_train.values.ravel(), cv=
        kfold, scoring='accuracy')
    names.append(name)
    results.append(cv_result)
for i in range(len(names)):
    print(names[i], results[i].mean() * 100)

<mask token>
print(check_output(['ls', '../input']).decode('utf8'))
df = pd.read_csv('../input/Wine.csv', header=None)
df.columns = ['name', 'alcohol', 'malicAcid', 'ash', 'ashalcalinity',
    'magnesium', 'totalPhenols', 'flavanoids', 'nonFlavanoidPhenols',
    'proanthocyanins', 'colorIntensity', 'hue', 'od280_od315', 'proline']
df.head(3)
<mask token>
corr = df[df.columns].corr()
sns.heatmap(corr, cmap='YlGnBu', annot=True)
X = df.drop(['name', 'ash'], axis=1)
Y = df.iloc[:, :1]
<mask token>
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3,
    random_state=0)
print(X_train.shape)
print(X_test.shape)
<mask token>
models = []
models.append(('Logistic Regression:', LogisticRegression()))
models.append(('Naive Bayes:', GaussianNB()))
models.append(('K-Nearest Neighbour:', KNeighborsClassifier(n_neighbors=3)))
models.append(('Decision Tree:', DecisionTreeClassifier()))
models.append(('Support Vector Machine-linear:', SVC(kernel='linear')))
models.append(('Support Vector Machine-rbf:', SVC(kernel='rbf')))
models.append(('Random Forest:', RandomForestClassifier(n_estimators=7)))
models.append(('Xtreme Gradient Boost:', XGBClassifier()))
models.append(('MLP:', MLPClassifier(hidden_layer_sizes=(45, 30, 15),
    solver='sgd', learning_rate_init=0.01, max_iter=500)))
models.append(('AdaBoostClassifier:', AdaBoostClassifier()))
models.append(('GradientBoostingClassifier:', GradientBoostingClassifier()))
results = []
names = []
for name, model in models:
    kfold = KFold(n_splits=10, random_state=0)
    cv_result = cross_val_score(model, X_train, Y_train.values.ravel(), cv=
        kfold, scoring='accuracy')
    names.append(name)
    results.append(cv_result)
for i in range(len(names)):
    print(names[i], results[i].mean() * 100)

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from subprocess import check_output
print(check_output(['ls', '../input']).decode('utf8'))
df = pd.read_csv('../input/Wine.csv', header=None)
df.columns = ['name', 'alcohol', 'malicAcid', 'ash', 'ashalcalinity',
    'magnesium', 'totalPhenols', 'flavanoids', 'nonFlavanoidPhenols',
    'proanthocyanins', 'colorIntensity', 'hue', 'od280_od315', 'proline']
df.head(3)
import seaborn as sns
corr = df[df.columns].corr()
sns.heatmap(corr, cmap='YlGnBu', annot=True)
X = df.drop(['name', 'ash'], axis=1)
Y = df.iloc[:, :1]
from sklearn.model_selection import train_test_split
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3,
    random_state=0)
print(X_train.shape)
print(X_test.shape)
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import SVC
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import GradientBoostingClassifier
models = []
models.append(('Logistic Regression:', LogisticRegression()))
models.append(('Naive Bayes:', GaussianNB()))
models.append(('K-Nearest Neighbour:', KNeighborsClassifier(n_neighbors=3)))
models.append(('Decision Tree:', DecisionTreeClassifier()))
models.append(('Support Vector Machine-linear:', SVC(kernel='linear')))
models.append(('Support Vector Machine-rbf:', SVC(kernel='rbf')))
models.append(('Random Forest:', RandomForestClassifier(n_estimators=7)))
models.append(('Xtreme Gradient Boost:', XGBClassifier()))
models.append(('MLP:', MLPClassifier(hidden_layer_sizes=(45, 30, 15),
    solver='sgd', learning_rate_init=0.01, max_iter=500)))
models.append(('AdaBoostClassifier:', AdaBoostClassifier()))
models.append(('GradientBoostingClassifier:', GradientBoostingClassifier()))
results = []
names = []
for name, model in models:
    kfold = KFold(n_splits=10, random_state=0)
    cv_result = cross_val_score(model, X_train, Y_train.values.ravel(), cv=
        kfold, scoring='accuracy')
    names.append(name)
    results.append(cv_result)
for i in range(len(names)):
    print(names[i], results[i].mean() * 100)

import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib.pyplot as plt

from subprocess import check_output
print(check_output(["ls", "../input"]).decode("utf8"))

df=pd.read_csv('../input/Wine.csv',header=None)
#df.head(3)
df.columns = [  'name','alcohol','malicAcid','ash','ashalcalinity','magnesium','totalPhenols','flavanoids','nonFlavanoidPhenols','proanthocyanins','colorIntensity','hue','od280_od315','proline']
df.head(3)

import seaborn as sns
corr = df[df.columns].corr()
sns.heatmap(corr, cmap="YlGnBu", annot = True)

X= df.drop(['name','ash'], axis=1)
#X.head(3)
Y=df.iloc[:,:1]
#Y.head(3)

from sklearn.model_selection import train_test_split
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3, random_state=0)
print(X_train.shape)
print(X_test.shape)

from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import SVC
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import GradientBoostingClassifier

models = []
models.append(("Logistic Regression:",LogisticRegression()))
models.append(("Naive Bayes:",GaussianNB()))
models.append(("K-Nearest Neighbour:",KNeighborsClassifier(n_neighbors=3)))
models.append(("Decision Tree:",DecisionTreeClassifier()))
models.append(("Support Vector Machine-linear:",SVC(kernel="linear")))
models.append(("Support Vector Machine-rbf:",SVC(kernel="rbf")))
models.append(("Random Forest:",RandomForestClassifier(n_estimators=7)))
models.append(("Xtreme Gradient Boost:",XGBClassifier()))
models.append(("MLP:",MLPClassifier(hidden_layer_sizes=(45,30,15),solver='sgd',learning_rate_init=0.01,max_iter=500)))
models.append(("AdaBoostClassifier:",AdaBoostClassifier()))
models.append(("GradientBoostingClassifier:",GradientBoostingClassifier()))

results = []
names = []
for name,model in models:
    kfold = KFold(n_splits=10, random_state=0)
    cv_result = cross_val_score(model,X_train,Y_train.values.ravel(), cv = kfold,scoring = "accuracy")
    names.append(name)
    results.append(cv_result)
for i in range(len(names)):
    print(names[i],results[i].mean()*100)
