jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
compressive_storage.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2013 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_CLUSTERING_COMPRESSIVE_STORAGE_HPP_
18 #define JUBATUS_CORE_CLUSTERING_COMPRESSIVE_STORAGE_HPP_
19 
20 #include <string>
21 #include <vector>
22 #include <msgpack.hpp>
23 #include "storage.hpp"
24 
25 namespace jubatus {
26 namespace core {
27 namespace clustering {
28 namespace compressor {
29 class compressor;
30 } // namespace compressor
31 class compressive_storage : public storage {
32  public:
34  const std::string& name, const clustering_config& config);
35 
36  void add(const weighted_point& point);
37  wplist get_mine() const;
38  void set_compressor(
39  jubatus::util::lang::shared_ptr<compressor::compressor> compressor);
40 
41  private:
42  void carry_up(size_t r);
43  bool is_next_bucket_full(size_t bucket_number);
44  bool reach_forgetting_threshold(size_t bucket_number);
45  void forget_weight(wplist& points);
46 
47  void pack_impl_(framework::packer& packer) const;
48  void unpack_impl_(msgpack::object o);
49  void clear_impl_();
50 
51  std::vector<wplist> mine_;
52  uint64_t status_;
53  jubatus::util::lang::shared_ptr<compressor::compressor> compressor_;
54 };
55 
56 } // namespace clustering
57 } // namespace core
58 } // namespace jubatus
59 
60 #endif // JUBATUS_CORE_CLUSTERING_COMPRESSIVE_STORAGE_HPP_
void pack_impl_(framework::packer &packer) const
jubatus::util::lang::shared_ptr< compressor::compressor > compressor_
msgpack::packer< jubatus_packer > packer
Definition: bandit_base.hpp:31
void set_compressor(jubatus::util::lang::shared_ptr< compressor::compressor > compressor)
compressive_storage(const std::string &name, const clustering_config &config)
std::vector< weighted_point > wplist
Definition: types.hpp:55