jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
inverted_index.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_RECOMMENDER_INVERTED_INDEX_HPP_
18 #define JUBATUS_CORE_RECOMMENDER_INVERTED_INDEX_HPP_
19 
20 #include <string>
21 #include <utility>
22 #include <vector>
23 #include "jubatus/util/lang/shared_ptr.h"
24 #include "recommender_base.hpp"
25 #include "../storage/inverted_index_storage.hpp"
26 
27 namespace jubatus {
28 namespace core {
29 namespace framework {
30 template <typename Model, typename Diff>
31 class linear_mixable_helper;
32 } // namespace framework
33 namespace recommender {
34 
36  public:
39 
40  void similar_row(
41  const common::sfv_t& query,
42  std::vector<std::pair<std::string, float> >& ids,
43  size_t ret_num) const;
44  void neighbor_row(
45  const common::sfv_t& query,
46  std::vector<std::pair<std::string, float> >& ids,
47  size_t ret_num) const;
48  void clear();
49  void clear_row(const std::string& id);
50  void update_row(const std::string& id, const sfv_diff_t& diff);
51  void get_all_row_ids(std::vector<std::string>& ids) const;
52  std::string type() const;
53 
55 
56  void pack(framework::packer& packer) const;
57  void unpack(msgpack::object o);
58 
59  private:
60  jubatus::util::lang::shared_ptr<storage::mixable_inverted_index_storage>
62 };
63 
64 } // namespace recommender
65 } // namespace core
66 } // namespace jubatus
67 
68 #endif // JUBATUS_CORE_RECOMMENDER_INVERTED_INDEX_HPP_
framework::mixable * get_mixable() const
void get_all_row_ids(std::vector< std::string > &ids) const
core::common::sfv_t sfv_diff_t
void neighbor_row(const common::sfv_t &query, std::vector< std::pair< std::string, float > > &ids, size_t ret_num) const
void pack(framework::packer &packer) const
void similar_row(const common::sfv_t &query, std::vector< std::pair< std::string, float > > &ids, size_t ret_num) const
msgpack::packer< jubatus_packer > packer
Definition: bandit_base.hpp:31
void update_row(const std::string &id, const sfv_diff_t &diff)
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29
jubatus::util::lang::shared_ptr< storage::mixable_inverted_index_storage > mixable_storage_