jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
aggregator.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2014 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_BURST_AGGREGATOR_HPP_
18 #define JUBATUS_CORE_BURST_AGGREGATOR_HPP_
19 
20 #include <vector>
21 #include "jubatus/util/lang/scoped_ptr.h"
22 
23 #include "result_storage.hpp"
24 #include "../framework/mixable_helper.hpp"
25 
26 namespace jubatus {
27 namespace core {
28 namespace burst {
29 
30 class aggregator {
31  public:
32  aggregator(int window_batch_size, double batch_interval, int max_stored);
33  ~aggregator();
34 
35  // store data into internal windows
36  // returns: false if pos is too late to store
37  bool add_document(int d, int r, double pos);
38 
39  // calculate windows and store into result_storage
40  // then erase stored input which has no intersection to latest window
41  // returns: count of windows erased
42  int flush_results(double scaling_param,
43  double gamma,
44  double costcut_threshold,
45  int max_reuse_batches,
46  result_storage& stored);
47 
48  void pack(framework::packer& packer) const;
49  void unpack(msgpack::object o);
50 
51  private:
52  class impl_;
53  jubatus::util::lang::scoped_ptr<impl_> p_;
54 };
55 
56 } // namespace burst
57 } // namespace core
58 } // namespace jubatus
59 
60 #endif // JUBATUS_CORE_BURST_AGGREGATOR_HPP_
void unpack(msgpack::object o)
Definition: aggregator.cpp:165
jubatus::util::lang::scoped_ptr< impl_ > p_
Definition: aggregator.hpp:52
int flush_results(double scaling_param, double gamma, double costcut_threshold, int max_reuse_batches, result_storage &stored)
Definition: aggregator.cpp:150
void pack(framework::packer &packer) const
Definition: aggregator.cpp:160
aggregator(int window_batch_size, double batch_interval, int max_stored)
Definition: aggregator.cpp:137
msgpack::packer< jubatus_packer > packer
Definition: bandit_base.hpp:31
bool add_document(int d, int r, double pos)
Definition: aggregator.cpp:145