Merge pull request #50 from Huang-Jack/patch-3

fix transform issue
This commit is contained in:
Yong Mao
2018-08-21 15:56:53 +08:00
committed by GitHub

View File

@ -18,7 +18,7 @@ X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, rand
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.fit_transform(X_test)
X_test = sc.transform(X_test)
#Fitting SVM to the Training set
from sklearn.svm import SVC
@ -30,7 +30,10 @@ y_pred = classifier.predict(X_test)
#Making the Confusion Matrix
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
cm = confusion_matrix(y_test, y_pred)
print(cm)
print(classification_report(y_test, y_pred))
#Visualising the Training set results
from matplotlib.colors import ListedColormap