-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSVM.py
More file actions
27 lines (16 loc) · 663 Bytes
/
Copy pathSVM.py
File metadata and controls
27 lines (16 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sklearn
from scipy import stats
from sklearn.svm import SVC # "Support vector classifier"
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn import datasets
#Load dataset
boston = datasets.load_breast_cancer()
# Split dataset into training set and test set
X_train, X_test, y_train, y_test = train_test_split(boston.data, boston.target, test_size=0.1,random_state=109)
#Defining our SVM classifier
model = SVC(kernel='linear', C=1E10)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
#Finding the Accuracy
print("Accuracy:",metrics.accuracy_score(y_test, y_pred))