jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
stat.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2011,2012 Preferred Networks and Nippon Telegraph and Telephone Corporation.
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License version 2.1 as published by the Free Software Foundation.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #ifndef JUBATUS_CORE_DRIVER_STAT_HPP_
18 #define JUBATUS_CORE_DRIVER_STAT_HPP_
19 
20 #include <algorithm>
21 #include <string>
22 #include <utility>
23 
24 #include "../stat/stat.hpp"
25 #include "../framework/mixable.hpp"
26 #include "driver.hpp"
27 
28 namespace jubatus {
29 namespace core {
30 namespace driver {
31 
32 class stat : public driver_base {
33  public:
34  explicit stat(jubatus::core::stat::stat* stat_method);
35  virtual ~stat();
36 
38  return stat_.get();
39  }
40 
41  void push(const std::string& key, double value);
42  double sum(const std::string&) const;
43  double stddev(const std::string&) const;
44  double max(const std::string&) const;
45  double min(const std::string&) const;
46  double entropy() const;
47  double moment(const std::string&, int, double) const;
48 
49  void pack(framework::packer& pk) const;
50  void unpack(msgpack::object o);
51  void clear();
52 
53  private:
54  jubatus::util::lang::shared_ptr<jubatus::core::stat::stat> stat_;
56 };
57 
58 } // namespace driver
59 } // namespace core
60 } // namespace jubatus
61 
62 #endif // JUBATUS_CORE_DRIVER_STAT_HPP_
stat(jubatus::core::stat::stat *stat_method)
Definition: stat.cpp:29
void push(const std::string &key, double value)
Definition: stat.cpp:38
void pack(framework::packer &pk) const
Definition: stat.cpp:66
double stddev(const std::string &) const
Definition: stat.cpp:46
double moment(const std::string &, int, double) const
Definition: stat.cpp:62
jubatus::core::stat::stat * get_model() const
Definition: stat.hpp:37
double entropy() const
Definition: stat.cpp:58
void unpack(msgpack::object o)
Definition: stat.cpp:70
jubatus::util::lang::shared_ptr< jubatus::core::stat::stat > stat_
Definition: stat.hpp:54
double sum(const std::string &) const
Definition: stat.cpp:42
double min(const std::string &) const
Definition: stat.cpp:54
core::stat::mixable_stat mixable_stat_
Definition: stat.hpp:55
double max(const std::string &) const
Definition: stat.cpp:50