Skip to content

Instantly share code, notes, and snippets.

@TkrUdagawa
Last active December 11, 2017 07:51
Show Gist options
  • Save TkrUdagawa/53585e563597780dec3502b0caf3d160 to your computer and use it in GitHub Desktop.
Save TkrUdagawa/53585e563597780dec3502b0caf3d160 to your computer and use it in GitHub Desktop.
benchmark result
-*- coding:utf-8 -*-
import jubatus
from jubatus.common import Datum
import random
import time
cl = jubatus.Anomaly("localhost", 9199, "test", 0)
cl.clear()
random.seed(1)
datum_list = []
datum_length = 100
datum_num = 3000
for i in range(datum_num):
d = Datum()
for x in range(datum_length):
d.add_number("{}".format(x), random.random())
datum_list.append(d)
start = time.time()
cl.add_bulk(datum_list)
end = time.time()
print("add_bulk time:", end - start)
print(cl.calc_score(datum_list[-1]))
cl.clear()
start = time.time()
for d in datum_list:
cl.add(d)
end = time.time()
print("add time:", end - start)
print(cl.calc_score(datum_list[-1]))
{
"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" }
]
},
"parameter" : {
"nearest_neighbor_num" : 10,
"reverse_nearest_neighbor_num" : 30,
"method" : "lsh",
"parameter" : {
"hash_num" : 64
}
},
"method" : "light_lof"
}
{
"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" }
]
},
"parameter" : {
"nearest_neighbor_num" : 10,
"reverse_nearest_neighbor_num" : 30,
"method" : "lsh",
"parameter" : {
"hash_num" : 64
}
},
"method" : "lof"
}
$ jubaanomaly -f lof.json &
$ python add_bulk_bench.py
2017-12-11 16:46:35,288 27231 INFO [anomaly_serv.cpp:246] model cleared:
add_bulk time: 3.411644458770752
1.0249063968658447
2017-12-11 16:46:39,061 27231 INFO [anomaly_serv.cpp:246] model cleared:
add time: 18.150259017944336
1.0471123456954956
$ jubaanomaly -f light_lof.json &
$ python add_bulk_bench.py
2017-12-11 16:47:54,393 27290 INFO [anomaly_serv.cpp:246] model cleared:
add_bulk time: 0.7454001903533936
1.033468246459961
2017-12-11 16:47:55,480 27290 INFO [anomaly_serv.cpp:246] model cleared:
add time: 2.91017746925354
1.033468246459961
@TkrUdagawa
Copy link
Author

I have updated the benchmark result after applying jubatus/jubatus_core@a3784d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment