Skip to content

Commit f2a2593

Browse files
committed
Create svm_sklearn.py
1 parent 384c236 commit f2a2593

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

svm_sklearn.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import numpy as np
2+
from sklearn import svm
3+
4+
# Read the data
5+
train = np.loadtxt(open("train.csv","rb"), delimiter=",", skiprows=0)
6+
trainLabels = np.loadtxt(open("trainLabels.csv","rb"), delimiter=",", skiprows=0)
7+
test = np.loadtxt(open("test.csv","rb"), delimiter=",", skiprows=0)
8+
9+
10+
X, y = train, trainLabels
11+
s = svm.SVC()
12+
s.fit(X, y)
13+
14+
predictions = s.predict(test)
15+
np.savetxt("fancySVMSubmission.csv", predictions.astype(int), fmt='%d', delimiter=",")

0 commit comments

Comments
 (0)