Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from jubatus.stat import client
from jubatus.stat import types

NAME = "stat_tri";

if __name__ == '__main__':

  # 1. Jubatus Serverへの接続設定
  stat = client.stat("127.0.0.1",9199)

  # 2. 学習用データの準備
  for line in open('../dat/fruit.csv'):
    fruit, diameter, weight , price = line[:-1].split(',')

    # 3. データの学習(学習モデルの更新)
    stat.push(NAME, fruit+"dia", float(diameter))
    stat.push(NAME, fruit+"wei", float(weight))
    stat.push(NAME, fruit+"pri", float(price))

  # 4. 結果の出力
  for fr in ["orange", "apple","melon"]:
    for par in ["dia","wei", "pri"]:
      print "sum :",fr+par,stat.sum(NAME, fr+par)
      print "sdv :",fr+par,stat.stddev(NAME, fr+par)
      print "max :",fr+par,stat.max(NAME, fr+par)
      print "min :",fr+par,stat.min(NAME, fr+par)
      print "ent :",fr+par,stat.entropy(NAME, fr+par)