jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
result_window.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_RESULT_WINDOW_HPP_
18 #define JUBATUS_CORE_BURST_RESULT_WINDOW_HPP_
19 
20 #include <vector>
21 
22 #include "input_window.hpp"
23 
24 namespace jubatus {
25 namespace core {
26 namespace burst {
27 
28 class result_window : private basic_window<batch_result> {
30 
31  public:
32  explicit result_window(double start_pos = 0, double batch_interval = 1)
33  : base_(start_pos, batch_interval, 0) {
34  }
35 
37  const std::vector<double>& burst_weights)
38  : base_(input.get_start_pos(),
39  input.get_batch_interval(),
40  input.get_batch_size()) {
41  size_t n = input.get_batch_size();
42 
43  if (burst_weights.size() != n) {
45  "result_window: size of burst_weights is not matching"));
46  }
47 
48  const std::vector<batch_input>& inputs = input.get_batches();
49  for (size_t i = 0; i < n; ++i) {
50  batches_[i] = batch_result(inputs[i], burst_weights[i]);
51  }
52  }
53 
54  using base_::get_index;
55 
57  using base_::get_end_pos;
58  using base_::contains;
60 
61  using base_::get_batches;
64 
66 };
67 
68 } // namespace burst
69 } // namespace core
70 } // namespace jubatus
71 
72 #endif // JUBATUS_CORE_BURST_RESULT_WINDOW_HPP_
MSGPACK_DEFINE(batches_, start_pos_, batch_interval_)
result_window(double start_pos=0, double batch_interval=1)
basic_window< batch_result > base_
#define JUBATUS_EXCEPTION(e)
Definition: exception.hpp:79
result_window(const input_window &input, const std::vector< double > &burst_weights)
const std::vector< batch_type > & get_batches() const