forked from ujjwalkarn/DataSciencePython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvm_sklearn.py
More file actions
15 lines (11 loc) · 452 Bytes
/
svm_sklearn.py
File metadata and controls
15 lines (11 loc) · 452 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import numpy as np
from sklearn import svm
# Read the data
train = np.loadtxt(open("train.csv","rb"), delimiter=",", skiprows=0)
trainLabels = np.loadtxt(open("trainLabels.csv","rb"), delimiter=",", skiprows=0)
test = np.loadtxt(open("test.csv","rb"), delimiter=",", skiprows=0)
X, y = train, trainLabels
s = svm.SVC()
s.fit(X, y)
predictions = s.predict(test)
np.savetxt("fancySVMSubmission.csv", predictions.astype(int), fmt='%d', delimiter=",")