Last active
December 12, 2015 10:29
-
-
Save unnonouno/4759954 to your computer and use it in GitHub Desktop.
ハンズオンサンプル
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
#!/usr/bin/env python | |
# coding: utf-8 | |
host = '127.0.0.1' | |
port = 9199 | |
name = 'test' | |
import jubatus | |
from jubatus.classifier.types import datum | |
client = jubatus.Classifier(host, port) | |
train_data = [ | |
('male', datum([('hair', 'short'), ('top', 'sweater'), ('bottom', 'jeans')], [('height', 1.70)])), | |
('female', datum([('hair', 'long'), ('top', 'shirt'), ('bottom', 'skirt')], [('height', 1.56)])), | |
('male', datum([('hair', 'short'), ('top', 'jacket'), ('bottom', 'chino')], [('heght', 1.65)])), | |
('female', datum([('hair', 'short'), ('top', 'T shirt'), ('bottom', 'jeans')], [('height', 1.72)])), | |
('male', datum([('hair', 'long'), ('top', 'T shirt'), ('bottom', 'jeans')], [('height', 1.82)])), | |
('female', datum([('hair', 'long'), ('top', 'jacket'), ('bottom', 'skirt')], [('height', 1.43)])), | |
# ('male', datum([('hair', 'short'), ('top', 'jacket'), ('bottom', 'jeans')], [('height', 1.76)])), | |
# ('female', datum([('hair', 'long'), ('top', 'sweater'), ('bottom', 'skirt')], [('height', 1.52)])), | |
] | |
client.train(name, train_data) | |
test_data = [ | |
datum([('hair', 'short'), ('top', 'T shirt'), ('bottom', 'jeans')], [('height', 1.81)]), | |
datum([('hair', 'long'), ('top', 'shirt'), ('bottom', 'skirt')], [('height', 1.50)]), | |
] | |
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
この行のみ、"heght" になっています