示例#1
0
    def setUp(self):
        self.config = {
            "method": "AROW",
            "converter": {
                "string_filter_types": {},
                "string_filter_rules": [],
                "num_filter_types": {},
                "num_filter_rules": [],
                "string_types": {},
                "string_rules": [],
                "num_types": {},
                "num_rules": []
                },
            "parameter": {
                "regularization_weight": 1.001
                }
            }

        TestUtil.write_file('config_for_error.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('classifier', port, 'config_for_error.json')
        try:
            address = msgpackrpc.Address(host, port)
            client = msgpackrpc.Client(address)
            self.cli = jubatus.common.Client(client, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#2
0
    def setUp(self):
        self.config = {
            "method": "AROW",
            "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": {
                "regularization_weight": 1.001
            }
        }

        TestUtil.write_file('config_classifier.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('classifier', port,
                                         'config_classifier.json')
        try:
            self.cli = Classifier(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#3
0
    def setUp(self):
        self.config = {
            "method": "AROW",
            "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": {
                "regularization_weight": 1.001
                }
            }

        TestUtil.write_file('config_classifier.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('classifier', port, 'config_classifier.json')
        try:
            self.cli = Classifier(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#4
0
  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": {
         "lsh_num": 8,
         "table_num": 16,
         "probe_num": 64,
         "bin_width": 10.0,
         "seed": 1091,
         "retain_projection": False
       }
     }
    }

    TestUtil.write_file('config_anomaly.json', json.dumps(self.config))
    self.srv = TestUtil.fork_process('anomaly', port, 'config_anomaly.json')
    self.cli = anomaly(host, port)
示例#5
0
    def setUp(self):
        self.config = {
            "method": "lsh",
            "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": {
                "hash_num": 64
            }
        }

        TestUtil.write_file('config_nearest_neighbor.json',
                            json.dumps(self.config))
        self.srv = TestUtil.fork_process('nearest_neighbor', port,
                                         'config_nearest_neighbor.json')
        try:
            self.cli = NearestNeighbor(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#6
0
    def setUp(self):
        self.config = {
            "method" : "kmeans",
            "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" : {
                "k" : 10,
                "seed": 0
            },
            "compressor_method" : "simple",
            "compressor_parameter" : {
                "bucket_size" : 3,
            }
        }

        TestUtil.write_file('config_clustering.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('clustering', port, 'config_clustering.json')
        try:
            self.cli = Clustering(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#7
0
    def setUp(self):
        self.config = {
            "method": "lsh",
            "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": {
                "hash_num": 64
                }
            }

        TestUtil.write_file('config_nearest_neighbor.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('nearest_neighbor', port, 'config_nearest_neighbor.json')
        try:
            self.cli = NearestNeighbor(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#8
0
    def setUp(self):
        self.config = {
            "method": "kmeans",
            "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": {"k": 10, "seed": 0},
            "compressor_method": "simple",
            "compressor_parameter": {"bucket_size": 3},
        }

        TestUtil.write_file("config_clustering.json", json.dumps(self.config))
        self.srv = TestUtil.fork_process("clustering", port, "config_clustering.json")
        try:
            self.cli = Clustering(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#9
0
    def setUp(self):
        self.config = {
            "method": "PA1",
            "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": {
                "sensitivity": 0.1,
                "regularization_weight": 3.402823e+38
            }
        }

        TestUtil.write_file('config_regression.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('regression', port,
                                         'config_regression.json')
        try:
            self.cli = Regression(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#10
0
    def setUp(self):
        self.config = {
            "method": "PA",
            "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": {
                "sensitivity" : 0.1,
                "regularization_weight" : 3.402823e+38
                }
            }

        TestUtil.write_file('config_regression.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('regression', port, 'config_regression.json')
        try:
            self.cli = Regression(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#11
0
  def setUp(self):
    self.config = {
        "window_size": 10
    }

    TestUtil.write_file('config_stat.json', json.dumps(self.config))
    self.srv = TestUtil.fork_process('stat', port, 'config_stat.json')
    self.cli = stat(host, port)
示例#12
0
    def setUp(self):
        self.config = {"window_size": 10}

        TestUtil.write_file('config_stat.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('stat', port, 'config_stat.json')
        try:
            self.cli = Stat(host, port, 'name')
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#13
0
    def setUp(self):
        self.config = {
          "window_size": 10
          }

        TestUtil.write_file('config_stat.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('stat', port, 'config_stat.json')
        try:
            self.cli = Stat(host, port, 'name')
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#14
0
  def setUp(self):
    self.config = {
        "method": "graph_wo_index",
        "parameter": {
            "damping_factor": 0.9,
            "landmark_num": 5
        }
    }

    TestUtil.write_file('config_graph.json', json.dumps(self.config))
    self.srv = TestUtil.fork_process('graph', port, 'config_graph.json')
    self.cli = graph(host, port)
示例#15
0
 def setUp(self):
     self.srv = TestUtil.fork_process("regression", port)
     self.cli = regression(host, port)
     method = "PA"
     self.converter = '{\n"string_filter_types":{}, \n"string_filter_rules":[], \n"num_filter_types":{}, \n"num_filter_rules":[], \n"string_types":{}, \n"string_rules":\n[{"key":"*", "type":"space", \n"sample_weight":"bin", "global_weight":"bin"}\n], \n"num_types":{}, \n"num_rules":[\n{"key":"*", "type":"num"}\n]\n}'
     cd = config_data(method, self.converter)
     self.cli.set_config("name", cd)
示例#16
0
    def setUp(self):
        self.config = {
            "method": "graph_wo_index",
            "parameter": {
                "damping_factor": 0.9,
                "landmark_num": 5
            }
        }

        TestUtil.write_file('config_graph.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('graph', port, 'config_graph.json')
        try:
            self.cli = Graph(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#17
0
    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
示例#18
0
    def setUp(self):
        self.config = {
            "method": "inverted_index",
            "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": {},
        }

        TestUtil.write_file("config_recommender.json", json.dumps(self.config))
        self.srv = TestUtil.fork_process("recommender", port, "config_recommender.json")
        self.cli = recommender(host, port)
示例#19
0
    def setUp(self):
        self.config = {
            "method": "AROW",
            "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": {"regularization_weight": 1.001},
        }

        TestUtil.write_file("config_classifier.json", json.dumps(self.config))
        self.srv = TestUtil.fork_process("classifier", port, "config_classifier.json")
        self.cli = classifier(host, port)
示例#20
0
    def setUp(self):
        self.config = {
            "method": "inverted_index",
            "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": {}
            }

        TestUtil.write_file('config_recommender.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('recommender', port, 'config_recommender.json')
        try:
            self.cli = Recommender(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#21
0
    def setUp(self):
        self.config = {
            "method": "inverted_index",
            "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": {}
            }

        TestUtil.write_file('config_recommender.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('recommender', port, 'config_recommender.json')
        try:
            self.cli = Recommender(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#22
0
    def setUp(self):
        self.config = {
            "method" : "kmeans",
            "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" : {
                "k" : 10,
                "compressor_method" : "simple",
                "bucket_size" : 3,
                "compressed_bucket_size" : 2,
                "bicriteria_base_size" : 1,
                "bucket_length" : 2,
                "forgetting_factor" : 0,
                "forgetting_threshold" : 0.5,
                "seed": 0,
                } 
            }

        TestUtil.write_file('config_clustering.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('clustering', port, 'config_clustering.json')
        try:
            self.cli = Clustering(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise
示例#23
0
 def tearDown(self):
     if self.cli:
         self.cli.get_client().close()
     TestUtil.kill_process(self.srv)
示例#24
0
 def setUp(self):
   self.srv = TestUtil.fork_process("graph", port)
   self.cli = graph(host, port)
示例#25
0
 def tearDown(self):
     if self.cli:
         self.cli.get_client().close()
     TestUtil.kill_process(self.srv)
示例#26
0
 def setUp(self):
   self.srv = TestUtil.fork_process("stat", port)
   self.cli = stat(host, port)
   self.window_size = 10
   cd = config_data(self.window_size)
   self.cli.set_config("name", cd)
示例#27
0
 def tearDown(self):
   TestUtil.kill_process(self.srv)
示例#28
0
 def tearDown(self):
     TestUtil.kill_process(self.srv)