Last active
August 29, 2015 14:10
-
-
Save TkrUdagawa/48bac8837fc50b9a0fdc 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
from jubatus.recommender import client | |
from jubatus.recommender import types | |
from jubatus.common import Datum | |
NAME="lsh_nn_test" | |
port = 9199 | |
serv = "127.0.0.1" | |
recommender = client.Recommender(serv, port, NAME) | |
d1 = Datum() | |
d1.add_number("height", 165.0) | |
d1.add_number("weight", 60.0) | |
print "update d1 and similar_row_from_id udagawa" | |
recommender.update_row("udagawa", d1) | |
recommender.update_row("tora", d1) | |
print recommender.similar_row_from_id("udagawa", 10) | |
d2 = Datum() | |
d2.add_number("foot", 26.0) | |
print "update d2 then similar_row_from_id udagawa" | |
d2.add_number("foot", 26.0) | |
recommender.update_row("udagawa", d2) | |
print recommender.similar_row_from_id("udagawa", 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The output is:
update d1 and similar_row_from_id udagawa
[id_with_score{id: udagawa, score: 1.0}, id_with_score{id: tora, score: 1.0}]
update d2 then similar_row_from_id udagawa
[id_with_score{id: tora, score: 1.0}, id_with_score{id: udagawa, score: 0.96875}]