Created
February 19, 2013 15:42
-
-
Save moccos/4986980 to your computer and use it in GitHub Desktop.
2/18 第1回 Jubatusハンズオン http://partake.in/events/cf1df52e-9e4e-45e0-b3ec-e64a9674bab9 で遊んだコード断片
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host = '127.0.0.1' | |
port = 9199 | |
name = 'test' | |
import jubatus | |
from jubatus.classifier.types import datum | |
client = jubatus.Classifier(host, port) | |
train_data = [ | |
('41', datum([],[('STR', 19.0),('AGI', 14.0),('DEX', 13.0),('INT', 18.0),('CHR', 17.0)])), | |
('12', datum([],[('STR', 21.0),('AGI', 15.0),('DEX', 13.0),('INT', 15.0),('CHR', 18.0)])), | |
('83', datum([],[('STR', 19.0),('AGI', 20.0),('DEX', 15.0),('INT', 13.0),('CHR', 17.0)])), | |
('73', datum([],[('STR', 14.0),('AGI', 15.0),('DEX', 16.0),('INT', 21.0),('CHR', 17.0)])), | |
('15', datum([],[('STR', 28.0),('AGI', 24.0),('DEX', 16.0),('INT', 16.0),('CHR', 21.0)])), | |
# 6200行くらい略 | |
] | |
client.train(name, train_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host = '127.0.0.1' | |
port = 9199 | |
name = 'test' | |
import jubatus | |
from jubatus.classifier.types import datum | |
client = jubatus.Classifier(host, port) | |
test_data = [ | |
# 41: bishop | |
#datum([],[('STR', 19.0),('AGI', 14.0),('DEX', 13.0),('INT', 18.0),('CHR', 17.0)]), | |
# 12: general | |
datum([],[('STR', 21.0),('AGI', 15.0),('DEX', 13.0),('INT', 15.0),('CHR', 18.0)]), | |
] | |
results = client.classify(name, test_data) | |
for result in results: | |
for r in result: | |
print r.label, r.score | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment