SHARE
TWEET

Untitled

a guest Aug 20th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data = pd.read_csv(trainPath, header=0)
  2.  
  3. X = data.iloc[:, 5:17].values
  4. y = data.iloc[:, 17:18].values
  5.  
  6. X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
  7.  
  8. print(X_train.dtype, y_train.dtype)  # float64 int64
  9.  
  10. clf = svm.SVC(kernel='linear').fit(X_train, y_train.ravel())
  11. print('done')
  12.  
  13. y_pred = clf.predict(X_test)
  14.  
  15. print("Accuracy:", metrics.accuracy_score(y_test, y_pred))
  16. print("Precision:", metrics.precision_score(y_test, y_pred))
  17. print("Recall:", metrics.recall_score(y_test, y_pred))
  18. tn, fp, fn, tp = confusion_matrix(y_test, y_pred).ravel()
  19. print(tn, fp, fn, tp)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top