Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/0.4.1'

  • Loading branch information...
commit 42e0537532dc82e2ddcdf9c061c848f61f1cbda2 2 parents bd0fbfa + fb62049
@kmaehashi kmaehashi authored
Showing with 9,251 additions and 7,361 deletions.
  1. +5 −0 .gitignore
  2. +15 −0 README.rst
  3. +67 −61 client/anomaly_client.hpp
  4. +49 −45 client/classifier_client.hpp
  5. +137 −113 client/graph_client.hpp
  6. +94 −81 client/recommender_client.hpp
  7. +49 −45 client/regression_client.hpp
  8. +73 −65 client/stat_client.hpp
  9. +10 −0 jubatus-client.pc.in
  10. +1 −1  jubatus.pc.in
  11. +5 −2 src/anomaly/anomaly.hpp
  12. +5 −6 src/anomaly/anomaly_base.cpp
  13. +16 −9 src/anomaly/anomaly_base.hpp
  14. +19 −17 src/anomaly/anomaly_factory.cpp
  15. +11 −5 src/anomaly/anomaly_factory.hpp
  16. +11 −6 src/anomaly/anomaly_storage_base.hpp
  17. +6 −5 src/anomaly/anomaly_type.hpp
  18. +19 −9 src/anomaly/lof.cpp
  19. +18 −10 src/anomaly/lof.hpp
  20. +82 −56 src/anomaly/lof_storage.cpp
  21. +44 −31 src/anomaly/lof_storage.hpp
  22. +68 −48 src/anomaly/lof_storage_test.cpp
  23. +61 −43 src/anomaly/lof_test.cpp
  24. +41 −20 src/classifier/arow.cpp
  25. +18 −9 src/classifier/arow.hpp
  26. +5 −0 src/classifier/classifier.hpp
  27. +63 −37 src/classifier/classifier_base.cpp
  28. +35 −19 src/classifier/classifier_base.hpp
  29. +9 −6 src/classifier/classifier_config.hpp
  30. +11 −9 src/classifier/classifier_factory.cpp
  31. +23 −13 src/classifier/classifier_factory.hpp
  32. +54 −34 src/classifier/classifier_test.cpp
  33. +15 −9 src/classifier/classifier_test_util.hpp
  34. +13 −7 src/classifier/classifier_type.hpp
  35. +18 −9 src/classifier/classifier_util.hpp
  36. +37 −24 src/classifier/cw.cpp
  37. +17 −11 src/classifier/cw.hpp
  38. +45 −20 src/classifier/nherd.cpp
  39. +20 −11 src/classifier/nherd.hpp
  40. +13 −10 src/classifier/pa.cpp
  41. +12 −11 src/classifier/pa.hpp
  42. +17 −15 src/classifier/pa1.cpp
  43. +13 −10 src/classifier/pa1.hpp
  44. +16 −12 src/classifier/pa2.cpp
  45. +13 −8 src/classifier/pa2.hpp
  46. +12 −12 src/classifier/perceptron.cpp
  47. +12 −7 src/classifier/perceptron.hpp
  48. +90 −56 src/cmd/jubaconfig.cpp
  49. +46 −21 src/cmd/jubaconv.cpp
  50. +113 −68 src/cmd/jubactl.cpp
  51. +56 −44 src/common/cached_zk.cpp
  52. +15 −8 src/common/cached_zk.hpp
  53. +21 −23 src/common/cached_zk_test.cpp
  54. +71 −44 src/common/cht.cpp
  55. +44 −19 src/common/cht.hpp
  56. +4 −3 src/common/cht_test.cpp
  57. +0 −803 src/common/cmdline.h
  58. +87 −47 src/common/config.cpp
  59. +31 −10 src/common/config.hpp
  60. +32 −21 src/common/config_test.cpp
  61. +12 −7 src/common/config_util.cpp
  62. +15 −9 src/common/config_util.hpp
  63. +9 −5 src/common/config_util_test.cpp
  64. +12 −10 src/common/exception.cpp
  65. +143 −139 src/common/exception.hpp
  66. +32 −38 src/common/exception_info.hpp
  67. +50 −63 src/common/exception_test.cpp
  68. +51 −54 src/common/global_id_generator.cpp
  69. +13 −9 src/common/global_id_generator.hpp
  70. +2 −4 src/common/global_id_generator_test.cpp
  71. +7 −4 src/common/hash.hpp
  72. +4 −1 src/common/jsonconfig.hpp
  73. +56 −29 src/common/jsonconfig/cast.hpp
  74. +23 −15 src/common/jsonconfig/config.cpp
  75. +29 −18 src/common/jsonconfig/config.hpp
  76. +40 −25 src/common/jsonconfig/exception.cpp
  77. +20 −21 src/common/jsonconfig/exception.hpp
  78. +41 −23 src/common/jsonconfig_test.cpp
  79. +21 −19 src/common/key_manager.cpp
  80. +14 −11 src/common/key_manager.hpp
  81. +1 −1  src/common/key_manager_test.cpp
  82. +25 −23 src/common/lock_service.cpp
  83. +37 −18 src/common/lock_service.hpp
  84. +64 −47 src/common/membership.cpp
  85. +48 −15 src/common/membership.hpp
  86. +4 −3 src/common/membership_test.cpp
  87. +42 −40 src/common/mprpc/byte_buffer.hpp
  88. +28 −16 src/common/mprpc/exception.hpp
  89. +177 −112 src/common/mprpc/rpc_client_test.cpp
  90. +49 −24 src/common/mprpc/rpc_error.hpp
  91. +25 −15 src/common/mprpc/rpc_mclient.cpp
  92. +191 −122 src/common/mprpc/rpc_mclient.hpp
  93. +34 −16 src/common/mprpc/rpc_response.hpp
  94. +22 −11 src/common/mprpc/rpc_result.hpp
  95. +38 −34 src/common/mprpc/rpc_server.cpp
  96. +159 −104 src/common/mprpc/rpc_server.hpp
  97. +51 −47 src/common/network.cpp
  98. +14 −10 src/common/network.hpp
  99. +15 −9 src/common/network_test.cpp
  100. +8 −5 src/common/portable_mixer.hpp
  101. +18 −11 src/common/rpc_util.hpp
  102. +24 −17 src/common/shared_ptr.hpp
  103. +10 −4 src/common/type.hpp
  104. +18 −12 src/common/unordered_map.hpp
  105. +105 −99 src/common/util.cpp
  106. +16 −9 src/common/util.hpp
  107. +8 −8 src/common/util_test.cpp
  108. +10 −6 src/common/vector_util.cpp
  109. +5 −2 src/common/vector_util.hpp
  110. +22 −6 src/common/vector_util_test.cpp
  111. +22 −1 src/common/wscript
  112. +100 −93 src/common/zk.cpp
  113. +34 −19 src/common/zk.hpp
  114. +32 −34 src/common/zk_test.cpp
  115. +29 −25 src/framework/aggregators.hpp
  116. +23 −23 src/framework/keeper.cpp
  117. +427 −302 src/framework/keeper.hpp
  118. +31 −23 src/framework/keeper_common.cpp
  119. +24 −17 src/framework/keeper_common.hpp
  120. +53 −34 src/framework/mixable.hpp
  121. +30 −10 src/framework/mixable_test.cpp
  122. +23 −14 src/framework/mixer/dummy_mixer.hpp
  123. +84 −59 src/framework/mixer/linear_mixer.cpp
  124. +21 −13 src/framework/mixer/linear_mixer.hpp
  125. +50 −15 src/framework/mixer/linear_mixer_test.cpp
  126. +11 −7 src/framework/mixer/mixer.hpp
  127. +3 −3 src/framework/mixer/mixer_factory.cpp
  128. +7 −4 src/framework/mixer/mixer_factory.hpp
  129. +25 −14 src/framework/server_base.cpp
  130. +11 −7 src/framework/server_base.hpp
  131. +20 −13 src/framework/server_helper.cpp
  132. +36 −26 src/framework/server_helper.hpp
  133. +99 −65 src/framework/server_util.cpp
  134. +25 −22 src/framework/server_util.hpp
  135. +20 −3 src/framework/server_util_test.cpp
  136. +19 −12 src/fv_converter/character_ngram.cpp
  137. +13 −7 src/fv_converter/character_ngram.hpp
  138. +19 −16 src/fv_converter/character_ngram_test.cpp
  139. +127 −98 src/fv_converter/converter_config.cpp
  140. +25 −32 src/fv_converter/converter_config.hpp
  141. +29 −32 src/fv_converter/converter_config_test.cpp
  142. +14 −9 src/fv_converter/counter.hpp
  143. +8 −11 src/fv_converter/counter_test.cpp
  144. +15 −17 src/fv_converter/datum.hpp
  145. +194 −168 src/fv_converter/datum_to_fv_converter.cpp
  146. +41 −28 src/fv_converter/datum_to_fv_converter.hpp
  147. +131 −121 src/fv_converter/datum_to_fv_converter_test.cpp
  148. +12 −9 src/fv_converter/dynamic_loader.cpp
  149. +13 −10 src/fv_converter/dynamic_loader.hpp
  150. +3 −3 src/fv_converter/dynamic_loader_test.cpp
  151. +12 −9 src/fv_converter/dynamic_num_feature.cpp
  152. +13 −8 src/fv_converter/dynamic_num_feature.hpp
  153. +10 −10 src/fv_converter/dynamic_num_feature_test.cpp
  154. +8 −6 src/fv_converter/dynamic_num_filter.cpp
  155. +12 −7 src/fv_converter/dynamic_num_filter.hpp
  156. +17 −16 src/fv_converter/dynamic_num_filter_test.cpp
  157. +13 −8 src/fv_converter/dynamic_splitter.cpp
  158. +17 −9 src/fv_converter/dynamic_splitter.hpp
  159. +25 −20 src/fv_converter/dynamic_splitter_test.cpp
  160. +11 −8 src/fv_converter/dynamic_string_filter.cpp
  161. +11 −7 src/fv_converter/dynamic_string_filter.hpp
  162. +21 −19 src/fv_converter/dynamic_string_filter_test.cpp
  163. +13 −5 src/fv_converter/exact_match.hpp
  164. +9 −4 src/fv_converter/exception.hpp
  165. +6 −7 src/fv_converter/feature_hasher.cpp
  166. +7 −4 src/fv_converter/feature_hasher.hpp
  167. +4 −6 src/fv_converter/feature_hasher_test.cpp
  168. +69 −30 src/fv_converter/json_converter.cpp
  169. +11 −12 src/fv_converter/json_converter.hpp
  170. +61 −57 src/fv_converter/json_converter_test.cpp
  171. +10 −5 src/fv_converter/key_matcher.hpp
  172. +11 −9 src/fv_converter/key_matcher_factory.cpp
  173. +6 −3 src/fv_converter/key_matcher_factory.hpp
  174. +12 −10 src/fv_converter/key_matcher_factory_test.cpp
  175. +5 −8 src/fv_converter/key_matcher_test.cpp
  176. +15 −10 src/fv_converter/keyword_weights.cpp
  177. +15 −15 src/fv_converter/keyword_weights.hpp
  178. +26 −12 src/fv_converter/keyword_weights_test.cpp
  179. +20 −17 src/fv_converter/libsvm_converter.cpp
  180. +11 −6 src/fv_converter/libsvm_converter.hpp
  181. +11 −10 src/fv_converter/libsvm_converter_test.cpp
  182. +6 −3 src/fv_converter/match_all.hpp
  183. +23 −17 src/fv_converter/msgpack_converter.cpp
  184. +6 −4 src/fv_converter/msgpack_converter.hpp
  185. +26 −22 src/fv_converter/msgpack_converter_test.cpp
  186. +17 −9 src/fv_converter/num_feature.hpp
  187. +13 −12 src/fv_converter/num_feature_factory.cpp
  188. +7 −5 src/fv_converter/num_feature_factory.hpp
  189. +12 −14 src/fv_converter/num_feature_factory_test.cpp
  190. +17 −10 src/fv_converter/num_feature_impl.hpp
  191. +7 −4 src/fv_converter/num_filter.hpp
  192. +22 −18 src/fv_converter/num_filter_factory.cpp
  193. +9 −5 src/fv_converter/num_filter_factory.hpp
  194. +21 −28 src/fv_converter/num_filter_factory_test.cpp
  195. +8 −5 src/fv_converter/num_filter_impl.hpp
  196. +3 −3 src/fv_converter/num_filter_impl_test.cpp
  197. +11 −6 src/fv_converter/prefix_match.hpp
  198. +9 −13 src/fv_converter/re2_filter.cpp
  199. +6 −4 src/fv_converter/re2_filter.hpp
  200. +7 −4 src/fv_converter/re2_filter_test.cpp
  201. +5 −3 src/fv_converter/re2_match.cpp
  202. +8 −4 src/fv_converter/re2_match.hpp
  203. +6 −5 src/fv_converter/re2_match_test.cpp
  204. +29 −31 src/fv_converter/revert.cpp
  205. +14 −9 src/fv_converter/revert.hpp
  206. +48 −27 src/fv_converter/revert_test.cpp
  207. +15 −12 src/fv_converter/space_splitter.cpp
  208. +12 −5 src/fv_converter/space_splitter.hpp
  209. +42 −34 src/fv_converter/space_splitter_test.cpp
  210. +23 −17 src/fv_converter/splitter_factory.cpp
  211. +6 −3 src/fv_converter/splitter_factory.hpp
  212. +16 −15 src/fv_converter/splitter_factory_test.cpp
  213. +8 −4 src/fv_converter/string_filter.hpp
  214. +20 −19 src/fv_converter/string_filter_factory.cpp
  215. +7 −5 src/fv_converter/string_filter_factory.hpp
  216. +15 −14 src/fv_converter/string_filter_factory_test.cpp
  217. +0 −41 src/fv_converter/string_splitter.hpp
  218. +12 −5 src/fv_converter/suffix_match.hpp
  219. +16 −10 src/fv_converter/test_num_feature.cpp
  220. +8 −7 src/fv_converter/test_num_filter.cpp
  221. +16 −13 src/fv_converter/test_splitter.cpp
  222. +10 −13 src/fv_converter/test_string_filter.cpp
  223. +0 −42 src/fv_converter/test_util.hpp
  224. +25 −19 src/fv_converter/util.cpp
  225. +16 −10 src/fv_converter/util.hpp
  226. +23 −14 src/fv_converter/weight_manager.cpp
  227. +25 −22 src/fv_converter/weight_manager.hpp
  228. +29 −16 src/fv_converter/weight_manager_test.cpp
  229. +10 −7 src/fv_converter/without_split.cpp
  230. +11 −6 src/fv_converter/without_split.hpp
  231. +18 −12 src/fv_converter/word_splitter.hpp
  232. +4 −1 src/graph/graph.hpp
  233. +7 −8 src/graph/graph_base.cpp
  234. +42 −28 src/graph/graph_base.hpp
  235. +72 −32 src/graph/graph_base_test.cpp
  236. +12 −9 src/graph/graph_factory.cpp
  237. +14 −6 src/graph/graph_factory.hpp
  238. +104 −85 src/graph/graph_type.hpp
  239. +204 −161 src/graph/graph_wo_index.cpp
  240. +73 −33 src/graph/graph_wo_index.hpp
  241. +48 −29 src/graph/graph_wo_index_test.cpp
  242. +1 −0  src/graph/wscript
  243. +92 −74 src/jubavisor/jubavisor.cpp
  244. +33 −21 src/jubavisor/jubavisor.hpp
  245. +5 −6 src/jubavisor/jubavisor_test.cpp
  246. +25 −21 src/jubavisor/main.cpp
  247. +69 −62 src/jubavisor/process.cpp
  248. +45 −29 src/jubavisor/process.hpp
  249. +22 −18 src/plugin/fv_converter/mecab_splitter.cpp
  250. +12 −6 src/plugin/fv_converter/mecab_splitter.hpp
  251. +40 −44 src/plugin/fv_converter/mecab_splitter_test.cpp
  252. +36 −29 src/plugin/fv_converter/re2_splitter.cpp
  253. +13 −8 src/plugin/fv_converter/re2_splitter.hpp
  254. +25 −7 src/plugin/fv_converter/re2_splitter_test.cpp
  255. +25 −23 src/plugin/fv_converter/ux_splitter.cpp
  256. +11 −6 src/plugin/fv_converter/ux_splitter.hpp
  257. +13 −12 src/plugin/fv_converter/ux_splitter_test.cpp
  258. +48 −31 src/recommender/euclid_lsh.cpp
  259. +32 −13 src/recommender/euclid_lsh.hpp
  260. +18 −21 src/recommender/euclid_lsh_test.cpp
  261. +38 −22 src/recommender/inverted_index.cpp
  262. +19 −7 src/recommender/inverted_index.hpp
  263. +47 −32 src/recommender/lsh.cpp
  264. +25 −11 src/recommender/lsh.hpp
  265. +18 −16 src/recommender/lsh_util.cpp
  266. +11 −7 src/recommender/lsh_util.hpp
  267. +25 −4 src/recommender/lsh_util_test.cpp
  268. +83 −46 src/recommender/minhash.cpp
  269. +23 −11 src/recommender/minhash.hpp
  270. +4 −1 src/recommender/recommender.hpp
  271. +41 −28 src/recommender/recommender_base.cpp
  272. +32 −12 src/recommender/recommender_base.hpp
  273. +71 −31 src/recommender/recommender_base_test.cpp
  274. +11 −13 src/recommender/recommender_factory.cpp
  275. +14 −6 src/recommender/recommender_factory.hpp
  276. +34 −21 src/recommender/recommender_mock.cpp
  277. +32 −13 src/recommender/recommender_mock.hpp
  278. +31 −20 src/recommender/recommender_mock_storage.cpp
  279. +36 −24 src/recommender/recommender_mock_storage.hpp
  280. +10 −5 src/recommender/recommender_mock_storage_test.cpp
  281. +10 −3 src/recommender/recommender_mock_test.cpp
  282. +8 −3 src/recommender/recommender_mock_util.cpp
  283. +6 −3 src/recommender/recommender_mock_util.hpp
  284. +61 −34 src/recommender/recommender_random_test.cpp
  285. +5 −5 src/recommender/recommender_type.hpp
  286. +14 −10 src/regression/pa.cpp
  287. +14 −9 src/regression/pa.hpp
  288. +4 −1 src/regression/regression.hpp
  289. +4 −3 src/regression/regression_base.cpp
  290. +10 −7 src/regression/regression_base.hpp
  291. +10 −8 src/regression/regression_factory.cpp
  292. +17 −11 src/regression/regression_factory.hpp
  293. +24 −5 src/regression/regression_factory_test.cpp
  294. +37 −15 src/regression/regression_test.cpp
  295. +18 −9 src/regression/regression_test_util.hpp
  296. +66 −58 src/server/anomaly_client.hpp
  297. +75 −44 src/server/anomaly_impl.cpp
  298. +48 −19 src/server/anomaly_keeper.cpp
  299. +54 −39 src/server/anomaly_serv.cpp
  300. +29 −18 src/server/anomaly_serv.hpp
Sorry, we could not display the entire diff because too many files (446) changed.
View
5 .gitignore
@@ -12,3 +12,8 @@ cscope.*
callgrind.*
.unittest-gtest
*.tar.gz
+*.omakedb
+*.omakedb.lock
+*.omc
+*.cmi
+*.cmx
View
15 README.rst
@@ -31,6 +31,21 @@ LGPL 2.1
Update history
--------------
+Release 0.4.1 2013/2/15
+~~~~~~~~~~~~~~~~~~~~~~
+
+Improvements
+ - New code generator 'jenerator' for framework users (#240)
+ - Applied coding rules based on Google C++ Style Guide
+ - jubaconv accepts v0.4.x configuration format (#223, #241)
+ - jubaconfig validates JSON syntax of configuration (#226, #245)
+ - server/keeper behaves more stably in distributed mode when failed to start listening (#201)
+ - pkg-config manifest for Jubatus clients (#228)
+
+Bugfix
+ - jubastat returns min/max from values only the current window (#238, #242)
+ - #230, #231, #233, #234, #235, #237, #248
+
Release 0.4.0 2013/1/11
~~~~~~~~~~~~~~~~~~~~~~~
View
128 client/anomaly_client.hpp
@@ -1,78 +1,84 @@
-
// This file is auto-generated from anomaly.idl
// *** DO NOT EDIT ***
-#ifndef ANOMALY_CLIENT_HPP_
-#define ANOMALY_CLIENT_HPP_
-
+#ifndef JUBATUS_ANOMALY_CLIENT_HPP_
+#define JUBATUS_ANOMALY_CLIENT_HPP_
-#include "anomaly_types.hpp"
+#include <map>
+#include <string>
+#include <vector>
+#include <utility>
#include <jubatus/msgpack/rpc/client.h>
-
+#include "anomaly_types.hpp"
namespace jubatus {
-
namespace anomaly {
-
namespace client {
class anomaly {
-public:
- anomaly(const std::string &host, uint64_t port, double timeout_sec)
- : c_(host, port) {
- c_.set_timeout( timeout_sec );
+ public:
+ anomaly(const std::string& host, uint64_t port, double timeout_sec)
+ : c_(host, port) {
+ c_.set_timeout(timeout_sec);
+ }
+
+ std::string get_config(std::string name) {
+ msgpack::rpc::future f = c_.call("get_config", name);
+ return f.get<std::string>();
+ }
+
+ bool clear_row(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("clear_row", name, id);
+ return f.get<bool>();
+ }
+
+ std::pair<std::string, float> add(std::string name, datum row) {
+ msgpack::rpc::future f = c_.call("add", name, row);
+ return f.get<std::pair<std::string, float> >();
+ }
+
+ float update(std::string name, std::string id, datum row) {
+ msgpack::rpc::future f = c_.call("update", name, id, row);
+ return f.get<float>();
+ }
+
+ bool clear(std::string name) {
+ msgpack::rpc::future f = c_.call("clear", name);
+ return f.get<bool>();
+ }
+
+ float calc_score(std::string name, datum row) {
+ msgpack::rpc::future f = c_.call("calc_score", name, row);
+ return f.get<float>();
+ }
+
+ std::vector<std::string> get_all_rows(std::string name) {
+ msgpack::rpc::future f = c_.call("get_all_rows", name);
+ return f.get<std::vector<std::string> >();
+ }
+
+ bool save(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("save", name, id);
+ return f.get<bool>();
+ }
+
+ bool load(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("load", name, id);
+ return f.get<bool>();
+ }
+
+ std::map<std::string, std::map<std::string, std::string> > get_status(
+ std::string name) {
+ msgpack::rpc::future f = c_.call("get_status", name);
+ return f.get<std::map<std::string, std::map<std::string, std::string> > >();
}
- std::string get_config(std::string name) {
- return c_.call("get_config", name).get<std::string >();
- }
-
- bool clear_row(std::string name, std::string id) {
- return c_.call("clear_row", name, id).get<bool >();
- }
-
- std::pair<std::string, float > add(std::string name, datum row) {
- return c_.call("add", name, row).get<std::pair<std::string, float > >();
- }
-
- float update(std::string name, std::string id, datum row) {
- return c_.call("update", name, id, row).get<float >();
- }
-
- bool clear(std::string name) {
- return c_.call("clear", name).get<bool >();
- }
-
- float calc_score(std::string name, datum row) {
- return c_.call("calc_score", name, row).get<float >();
- }
-
- std::vector<std::string > get_all_rows(std::string name) {
- return c_.call("get_all_rows", name).get<std::vector<std::string > >();
- }
-
- bool save(std::string name, std::string id) {
- return c_.call("save", name, id).get<bool >();
- }
-
- bool load(std::string name, std::string id) {
- return c_.call("load", name, id).get<bool >();
- }
-
- std::map<std::string, std::map<std::string, std::string > > get_status(std::string name) {
- return c_.call("get_status", name).get<std::map<std::string, std::map<std::string, std::string > > >();
- }
-
-private:
+ private:
msgpack::rpc::client c_;
};
-} // namespace client
-
-} // namespace anomaly
-
-} // namespace jubatus
-
-
+} // namespace client
+} // namespace anomaly
+} // namespace jubatus
-#endif // ANOMALY_CLIENT_HPP_
+#endif // JUBATUS_ANOMALY_CLIENT_HPP_
View
94 client/classifier_client.hpp
@@ -1,62 +1,66 @@
-
// This file is auto-generated from classifier.idl
// *** DO NOT EDIT ***
-#ifndef CLASSIFIER_CLIENT_HPP_
-#define CLASSIFIER_CLIENT_HPP_
-
+#ifndef JUBATUS_CLASSIFIER_CLIENT_HPP_
+#define JUBATUS_CLASSIFIER_CLIENT_HPP_
-#include "classifier_types.hpp"
+#include <map>
+#include <string>
+#include <vector>
+#include <utility>
#include <jubatus/msgpack/rpc/client.h>
-
+#include "classifier_types.hpp"
namespace jubatus {
-
namespace classifier {
-
namespace client {
class classifier {
-public:
- classifier(const std::string &host, uint64_t port, double timeout_sec)
- : c_(host, port) {
- c_.set_timeout( timeout_sec );
+ public:
+ classifier(const std::string& host, uint64_t port, double timeout_sec)
+ : c_(host, port) {
+ c_.set_timeout(timeout_sec);
+ }
+
+ std::string get_config(std::string name) {
+ msgpack::rpc::future f = c_.call("get_config", name);
+ return f.get<std::string>();
+ }
+
+ int32_t train(std::string name, std::vector<std::pair<std::string,
+ datum> > data) {
+ msgpack::rpc::future f = c_.call("train", name, data);
+ return f.get<int32_t>();
+ }
+
+ std::vector<std::vector<estimate_result> > classify(std::string name,
+ std::vector<datum> data) {
+ msgpack::rpc::future f = c_.call("classify", name, data);
+ return f.get<std::vector<std::vector<estimate_result> > >();
+ }
+
+ bool save(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("save", name, id);
+ return f.get<bool>();
+ }
+
+ bool load(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("load", name, id);
+ return f.get<bool>();
+ }
+
+ std::map<std::string, std::map<std::string, std::string> > get_status(
+ std::string name) {
+ msgpack::rpc::future f = c_.call("get_status", name);
+ return f.get<std::map<std::string, std::map<std::string, std::string> > >();
}
- std::string get_config(std::string name) {
- return c_.call("get_config", name).get<std::string >();
- }
-
- int32_t train(std::string name, std::vector<std::pair<std::string, datum > > data) {
- return c_.call("train", name, data).get<int32_t >();
- }
-
- std::vector<std::vector<estimate_result > > classify(std::string name, std::vector<datum > data) {
- return c_.call("classify", name, data).get<std::vector<std::vector<estimate_result > > >();
- }
-
- bool save(std::string name, std::string id) {
- return c_.call("save", name, id).get<bool >();
- }
-
- bool load(std::string name, std::string id) {
- return c_.call("load", name, id).get<bool >();
- }
-
- std::map<std::string, std::map<std::string, std::string > > get_status(std::string name) {
- return c_.call("get_status", name).get<std::map<std::string, std::map<std::string, std::string > > >();
- }
-
-private:
+ private:
msgpack::rpc::client c_;
};
-} // namespace client
-
-} // namespace classifier
-
-} // namespace jubatus
-
-
+} // namespace client
+} // namespace classifier
+} // namespace jubatus
-#endif // CLASSIFIER_CLIENT_HPP_
+#endif // JUBATUS_CLASSIFIER_CLIENT_HPP_
View
250 client/graph_client.hpp
@@ -1,130 +1,154 @@
-
// This file is auto-generated from graph.idl
// *** DO NOT EDIT ***
-#ifndef GRAPH_CLIENT_HPP_
-#define GRAPH_CLIENT_HPP_
-
+#ifndef JUBATUS_GRAPH_CLIENT_HPP_
+#define JUBATUS_GRAPH_CLIENT_HPP_
-#include "graph_types.hpp"
+#include <map>
+#include <string>
+#include <vector>
+#include <utility>
#include <jubatus/msgpack/rpc/client.h>
-
+#include "graph_types.hpp"
namespace jubatus {
-
namespace graph {
-
namespace client {
class graph {
-public:
- graph(const std::string &host, uint64_t port, double timeout_sec)
- : c_(host, port) {
- c_.set_timeout( timeout_sec );
+ public:
+ graph(const std::string& host, uint64_t port, double timeout_sec)
+ : c_(host, port) {
+ c_.set_timeout(timeout_sec);
+ }
+
+ std::string get_config(std::string name) {
+ msgpack::rpc::future f = c_.call("get_config", name);
+ return f.get<std::string>();
+ }
+
+ std::string create_node(std::string name) {
+ msgpack::rpc::future f = c_.call("create_node", name);
+ return f.get<std::string>();
+ }
+
+ bool remove_node(std::string name, std::string node_id) {
+ msgpack::rpc::future f = c_.call("remove_node", name, node_id);
+ return f.get<bool>();
+ }
+
+ bool update_node(std::string name, std::string node_id, std::map<std::string,
+ std::string> property) {
+ msgpack::rpc::future f = c_.call("update_node", name, node_id, property);
+ return f.get<bool>();
+ }
+
+ uint64_t create_edge(std::string name, std::string node_id, edge e) {
+ msgpack::rpc::future f = c_.call("create_edge", name, node_id, e);
+ return f.get<uint64_t>();
+ }
+
+ bool update_edge(std::string name, std::string node_id, uint64_t edge_id,
+ edge e) {
+ msgpack::rpc::future f = c_.call("update_edge", name, node_id, edge_id, e);
+ return f.get<bool>();
+ }
+
+ bool remove_edge(std::string name, std::string node_id, uint64_t edge_id) {
+ msgpack::rpc::future f = c_.call("remove_edge", name, node_id, edge_id);
+ return f.get<bool>();
+ }
+
+ double get_centrality(std::string name, std::string node_id,
+ int32_t centrality_type, preset_query query) {
+ msgpack::rpc::future f = c_.call("get_centrality", name, node_id,
+ centrality_type, query);
+ return f.get<double>();
+ }
+
+ bool add_centrality_query(std::string name, preset_query query) {
+ msgpack::rpc::future f = c_.call("add_centrality_query", name, query);
+ return f.get<bool>();
+ }
+
+ bool add_shortest_path_query(std::string name, preset_query query) {
+ msgpack::rpc::future f = c_.call("add_shortest_path_query", name, query);
+ return f.get<bool>();
+ }
+
+ bool remove_centrality_query(std::string name, preset_query query) {
+ msgpack::rpc::future f = c_.call("remove_centrality_query", name, query);
+ return f.get<bool>();
+ }
+
+ bool remove_shortest_path_query(std::string name, preset_query query) {
+ msgpack::rpc::future f = c_.call("remove_shortest_path_query", name, query);
+ return f.get<bool>();
+ }
+
+ std::vector<std::string> get_shortest_path(std::string name,
+ shortest_path_query query) {
+ msgpack::rpc::future f = c_.call("get_shortest_path", name, query);
+ return f.get<std::vector<std::string> >();
+ }
+
+ bool update_index(std::string name) {
+ msgpack::rpc::future f = c_.call("update_index", name);
+ return f.get<bool>();
+ }
+
+ bool clear(std::string name) {
+ msgpack::rpc::future f = c_.call("clear", name);
+ return f.get<bool>();
+ }
+
+ node get_node(std::string name, std::string node_id) {
+ msgpack::rpc::future f = c_.call("get_node", name, node_id);
+ return f.get<node>();
+ }
+
+ edge get_edge(std::string name, std::string node_id, uint64_t edge_id) {
+ msgpack::rpc::future f = c_.call("get_edge", name, node_id, edge_id);
+ return f.get<edge>();
+ }
+
+ bool save(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("save", name, id);
+ return f.get<bool>();
+ }
+
+ bool load(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("load", name, id);
+ return f.get<bool>();
+ }
+
+ std::map<std::string, std::map<std::string, std::string> > get_status(
+ std::string name) {
+ msgpack::rpc::future f = c_.call("get_status", name);
+ return f.get<std::map<std::string, std::map<std::string, std::string> > >();
+ }
+
+ bool create_node_here(std::string name, std::string node_id) {
+ msgpack::rpc::future f = c_.call("create_node_here", name, node_id);
+ return f.get<bool>();
+ }
+
+ bool remove_global_node(std::string name, std::string node_id) {
+ msgpack::rpc::future f = c_.call("remove_global_node", name, node_id);
+ return f.get<bool>();
+ }
+
+ bool create_edge_here(std::string name, uint64_t edge_id, edge e) {
+ msgpack::rpc::future f = c_.call("create_edge_here", name, edge_id, e);
+ return f.get<bool>();
}
- std::string get_config(std::string name) {
- return c_.call("get_config", name).get<std::string >();
- }
-
- std::string create_node(std::string name) {
- return c_.call("create_node", name).get<std::string >();
- }
-
- bool remove_node(std::string name, std::string node_id) {
- return c_.call("remove_node", name, node_id).get<bool >();
- }
-
- bool update_node(std::string name, std::string node_id, std::map<std::string, std::string > property) {
- return c_.call("update_node", name, node_id, property).get<bool >();
- }
-
- uint64_t create_edge(std::string name, std::string node_id, edge e) {
- return c_.call("create_edge", name, node_id, e).get<uint64_t >();
- }
-
- bool update_edge(std::string name, std::string node_id, uint64_t edge_id, edge e) {
- return c_.call("update_edge", name, node_id, edge_id, e).get<bool >();
- }
-
- bool remove_edge(std::string name, std::string node_id, uint64_t edge_id) {
- return c_.call("remove_edge", name, node_id, edge_id).get<bool >();
- }
-
- double get_centrality(std::string name, std::string node_id, int32_t centrality_type, preset_query query) {
- return c_.call("get_centrality", name, node_id, centrality_type, query).get<double >();
- }
-
- bool add_centrality_query(std::string name, preset_query query) {
- return c_.call("add_centrality_query", name, query).get<bool >();
- }
-
- bool add_shortest_path_query(std::string name, preset_query query) {
- return c_.call("add_shortest_path_query", name, query).get<bool >();
- }
-
- bool remove_centrality_query(std::string name, preset_query query) {
- return c_.call("remove_centrality_query", name, query).get<bool >();
- }
-
- bool remove_shortest_path_query(std::string name, preset_query query) {
- return c_.call("remove_shortest_path_query", name, query).get<bool >();
- }
-
- std::vector<std::string > get_shortest_path(std::string name, shortest_path_query query) {
- return c_.call("get_shortest_path", name, query).get<std::vector<std::string > >();
- }
-
- bool update_index(std::string name) {
- return c_.call("update_index", name).get<bool >();
- }
-
- bool clear(std::string name) {
- return c_.call("clear", name).get<bool >();
- }
-
- node get_node(std::string name, std::string node_id) {
- return c_.call("get_node", name, node_id).get<node >();
- }
-
- edge get_edge(std::string name, std::string node_id, uint64_t edge_id) {
- return c_.call("get_edge", name, node_id, edge_id).get<edge >();
- }
-
- bool save(std::string name, std::string id) {
- return c_.call("save", name, id).get<bool >();
- }
-
- bool load(std::string name, std::string id) {
- return c_.call("load", name, id).get<bool >();
- }
-
- std::map<std::string, std::map<std::string, std::string > > get_status(std::string name) {
- return c_.call("get_status", name).get<std::map<std::string, std::map<std::string, std::string > > >();
- }
-
- bool create_node_here(std::string name, std::string node_id) {
- return c_.call("create_node_here", name, node_id).get<bool >();
- }
-
- bool remove_global_node(std::string name, std::string node_id) {
- return c_.call("remove_global_node", name, node_id).get<bool >();
- }
-
- bool create_edge_here(std::string name, uint64_t edge_id, edge e) {
- return c_.call("create_edge_here", name, edge_id, e).get<bool >();
- }
-
-private:
+ private:
msgpack::rpc::client c_;
};
-} // namespace client
-
-} // namespace graph
-
-} // namespace jubatus
-
-
+} // namespace client
+} // namespace graph
+} // namespace jubatus
-#endif // GRAPH_CLIENT_HPP_
+#endif // JUBATUS_GRAPH_CLIENT_HPP_
View
175 client/recommender_client.hpp
@@ -1,98 +1,111 @@
-
// This file is auto-generated from recommender.idl
// *** DO NOT EDIT ***
-#ifndef RECOMMENDER_CLIENT_HPP_
-#define RECOMMENDER_CLIENT_HPP_
-
+#ifndef JUBATUS_RECOMMENDER_CLIENT_HPP_
+#define JUBATUS_RECOMMENDER_CLIENT_HPP_
-#include "recommender_types.hpp"
+#include <map>
+#include <string>
+#include <vector>
+#include <utility>
#include <jubatus/msgpack/rpc/client.h>
-
+#include "recommender_types.hpp"
namespace jubatus {
-
namespace recommender {
-
namespace client {
class recommender {
-public:
- recommender(const std::string &host, uint64_t port, double timeout_sec)
- : c_(host, port) {
- c_.set_timeout( timeout_sec );
+ public:
+ recommender(const std::string& host, uint64_t port, double timeout_sec)
+ : c_(host, port) {
+ c_.set_timeout(timeout_sec);
+ }
+
+ std::string get_config(std::string name) {
+ msgpack::rpc::future f = c_.call("get_config", name);
+ return f.get<std::string>();
+ }
+
+ bool clear_row(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("clear_row", name, id);
+ return f.get<bool>();
+ }
+
+ bool update_row(std::string name, std::string id, datum row) {
+ msgpack::rpc::future f = c_.call("update_row", name, id, row);
+ return f.get<bool>();
+ }
+
+ bool clear(std::string name) {
+ msgpack::rpc::future f = c_.call("clear", name);
+ return f.get<bool>();
+ }
+
+ datum complete_row_from_id(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("complete_row_from_id", name, id);
+ return f.get<datum>();
+ }
+
+ datum complete_row_from_datum(std::string name, datum row) {
+ msgpack::rpc::future f = c_.call("complete_row_from_datum", name, row);
+ return f.get<datum>();
+ }
+
+ similar_result similar_row_from_id(std::string name, std::string id,
+ uint32_t size) {
+ msgpack::rpc::future f = c_.call("similar_row_from_id", name, id, size);
+ return f.get<similar_result>();
+ }
+
+ similar_result similar_row_from_datum(std::string name, datum row,
+ uint32_t size) {
+ msgpack::rpc::future f = c_.call("similar_row_from_datum", name, row, size);
+ return f.get<similar_result>();
+ }
+
+ datum decode_row(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("decode_row", name, id);
+ return f.get<datum>();
+ }
+
+ std::vector<std::string> get_all_rows(std::string name) {
+ msgpack::rpc::future f = c_.call("get_all_rows", name);
+ return f.get<std::vector<std::string> >();
+ }
+
+ float calc_similarity(std::string name, datum lhs, datum rhs) {
+ msgpack::rpc::future f = c_.call("calc_similarity", name, lhs, rhs);
+ return f.get<float>();
+ }
+
+ float calc_l2norm(std::string name, datum row) {
+ msgpack::rpc::future f = c_.call("calc_l2norm", name, row);
+ return f.get<float>();
+ }
+
+ bool save(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("save", name, id);
+ return f.get<bool>();
+ }
+
+ bool load(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("load", name, id);
+ return f.get<bool>();
+ }
+
+ std::map<std::string, std::map<std::string, std::string> > get_status(
+ std::string name) {
+ msgpack::rpc::future f = c_.call("get_status", name);
+ return f.get<std::map<std::string, std::map<std::string, std::string> > >();
}
- std::string get_config(std::string name) {
- return c_.call("get_config", name).get<std::string >();
- }
-
- bool clear_row(std::string name, std::string id) {
- return c_.call("clear_row", name, id).get<bool >();
- }
-
- bool update_row(std::string name, std::string id, datum row) {
- return c_.call("update_row", name, id, row).get<bool >();
- }
-
- bool clear(std::string name) {
- return c_.call("clear", name).get<bool >();
- }
-
- datum complete_row_from_id(std::string name, std::string id) {
- return c_.call("complete_row_from_id", name, id).get<datum >();
- }
-
- datum complete_row_from_datum(std::string name, datum row) {
- return c_.call("complete_row_from_datum", name, row).get<datum >();
- }
-
- similar_result similar_row_from_id(std::string name, std::string id, uint32_t size) {
- return c_.call("similar_row_from_id", name, id, size).get<similar_result >();
- }
-
- similar_result similar_row_from_datum(std::string name, datum row, uint32_t size) {
- return c_.call("similar_row_from_datum", name, row, size).get<similar_result >();
- }
-
- datum decode_row(std::string name, std::string id) {
- return c_.call("decode_row", name, id).get<datum >();
- }
-
- std::vector<std::string > get_all_rows(std::string name) {
- return c_.call("get_all_rows", name).get<std::vector<std::string > >();
- }
-
- float calc_similarity(std::string name, datum lhs, datum rhs) {
- return c_.call("calc_similarity", name, lhs, rhs).get<float >();
- }
-
- float calc_l2norm(std::string name, datum row) {
- return c_.call("calc_l2norm", name, row).get<float >();
- }
-
- bool save(std::string name, std::string id) {
- return c_.call("save", name, id).get<bool >();
- }
-
- bool load(std::string name, std::string id) {
- return c_.call("load", name, id).get<bool >();
- }
-
- std::map<std::string, std::map<std::string, std::string > > get_status(std::string name) {
- return c_.call("get_status", name).get<std::map<std::string, std::map<std::string, std::string > > >();
- }
-
-private:
+ private:
msgpack::rpc::client c_;
};
-} // namespace client
-
-} // namespace recommender
-
-} // namespace jubatus
-
-
+} // namespace client
+} // namespace recommender
+} // namespace jubatus
-#endif // RECOMMENDER_CLIENT_HPP_
+#endif // JUBATUS_RECOMMENDER_CLIENT_HPP_
View
94 client/regression_client.hpp
@@ -1,62 +1,66 @@
-
// This file is auto-generated from regression.idl
// *** DO NOT EDIT ***
-#ifndef REGRESSION_CLIENT_HPP_
-#define REGRESSION_CLIENT_HPP_
-
+#ifndef JUBATUS_REGRESSION_CLIENT_HPP_
+#define JUBATUS_REGRESSION_CLIENT_HPP_
-#include "regression_types.hpp"
+#include <map>
+#include <string>
+#include <vector>
+#include <utility>
#include <jubatus/msgpack/rpc/client.h>
-
+#include "regression_types.hpp"
namespace jubatus {
-
namespace regression {
-
namespace client {
class regression {
-public:
- regression(const std::string &host, uint64_t port, double timeout_sec)
- : c_(host, port) {
- c_.set_timeout( timeout_sec );
+ public:
+ regression(const std::string& host, uint64_t port, double timeout_sec)
+ : c_(host, port) {
+ c_.set_timeout(timeout_sec);
+ }
+
+ std::string get_config(std::string name) {
+ msgpack::rpc::future f = c_.call("get_config", name);
+ return f.get<std::string>();
+ }
+
+ int32_t train(std::string name, std::vector<std::pair<float,
+ datum> > train_data) {
+ msgpack::rpc::future f = c_.call("train", name, train_data);
+ return f.get<int32_t>();
+ }
+
+ std::vector<float> estimate(std::string name,
+ std::vector<datum> estimate_data) {
+ msgpack::rpc::future f = c_.call("estimate", name, estimate_data);
+ return f.get<std::vector<float> >();
+ }
+
+ bool save(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("save", name, id);
+ return f.get<bool>();
+ }
+
+ bool load(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("load", name, id);
+ return f.get<bool>();
+ }
+
+ std::map<std::string, std::map<std::string, std::string> > get_status(
+ std::string name) {
+ msgpack::rpc::future f = c_.call("get_status", name);
+ return f.get<std::map<std::string, std::map<std::string, std::string> > >();
}
- std::string get_config(std::string name) {
- return c_.call("get_config", name).get<std::string >();
- }
-
- int32_t train(std::string name, std::vector<std::pair<float, datum > > train_data) {
- return c_.call("train", name, train_data).get<int32_t >();
- }
-
- std::vector<float > estimate(std::string name, std::vector<datum > estimate_data) {
- return c_.call("estimate", name, estimate_data).get<std::vector<float > >();
- }
-
- bool save(std::string name, std::string id) {
- return c_.call("save", name, id).get<bool >();
- }
-
- bool load(std::string name, std::string id) {
- return c_.call("load", name, id).get<bool >();
- }
-
- std::map<std::string, std::map<std::string, std::string > > get_status(std::string name) {
- return c_.call("get_status", name).get<std::map<std::string, std::map<std::string, std::string > > >();
- }
-
-private:
+ private:
msgpack::rpc::client c_;
};
-} // namespace client
-
-} // namespace regression
-
-} // namespace jubatus
-
-
+} // namespace client
+} // namespace regression
+} // namespace jubatus
-#endif // REGRESSION_CLIENT_HPP_
+#endif // JUBATUS_REGRESSION_CLIENT_HPP_
View
138 client/stat_client.hpp
@@ -1,82 +1,90 @@
-
// This file is auto-generated from stat.idl
// *** DO NOT EDIT ***
-#ifndef STAT_CLIENT_HPP_
-#define STAT_CLIENT_HPP_
-
+#ifndef JUBATUS_STAT_CLIENT_HPP_
+#define JUBATUS_STAT_CLIENT_HPP_
-#include "stat_types.hpp"
+#include <map>
+#include <string>
+#include <vector>
+#include <utility>
#include <jubatus/msgpack/rpc/client.h>
-
+#include "stat_types.hpp"
namespace jubatus {
-
namespace stat {
-
namespace client {
class stat {
-public:
- stat(const std::string &host, uint64_t port, double timeout_sec)
- : c_(host, port) {
- c_.set_timeout( timeout_sec );
+ public:
+ stat(const std::string& host, uint64_t port, double timeout_sec)
+ : c_(host, port) {
+ c_.set_timeout(timeout_sec);
+ }
+
+ std::string get_config(std::string name) {
+ msgpack::rpc::future f = c_.call("get_config", name);
+ return f.get<std::string>();
+ }
+
+ bool push(std::string name, std::string key, double value) {
+ msgpack::rpc::future f = c_.call("push", name, key, value);
+ return f.get<bool>();
+ }
+
+ double sum(std::string name, std::string key) {
+ msgpack::rpc::future f = c_.call("sum", name, key);
+ return f.get<double>();
+ }
+
+ double stddev(std::string name, std::string key) {
+ msgpack::rpc::future f = c_.call("stddev", name, key);
+ return f.get<double>();
+ }
+
+ double max(std::string name, std::string key) {
+ msgpack::rpc::future f = c_.call("max", name, key);
+ return f.get<double>();
+ }
+
+ double min(std::string name, std::string key) {
+ msgpack::rpc::future f = c_.call("min", name, key);
+ return f.get<double>();
+ }
+
+ double entropy(std::string name, std::string key) {
+ msgpack::rpc::future f = c_.call("entropy", name, key);
+ return f.get<double>();
+ }
+
+ double moment(std::string name, std::string key, int32_t degree,
+ double center) {
+ msgpack::rpc::future f = c_.call("moment", name, key, degree, center);
+ return f.get<double>();
+ }
+
+ bool save(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("save", name, id);
+ return f.get<bool>();
+ }
+
+ bool load(std::string name, std::string id) {
+ msgpack::rpc::future f = c_.call("load", name, id);
+ return f.get<bool>();
+ }
+
+ std::map<std::string, std::map<std::string, std::string> > get_status(
+ std::string name) {
+ msgpack::rpc::future f = c_.call("get_status", name);
+ return f.get<std::map<std::string, std::map<std::string, std::string> > >();
}
- std::string get_config(std::string name) {
- return c_.call("get_config", name).get<std::string >();
- }
-
- bool push(std::string name, std::string key, double value) {
- return c_.call("push", name, key, value).get<bool >();
- }
-
- double sum(std::string name, std::string key) {
- return c_.call("sum", name, key).get<double >();
- }
-
- double stddev(std::string name, std::string key) {
- return c_.call("stddev", name, key).get<double >();
- }
-
- double max(std::string name, std::string key) {
- return c_.call("max", name, key).get<double >();
- }
-
- double min(std::string name, std::string key) {
- return c_.call("min", name, key).get<double >();
- }
-
- double entropy(std::string name, std::string key) {
- return c_.call("entropy", name, key).get<double >();
- }
-
- double moment(std::string name, std::string key, int32_t degree, double center) {
- return c_.call("moment", name, key, degree, center).get<double >();
- }
-
- bool save(std::string name, std::string id) {
- return c_.call("save", name, id).get<bool >();
- }
-
- bool load(std::string name, std::string id) {
- return c_.call("load", name, id).get<bool >();
- }
-
- std::map<std::string, std::map<std::string, std::string > > get_status(std::string name) {
- return c_.call("get_status", name).get<std::map<std::string, std::map<std::string, std::string > > >();
- }
-
-private:
+ private:
msgpack::rpc::client c_;
};
-} // namespace client
-
-} // namespace stat
-
-} // namespace jubatus
-
-
+} // namespace client
+} // namespace stat
+} // namespace jubatus
-#endif // STAT_CLIENT_HPP_
+#endif // JUBATUS_STAT_CLIENT_HPP_
View
10 jubatus-client.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE@
+Description: Client Library for Distributed Online Machine Learning
+Version: @VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lmsgpack -ljubatus_mpio -ljubatus_msgpack-rpc
View
2  jubatus.pc.in
@@ -8,4 +8,4 @@ Description: Framework and Library for Distributed Online Machine Learning
Version: @VERSION@
Requires: pficommon >= 1.3.1, libglog >= 0.3.0
Cflags: -I${includedir}
-Libs: -L${libdir} -ljubatus_framework
+Libs: -L${libdir} -ljubatus_framework -ljubacommon -ljubacommon_mprpc -ljubamixer -lmsgpack -ljubatus_mpio -ljubatus_msgpack-rpc
View
7 src/anomaly/anomaly.hpp
@@ -4,7 +4,7 @@
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License version 2.1 as published by the Free Software Foundation.
-//
+//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -14,6 +14,9 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#pragma once
+#ifndef JUBATUS_ANOMALY_ANOMALY_HPP_
+#define JUBATUS_ANOMALY_ANOMALY_HPP_
#include "lof.hpp"
+
+#endif // JUBATUS_ANOMALY_ANOMALY_HPP_
View
11 src/anomaly/anomaly_base.cpp
@@ -15,17 +15,16 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "anomaly_base.hpp"
+
#include <algorithm>
#include <cmath>
-#include "../common/vector_util.hpp"
-using namespace std;
-using namespace pfi::data;
+#include "../common/vector_util.hpp"
namespace jubatus {
namespace anomaly {
-const uint32_t anomaly_base::neighbor_num_ = 10;
+const uint32_t anomaly_base::NEIGHBOR_NUM = 10;
anomaly_base::anomaly_base() {
}
@@ -45,5 +44,5 @@ void anomaly_base::load(std::istream& is) {
load_impl(is);
}
-} // namespace anomaly
-} // namespace jubatus
+} // namespace anomaly
+} // namespace jubatus
View
25 src/anomaly/anomaly_base.hpp
@@ -14,25 +14,30 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#pragma once
+#ifndef JUBATUS_ANOMALY_ANOMALY_BASE_HPP_
+#define JUBATUS_ANOMALY_ANOMALY_BASE_HPP_
+#include <string>
#include <vector>
+
#include <pficommon/data/unordered_map.h>
#include <pficommon/lang/shared_ptr.h>
+
#include "../common/type.hpp"
#include "../storage/sparse_matrix_storage.hpp"
-#include "anomaly_type.hpp"
#include "anomaly_storage_base.hpp"
+#include "anomaly_type.hpp"
namespace jubatus {
namespace anomaly {
-class anomaly_base{
-public:
+class anomaly_base {
+ public:
anomaly_base();
virtual ~anomaly_base();
- virtual float calc_anomaly_score(const sfv_t& query) const = 0; //return anomaly score of query
+ // return anomaly score of query
+ virtual float calc_anomaly_score(const sfv_t& query) const = 0;
virtual float calc_anomaly_score(const std::string& id) const = 0;
virtual void clear() = 0;
virtual void clear_row(const std::string& id) = 0;
@@ -49,14 +54,16 @@ class anomaly_base{
// static float calc_distance(sfv_t& q1, sfv_t& q2);
// static float calc_l2norm(sfv_t& query);
+ protected:
+ static const uint32_t NEIGHBOR_NUM;
-protected:
virtual bool save_impl(std::ostream&) = 0;
virtual bool load_impl(std::istream&) = 0;
- static const uint32_t neighbor_num_;
storage::sparse_matrix_storage orig_;
};
-} // namespace anomaly
-} // namespace jubatus
+} // namespace anomaly
+} // namespace jubatus
+
+#endif // JUBATUS_ANOMALY_ANOMALY_BASE_HPP_
View
36 src/anomaly/anomaly_factory.cpp
@@ -15,24 +15,29 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "anomaly_factory.hpp"
-#include "anomaly.hpp"
+
+#include <string>
+
+#include <pficommon/text/json.h>
+
#include "../common/exception.hpp"
#include "../common/jsonconfig.hpp"
-#include <pficommon/text/json.h>
+#include "anomaly.hpp"
-using namespace std;
-using namespace jubatus::jsonconfig;
+using jubatus::jsonconfig::config;
+using jubatus::jsonconfig::config_cast_check;
using pfi::text::json::json;
+using std::string;
namespace jubatus {
namespace anomaly {
namespace {
struct anomaly_config {
- std::string method; // nest engine name
- jsonconfig::config parameter;
+ std::string method; // nest engine name
+ jubatus::jsonconfig::config parameter;
- template <typename Ar>
+ template<typename Ar>
void serialize(Ar& ar) {
ar & MEMBER(method) & MEMBER(parameter);
}
@@ -40,20 +45,17 @@ struct anomaly_config {
}
anomaly_base* create_anomaly(const string& name, const config& param) {
- using namespace pfi::text::json;
-
if (name == "lof") {
anomaly_config conf = config_cast_check<anomaly_config>(param);
- storage::lof_storage::config config = config_cast_check<storage::lof_storage::config>(param);
-
- return new lof(config, recommender::create_recommender(conf.method, conf.parameter));
+ storage::lof_storage::config config =
+ config_cast_check<storage::lof_storage::config>(param);
+ return new lof(
+ config, recommender::create_recommender(conf.method, conf.parameter));
} else {
throw JUBATUS_EXCEPTION(unsupported_method(name));
}
-}
-
-}
-}
-
+};
+} // namespace anomaly
+} // namespace jubatus
View
16 src/anomaly/anomaly_factory.hpp
@@ -14,15 +14,19 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#pragma once
+#ifndef JUBATUS_ANOMALY_ANOMALY_FACTORY_HPP_
+#define JUBATUS_ANOMALY_ANOMALY_FACTORY_HPP_
#include <string>
#include <pficommon/text/json.h>
namespace jubatus {
namespace jsonconfig {
- class config;
-} // jsonconfig
+
+class config;
+
+} // namespace jsonconfig
+
namespace anomaly {
class anomaly_base;
@@ -30,5 +34,7 @@ class anomaly_base;
anomaly_base* create_anomaly(const std::string& name,
const jsonconfig::config& param);
-}
-}
+} // namespace anomaly
+} // namespace jubatus
+
+#endif // JUBATUS_ANOMALY_ANOMALY_FACTORY_HPP_
View
17 src/anomaly/anomaly_storage_base.hpp
@@ -14,20 +14,25 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#pragma once
+#ifndef JUBATUS_ANOMALY_ANOMALY_STORAGE_BASE_HPP_
+#define JUBATUS_ANOMALY_ANOMALY_STORAGE_BASE_HPP_
#include <string>
namespace jubatus {
-namespace storage{
+namespace storage {
class anomaly_storage_base {
-public:
- virtual ~anomaly_storage_base() {}
+ public:
+ virtual ~anomaly_storage_base() {
+ }
virtual void get_diff(std::string& diff) const = 0;
virtual void set_mixed_and_clear_diff(const std::string& mixed_diff) = 0;
virtual void mix(const std::string& lhs, std::string& rhs) const = 0;
};
-}
-}
+
+} // namespace storage
+} // namespace jubatus
+
+#endif // JUBATUS_ANOMALY_ANOMALY_STORAGE_BASE_HPP_
View
11 src/anomaly/anomaly_type.hpp
@@ -14,16 +14,17 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#pragma once
+#ifndef JUBATUS_ANOMALY_ANOMALY_TYPE_HPP_
+#define JUBATUS_ANOMALY_ANOMALY_TYPE_HPP_
#include <exception>
-#include <vector>
-#include <utility>
#include <string>
+#include <utility>
+#include <vector>
#include "../common/type.hpp"
namespace jubatus {
-
typedef sfv_t sfv_diff_t;
-
}
+
+#endif // JUBATUS_ANOMALY_ANOMALY_TYPE_HPP_
View
28 src/anomaly/lof.cpp
@@ -15,30 +15,39 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "lof.hpp"
+
#include <cmath>
#include <limits>
#include <string>
#include <vector>
+
#include <glog/logging.h>
#include <pficommon/data/serialization.h>
#include <pficommon/lang/cast.h>
#include <pficommon/math/random.h>
+
#include "../common/hash.hpp"
#include "../storage/lsh_util.hpp"
#include "../storage/lsh_vector.hpp"
-using namespace std;
-using namespace jubatus::storage;
+using jubatus::anomaly::lof;
using pfi::data::unordered_map;
using pfi::math::random::mtrand;
+using std::isinf;
+using std::istream;
+using std::ostream;
+using std::numeric_limits;
+using std::string;
+using std::vector;
namespace jubatus {
namespace anomaly {
namespace {
-float calculate_lof(float lrd,
- const unordered_map<string, float>& neighbor_lrd) {
+float calculate_lof(
+ float lrd,
+ const unordered_map<string, float>& neighbor_lrd) {
if (neighbor_lrd.empty()) {
return lrd == 0 ? 1 : numeric_limits<float>::infinity();
}
@@ -56,12 +65,14 @@ float calculate_lof(float lrd,
return sum_neighbor_lrd / (neighbor_lrd.size() * lrd);
}
-}
+} // namespace
lof::lof() {
}
-lof::lof(const storage::lof_storage::config& config, recommender::recommender_base* nn_engine)
+lof::lof(
+ const storage::lof_storage::config& config,
+ recommender::recommender_base* nn_engine)
: lof_index_(config, nn_engine) {
}
@@ -122,6 +133,5 @@ bool lof::load_impl(istream& is) {
return true;
}
-
-}
-}
+} // namespace anomaly
+} // namespace jubatus
View
28 src/anomaly/lof.hpp
@@ -14,22 +14,28 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#pragma once
+#ifndef JUBATUS_ANOMALY_LOF_HPP_
+#define JUBATUS_ANOMALY_LOF_HPP_
+#include <string>
+#include <vector>
+#include <pficommon/text/json.h>
#include "anomaly_base.hpp"
#include "lof_storage.hpp"
-#include <pficommon/text/json.h>
namespace jubatus {
namespace anomaly {
class lof : public anomaly_base {
-public:
+ public:
lof();
- explicit lof(const storage::lof_storage::config& config, recommender::recommender_base* nn_engine);
+ explicit lof(
+ const storage::lof_storage::config& config,
+ recommender::recommender_base* nn_engine);
~lof();
- virtual float calc_anomaly_score(const sfv_t& query) const; //return anomaly score of query
+ // return anomaly score of query
+ virtual float calc_anomaly_score(const sfv_t& query) const;
virtual float calc_anomaly_score(const std::string& id) const;
virtual void clear();
@@ -44,15 +50,17 @@ class lof : public anomaly_base {
void save(std::ostream&);
void load(std::istream&);
- // static float calc_distance(sfv_t& q1, sfv_t& q2);
- // static float calc_l2norm(sfv_t& q1, sfv_t& q2);
+ // static float calc_distance(sfv_t& q1, sfv_t& q2);
+ // static float calc_l2norm(sfv_t& q1, sfv_t& q2);
-private:
+ private:
virtual bool save_impl(std::ostream& os);
virtual bool load_impl(std::istream& is);
storage::lof_storage lof_index_;
};
-} // namespace anomaly
-} // namespace jubatus
+} // namespace anomaly
+} // namespace jubatus
+
+#endif // JUBATUS_ANOMALY_LOF_HPP_
View
138 src/anomaly/lof_storage.cpp
@@ -15,21 +15,36 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "lof_storage.hpp"
+
#include <algorithm>
#include <limits>
#include <sstream>
#include <stdexcept>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "anomaly_type.hpp"
#include "../common/exception.hpp"
#include "../common/jsonconfig.hpp"
-#include "../recommender/recommender_factory.hpp"
#include "../recommender/euclid_lsh.hpp"
-#include "anomaly_type.hpp"
+#include "../recommender/recommender_factory.hpp"
-using namespace std;
+using jubatus::storage::lof_storage;
using pfi::data::serialization::binary_iarchive;
using pfi::data::serialization::binary_oarchive;
using pfi::data::unordered_map;
using pfi::data::unordered_set;
+using std::istream;
+using std::istringstream;
+using std::max;
+using std::min;
+using std::numeric_limits;
+using std::ostream;
+using std::ostringstream;
+using std::pair;
+using std::string;
+using std::vector;
namespace jubatus {
namespace storage {
@@ -38,46 +53,47 @@ const uint32_t lof_storage::DEFAULT_NEIGHBOR_NUM = 10;
const uint32_t lof_storage::DEFAULT_REVERSE_NN_NUM = 30;
lof_storage::config::config()
- : nearest_neighbor_num(DEFAULT_NEIGHBOR_NUM)
- , reverse_nearest_neighbor_num(DEFAULT_REVERSE_NN_NUM)
-{
+ : nearest_neighbor_num(DEFAULT_NEIGHBOR_NUM),
+ reverse_nearest_neighbor_num(DEFAULT_REVERSE_NN_NUM) {
}
lof_storage::lof_storage()
- : neighbor_num_(DEFAULT_NEIGHBOR_NUM)
- , reverse_nn_num_(DEFAULT_REVERSE_NN_NUM)
- , nn_engine_(recommender::create_recommender("euclid_lsh",
- jsonconfig::config(pfi::text::json::to_json(recommender::euclid_lsh::config()))))
-{
+ : neighbor_num_(DEFAULT_NEIGHBOR_NUM),
+ reverse_nn_num_(DEFAULT_REVERSE_NN_NUM),
+ nn_engine_(recommender::create_recommender("euclid_lsh",
+ jsonconfig::config(pfi::text::json::to_json(
+ recommender::euclid_lsh::config())))) {
}
lof_storage::lof_storage(recommender::recommender_base* nn_engine)
- : neighbor_num_(DEFAULT_NEIGHBOR_NUM)
- , reverse_nn_num_(DEFAULT_REVERSE_NN_NUM)
- , nn_engine_(nn_engine)
-{
+ : neighbor_num_(DEFAULT_NEIGHBOR_NUM),
+ reverse_nn_num_(DEFAULT_REVERSE_NN_NUM),
+ nn_engine_(nn_engine) {
}
-lof_storage::lof_storage(const config& config, recommender::recommender_base* nn_engine)
- : neighbor_num_(config.nearest_neighbor_num)
- , reverse_nn_num_(config.reverse_nearest_neighbor_num)
- , nn_engine_(nn_engine)
-{
+lof_storage::lof_storage(
+ const config& config,
+ recommender::recommender_base* nn_engine)
+ : neighbor_num_(config.nearest_neighbor_num),
+ reverse_nn_num_(config.reverse_nearest_neighbor_num),
+ nn_engine_(nn_engine) {
}
lof_storage::~lof_storage() {
}
-float lof_storage::collect_lrds(const sfv_t& query,
- unordered_map<string, float>& neighbor_lrd) const {
+float lof_storage::collect_lrds(
+ const sfv_t& query,
+ unordered_map<string, float>& neighbor_lrd) const {
vector<pair<string, float> > neighbors;
nn_engine_->neighbor_row(query, neighbors, neighbor_num_);
return collect_lrds_from_neighbors(neighbors, neighbor_lrd);
}
-float lof_storage::collect_lrds(const string& id,
- unordered_map<string, float>& neighbor_lrd) const {
+float lof_storage::collect_lrds(
+ const string& id,
+ unordered_map<string, float>& neighbor_lrd) const {
vector<pair<string, float> > neighbors;
nn_engine_->neighbor_row(id, neighbors, neighbor_num_ + 1);
@@ -136,12 +152,14 @@ float lof_storage::get_kdist(const string& row) const {
if (it == lof_table_diff_.end()) {
it = lof_table_.find(row);
if (it == lof_table_.end()) {
- throw JUBATUS_EXCEPTION(exception::runtime_error("specified row does not exist")
- << exception::error_message("row id: " + row));
+ throw JUBATUS_EXCEPTION(
+ exception::runtime_error("specified row does not exist")
+ << exception::error_message("row id: " + row));
}
} else if (is_removed(it->second)) {
- throw JUBATUS_EXCEPTION(exception::runtime_error("specified row is recently removed")
- << exception::error_message("row id: " + row));
+ throw JUBATUS_EXCEPTION(
+ exception::runtime_error("specified row is recently removed")
+ << exception::error_message("row id: " + row));
}
return it->second.kdist;
}
@@ -151,12 +169,14 @@ float lof_storage::get_lrd(const string& row) const {
if (it == lof_table_diff_.end()) {
it = lof_table_.find(row);
if (it == lof_table_.end()) {
- throw JUBATUS_EXCEPTION(exception::runtime_error("specified row does not exist")
- << exception::error_message("row id: " + row));
+ throw JUBATUS_EXCEPTION(
+ exception::runtime_error("specified row does not exist")
+ << exception::error_message("row id: " + row));
}
} else if (is_removed(it->second)) {
- throw JUBATUS_EXCEPTION(exception::runtime_error("specified row is recently removed")
- << exception::error_message("row id: " + row));
+ throw JUBATUS_EXCEPTION(
+ exception::runtime_error("specified row is recently removed")
+ << exception::error_message("row id: " + row));
}
return it->second.lrd;
}
@@ -243,12 +263,12 @@ void lof_storage::mix(const string& lhs, string& rhs) const {
// private
-//static
+// static
void lof_storage::mark_removed(lof_entry& entry) {
entry.kdist = -1;
}
-//static
+// static
bool lof_storage::is_removed(const lof_entry& entry) {
return entry.kdist < 0;
}
@@ -279,19 +299,19 @@ float lof_storage::collect_lrds_from_neighbors(
return neighbors.size() / sum_reachability;
}
-void lof_storage::serialize_diff(const lof_table_t& table,
- const string& nn_diff,
- ostream& out) const {
+void lof_storage::serialize_diff(
+ const lof_table_t& table,
+ const string& nn_diff,
+ ostream& out) const {
binary_oarchive bo(out);
string name = nn_engine_->type();
- bo << const_cast<lof_table_t&>(table)
- << name
- << const_cast<string&>(nn_diff);
+ bo << const_cast<lof_table_t&>(table) << name << const_cast<string&>(nn_diff);
}
-void lof_storage::deserialize_diff(const string& diff,
- lof_table_t& table,
- string& nn_diff) const {
+void lof_storage::deserialize_diff(
+ const string& diff,
+ lof_table_t& table,
+ string& nn_diff) const {
string nn_engine_name;
istringstream iss(diff);
@@ -299,16 +319,19 @@ void lof_storage::deserialize_diff(const string& diff,
bi >> table >> nn_engine_name;
if (nn_engine_->type() != nn_engine_name) {
- throw JUBATUS_EXCEPTION(exception::runtime_error("inconsistent nearest neighbor engine type")
- << exception::error_message("lof's NN engine type: " + nn_engine_->type())
- << exception::error_message("diff's NN engine type: " + nn_engine_name));
+ throw JUBATUS_EXCEPTION(
+ exception::runtime_error("inconsistent nearest neighbor engine type")
+ << exception::error_message(
+ "lof's NN engine type: " + nn_engine_->type())
+ << exception::error_message("diff's NN engine type: " + nn_engine_name));
}
bi >> nn_diff;
}
-void lof_storage::collect_neighbors(const string& row,
- unordered_set<string>& nn) const {
+void lof_storage::collect_neighbors(
+ const string& row,
+ unordered_set<string>& nn) const {
vector<pair<string, float> > neighbors;
nn_engine_->neighbor_row(row, neighbors, reverse_nn_num_);
@@ -320,10 +343,12 @@ void lof_storage::collect_neighbors(const string& row,
void lof_storage::update_entries(const unordered_set<string>& rows) {
// NOTE: These two loops are separated, since update_lrd requires new kdist
// values of k-NN.
- typedef unordered_map<string, vector<pair<string, float> > > rows_to_neighbors_type;
+ typedef unordered_map<string, vector<pair<string, float> > >
+ rows_to_neighbors_type;
rows_to_neighbors_type rows_to_neighbors;
- for (unordered_set<string>::const_iterator it = rows.begin(); it != rows.end(); ++it) {
+ for (unordered_set<string>::const_iterator it = rows.begin();
+ it != rows.end(); ++it) {
nn_engine_->neighbor_row(*it, rows_to_neighbors[*it], neighbor_num_);
}
@@ -343,8 +368,9 @@ void lof_storage::update_kdist(const string& row) {
update_kdist_with_neighbors(row, neighbors);
}
-void lof_storage::update_kdist_with_neighbors(const string& row,
- const vector<pair<string, float> >& neighbors) {
+void lof_storage::update_kdist_with_neighbors(
+ const string& row,
+ const vector<pair<string, float> >& neighbors) {
if (!neighbors.empty()) {
lof_table_diff_[row].kdist = neighbors.back().second;
}
@@ -356,8 +382,8 @@ void lof_storage::update_lrd(const string& row) {
update_lrd_with_neighbors(row, neighbors);
}
-void lof_storage::update_lrd_with_neighbors(const string& row,
- const vector<pair<string, float> >& neighbors) {
+void lof_storage::update_lrd_with_neighbors(
+ const string& row, const vector<pair<string, float> >& neighbors) {
if (neighbors.empty()) {
lof_table_diff_[row].lrd = 1;
return;
@@ -377,5 +403,5 @@ void lof_storage::update_lrd_with_neighbors(const string& row,
lof_table_diff_[row].lrd = length / sum_reachability;
}
-}
-}
+} // namespace storage
+} // namespace jubatus
View
75 src/anomaly/lof_storage.hpp
@@ -14,29 +14,32 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#pragma once
+#ifndef JUBATUS_ANOMALY_LOF_STORAGE_HPP_
+#define JUBATUS_ANOMALY_LOF_STORAGE_HPP_
#include <iosfwd>
#include <string>
+#include <utility>
#include <vector>
+
#include <pficommon/data/serialization.h>
#include <pficommon/data/unordered_map.h>
#include <pficommon/data/unordered_set.h>
#include <pficommon/lang/scoped_ptr.h>
#include <pficommon/text/json.h>
+
+#include "anomaly_storage_base.hpp"
#include "../common/type.hpp"
#include "../recommender/recommender_base.hpp"
#include "../recommender/recommender_factory.hpp"
-#include "anomaly_storage_base.hpp"
-
namespace jubatus {
-namespace storage{
+namespace storage {
class lof_storage : public anomaly_storage_base {
-public:
- const static uint32_t DEFAULT_NEIGHBOR_NUM;
- const static uint32_t DEFAULT_REVERSE_NN_NUM;
+ public:
+ static const uint32_t DEFAULT_NEIGHBOR_NUM;
+ static const uint32_t DEFAULT_REVERSE_NN_NUM;
struct config {
config();
@@ -44,27 +47,31 @@ class lof_storage : public anomaly_storage_base {
int nearest_neighbor_num;
int reverse_nearest_neighbor_num;
- template <typename Ar>
+ template<typename Ar>
void serialize(Ar& ar) {
ar & MEMBER(nearest_neighbor_num) & MEMBER(reverse_nearest_neighbor_num);
}
};
lof_storage();
- lof_storage(recommender::recommender_base* nn_engine);
+ explicit lof_storage(recommender::recommender_base* nn_engine);
// config contains parameters for the underlying nearest neighbor search
- explicit lof_storage(const config& config, recommender::recommender_base* nn_engine);
+ explicit lof_storage(
+ const config& config,
+ recommender::recommender_base* nn_engine);
virtual ~lof_storage();
// For Analyze
// calculate lrd of query and lrd values of its neighbors
-