22 #include "jubatus/util/data/serialization.h"
23 #include "jubatus/util/lang/shared_ptr.h"
24 #include "../common/exception.hpp"
25 #include "../nearest_neighbor/nearest_neighbor_base.hpp"
26 #include "../unlearner/unlearner.hpp"
28 using jubatus::util::lang::shared_ptr;
32 namespace recommender {
49 jubatus::util::lang::shared_ptr<nearest_neighbor::nearest_neighbor_base>
50 nearest_neighbor_engine)
51 : nearest_neighbor_engine_(nearest_neighbor_engine) {
55 jubatus::util::lang::shared_ptr<nearest_neighbor::nearest_neighbor_base>
56 nearest_neighbor_engine,
57 jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
unlearner)
58 : nearest_neighbor_engine_(nearest_neighbor_engine),
59 unlearner_(unlearner) {
65 std::vector<std::pair<std::string, float> >& ids,
66 size_t ret_num)
const {
72 std::vector<std::pair<std::string, float> >& ids,
73 size_t ret_num)
const {
102 const std::string&
id,
107 "no more space available to add new ID: " +
id));
117 std::vector<std::string>& ids)
const {
130 packer.pack_array(2);
136 if (o.type != msgpack::type::ARRAY || o.via.array.size != 2) {
137 throw msgpack::type_error();
143 jubatus::util::lang::shared_ptr<storage::column_table>
148 jubatus::util::lang::shared_ptr<const storage::column_table>
153 jubatus::util::lang::shared_ptr<unlearner::unlearner_base>
void get_row(const std::string &row, std::vector< std::pair< std::string, float > > &columns) const
jubatus::util::lang::shared_ptr< unlearner::unlearner_base > get_unlearner()
jubatus::util::lang::shared_ptr< storage::column_table > get_table()
jubatus::util::lang::shared_ptr< unlearner::unlearner_base > unlearner_
void update_row(const std::string &id, const sfv_diff_t &diff)
void unpack(msgpack::object o)
void neighbor_row(const common::sfv_t &query, std::vector< std::pair< std::string, float > > &ids, size_t ret_num) const
void operator()(const std::string &id)
void get_all_row_ids(std::vector< std::string > &ids) const
#define JUBATUS_EXCEPTION(e)
jubatus::util::data::optional< std::string > unlearner
void pack(framework::packer &packer) const
msgpack::packer< jubatus_packer > packer
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
void remove_row(const std::string &row)
core::storage::sparse_matrix_storage orig_
std::vector< std::pair< std::string, float > > sfv_t
nearest_neighbor_recommender * recommender_
nearest_neighbor_recommender(jubatus::util::lang::shared_ptr< nearest_neighbor::nearest_neighbor_base > nearest_neighbor_engine)
framework::mixable * get_mixable() const
void clear_row(const std::string &id)
void unlearn_row(const std::string &id)
jubatus::util::lang::shared_ptr< const storage::column_table > get_const_table() const
void unpack(msgpack::object o)
jubatus::util::lang::function< void(std::string)> unlearning_callback
unlearning_callback(nearest_neighbor_recommender *recommender)
void set_row(const std::string &row, const std::vector< std::pair< std::string, float > > &columns)
jubatus::util::lang::shared_ptr< nearest_neighbor::nearest_neighbor_base > nearest_neighbor_engine_