Skip to content

Instantly share code, notes, and snippets.

@akkijp
Last active June 10, 2016 09:51
Show Gist options
  • Save akkijp/8bd959a3d71bf6ff6487bc8885f5c9de to your computer and use it in GitHub Desktop.
Save akkijp/8bd959a3d71bf6ff6487bc8885f5c9de to your computer and use it in GitHub Desktop.
scikit-learnで始める機械学習 チュートリアル テストコード from http://www.slideshare.net/moa108/20130715-lt-scikitlearn

これは、「scikit-learnで始める機械学習 チュートリアル」のテストコードです。

How to use

git clone https://gist.github.com/8bd959a3d71bf6ff6487bc8885f5c9de.git
cd 8bd959a3d71bf6ff6487bc8885f5c9de
python main.py
import numpy as np
from sklearn import svm
trailFeature = np.genfromtxt(open('train.csv', 'r'), delimiter = ',')
trailLabel = np.genfromtxt(open('trainLabels.csv', 'r'), delimiter = ',')
clf = svm.SVC(kernel='rbf', C=1)
clf.fit(trailFeature, trailLabel)
testFeature = np.genfromtxt(open('train_test.csv', 'r'), delimiter = ',')
result = clf.predict(testFeature)
print(result)
0.2994 -1.2266
-11.1741 0.3321
-11.1741 0.3321
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
1
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment