6 #ifndef TURI_RECSYS_FACTORIZATION_MODELS_H_ 7 #define TURI_RECSYS_FACTORIZATION_MODELS_H_ 9 #include <toolkits/recsys/recsys_model_base.hpp> 10 #include <toolkits/recsys/recsys_model_base.hpp> 18 namespace factorization {
19 class factorization_model;
30 bool include_columns_beyond_user_item()
const {
return true; }
32 void init_options(
const std::map<std::string, flexible_type>& _options);
34 std::map<std::string, flexible_type> train(
const v2::ml_data& training_data);
36 sframe predict(
const v2::ml_data& test_data)
const;
41 void get_item_similarity_scores(
42 size_t item, std::vector<std::pair<size_t, double> >& sim_scores)
const;
51 mutable mutex _get_similar_buffers_lock;
52 mutable std::vector<Eigen::Matrix<float, Eigen::Dynamic, 1> > _get_similar_buffers;
57 std::vector<std::pair<size_t, double> >& scores,
58 const std::vector<v2::ml_data_entry>& query_row,
60 const std::vector<std::pair<size_t, double> >& user_item_list,
61 const std::vector<std::pair<size_t, double> >& new_user_item_data,
62 const std::vector<v2::ml_data_row_reference>& new_observation_data,
63 const std::shared_ptr<v2::ml_data_side_features>& known_side_features)
const;
65 static constexpr
size_t RECSYS_FACTORIZATION_MODEL_VERSION = 1;
67 inline size_t internal_get_version()
const {
68 return RECSYS_FACTORIZATION_MODEL_VERSION;
79 virtual bool include_ranking_options()
const = 0;
81 std::map<std::string, flexible_type> train(
82 const v2::ml_data& training_data_by_user,
83 const v2::ml_data& training_data_by_item);
85 std::shared_ptr<factorization::factorization_model> model;
97 bool use_target_column(
bool target_is_present)
const override {
return true; }
100 bool include_ranking_options()
const override {
return false; }
114 bool use_target_column(
bool target_is_present)
const override {
return target_is_present; }
117 bool include_ranking_options()
const override {
return true; }
#define BEGIN_CLASS_MEMBER_REGISTRATION(python_facing_classname)
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
#define IMPORT_BASE_CLASS_REGISTRATION(base_class)
#define END_CLASS_MEMBER_REGISTRATION
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.