def setUp(self): self.config = { "method": "lof", "converter": { "string_filter_types": {}, "string_filter_rules": [], "num_filter_types": {}, "num_filter_rules": [], "string_types": {}, "string_rules": [{ "key": "*", "type": "space", "sample_weight": "bin", "global_weight": "bin" }], "num_types": {}, "num_rules": [{ "key": "*", "type": "num" }] }, "parameter": { "nearest_neighbor_num": 10, "reverse_nearest_neighbor_num": 30, "method": "euclid_lsh", "parameter": { "hash_num": 8, "table_num": 16, "probe_num": 64, "bin_width": 10.0, "seed": 1091, } } } TestUtil.write_file('config_anomaly.json', json.dumps(self.config)) self.srv = TestUtil.fork_process('anomaly', port, 'config_anomaly.json') try: self.cli = Anomaly(host, port, "name") except: TestUtil.kill_process(self.srv) raise
#!/usr/bin/env python from jubatus.anomaly.client import Anomaly from jubatus.common import Datum client = Anomaly('127.0.0.1', 9199, 'test') for i in range(1, 21): d = Datum({'key': float(i)}) client.add(d) print 'ids(' + str(i) + ') = ' + str(sorted(client.get_all_rows()))