text_html_output_1.png
from sklearn.ensemble import RandomForestClassifier

from sklearn.linear_model import LogisticRegression

from sklearn.metrics import accuracy_score

from sklearn.naive_bayes import GaussianNB

from sklearn.neighbors import KNeighborsClassifier

from sklearn.preprocessing import StandardScaler

from sklearn.svm import SVC

from sklearn.svm import SVC

from sklearn.tree import DecisionTreeClassifier

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

train = pd.read_csv('/kaggle/input/mobile-price-classification/train.csv')
test = pd.read_csv('/kaggle/input/mobile-price-classification/test.csv')
train

X_train = X_sample.iloc[:, :-1].values
y_train = X_sample.iloc[:, -1].values
X_test = y_sample.iloc[:, :-1].values
y_test = y_sample.iloc[:, -1].values

(X_train.shape, X_test.shape, y_train.shape, y_test.shape)

from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)

from sklearn.linear_model import LogisticRegression
lr = LogisticRegression()
lr.fit(X_train, y_train)

y_pred_lr = lr.predict(X_test)

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

y_pred_svm = svm.predict(X_test)

from sklearn.svm import SVC
ksvm = SVC(kernel='rbf')
ksvm.fit(X_train, y_train)

y_pred_ksvm = ksvm.predict(X_test)

from sklearn.naive_bayes import GaussianNB
gnb = GaussianNB()
gnb.fit(X_train, y_train)

y_pred_gnb = gnb.predict(X_test)

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

y_pred_knn = knn.predict(X_test)

from sklearn.ensemble import RandomForestClassifier
rfc = RandomForestClassifier()
rfc.fit(X_train, y_train)

y_pred_rfc = rfc.predict(X_test)

from sklearn.tree import DecisionTreeClassifier
dtc = DecisionTreeClassifier()
dtc.fit(X_train, y_train)

y_pred_dtc = dtc.predict(X_test)

df = pd.DataFrame({'Model Name': ['Logistic Regression', 'Linear SVM', 'Kernel SVM', 'Naive Bayes', 'K Nearest Neighbors', 'Decision Tree Classifier', 'Random Forest Classifier'], 'Accuracy Score': [accuracy_score(y_test, y_pred_lr), accuracy_score(y_test, y_pred_svm), accuracy_score(y_test, y_pred_ksvm), accuracy_score(y_test, y_pred_gnb), accuracy_score(y_test, y_pred_knn), accuracy_score(y_test, y_pred_dtc), accuracy_score(y_test, y_pred_rfc)]})
df = df.sort_values(by=['Accuracy Score'], ascending=False)
df