Skip to content

Instantly share code, notes, and snippets.

@TkrUdagawa
Last active October 26, 2017 01:56
Show Gist options
  • Save TkrUdagawa/c34dcee24f3bdd42dceff2a1dc82f33a to your computer and use it in GitHub Desktop.
Save TkrUdagawa/c34dcee24f3bdd42dceff2a1dc82f33a to your computer and use it in GitHub Desktop.
issue 1100
{
"converter" : {
"string_filter_types": {},
"string_filter_rules":[],
"num_filter_types": {},
"num_filter_rules": [],
"string_types": {},
"string_rules":[
{"key" : "*", "type" : "str", "sample_weight":"bin", "global_weight" : "bin"}
],
"num_types": {},
"num_rules": [
{"key" : "*", "type" : "num"}
]
},
"method": "inverted_index_euclid"
}
import jubatus
from jubatus.common import Datum
c = jubatus.Recommender("localhost", 9199, "hoge")
for i in range(1,4):
d = Datum({"x":i, "y": i, "z": i})
c.update_row(str(i), d)
c = jubatus.Recommender("localhost", 9199, "hoge")
print(c.similar_row_from_id_and_rate("1", -0.1))
print(c.similar_row_from_id_and_rate("1", -0.5))
print(c.similar_row_from_id_and_rate("1", -1.2))
'''
result:
[]
[id_with_score{id: 1, score: -0.0}, id_with_score{id: 2, score: -1.7320507764816284}, id_with_score{id: 3, score: -3.464101552963257}]
[id_with_score{id: 1, score: -0.0}, id_with_score{id: 2, score: -1.7320507764816284}, id_with_score{id: 3, score: -3.464101552963257}]
and jubatus variable value:
rate:-0.1, ceil:-0, ret_num:0
rate:-0.5, ceil:-0, ret_num:18446744073709551615
rate:-1.2, ceil:-1, ret_num:18446744073709551613
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment