jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
bit_index_storage.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2011 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_STORAGE_BIT_INDEX_STORAGE_HPP_
18 #define JUBATUS_CORE_STORAGE_BIT_INDEX_STORAGE_HPP_
19 
20 #include <string>
21 #include <utility>
22 #include <vector>
23 #include "jubatus/util/data/unordered_map.h"
24 #include "../common/key_manager.hpp"
25 #include "../common/unordered_map.hpp"
26 #include "../framework/mixable_helper.hpp"
27 #include "storage_type.hpp"
29 #include "bit_vector.hpp"
30 
31 namespace jubatus {
32 namespace core {
33 namespace storage {
34 
36  public:
39 
40  void set_row(const std::string& row, const bit_vector& bv);
41  void get_row(const std::string& row, bit_vector& bv) const;
42  void remove_row(const std::string& row);
43  void clear();
44  void get_all_row_ids(std::vector<std::string>& ids) const;
45 
46  void similar_row(
47  const bit_vector& bv,
48  std::vector<std::pair<std::string, float> >& ids,
49  uint64_t ret_num) const;
50  std::string name() const;
52  return storage::version();
53  }
54 
55  void pack(framework::packer& packer) const;
56  void unpack(msgpack::object o);
57 
58  void get_diff(bit_table_t& diff) const;
59  bool put_diff(const bit_table_t& mixed_diff);
60  void mix(const bit_table_t& lhs, bit_table_t& rhs) const;
61 
63 
64  private:
67 };
68 
71 
72 } // namespace storage
73 } // namespace core
74 } // namespace jubatus
75 
76 #endif // JUBATUS_CORE_STORAGE_BIT_INDEX_STORAGE_HPP_
void similar_row(const bit_vector &bv, std::vector< std::pair< std::string, float > > &ids, uint64_t ret_num) const
MSGPACK_DEFINE(bitvals_, bitvals_diff_)
void set_row(const std::string &row, const bit_vector &bv)
void get_all_row_ids(std::vector< std::string > &ids) const
bool put_diff(const bit_table_t &mixed_diff)
framework::linear_mixable_helper< bit_index_storage, bit_table_t > mixable_bit_index_storage
Definition: lsh.hpp:34
void pack(framework::packer &packer) const
jubatus::util::data::unordered_map< std::string, bit_vector > bit_table_t
void get_row(const std::string &row, bit_vector &bv) const
msgpack::packer< jubatus_packer > packer
Definition: bandit_base.hpp:31
void get_diff(bit_table_t &diff) const
void mix(const bit_table_t &lhs, bit_table_t &rhs) const