-
Notifications
You must be signed in to change notification settings - Fork 0
/
RSUser.h
89 lines (77 loc) · 2.21 KB
/
RSUser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef USER_H
#define USER_H
#include <unordered_map>
#include <vector>
#include <string>
#include <memory>
#include "Movie.h"
class RecommenderSystem;
typedef std::unordered_map<sp_movie, double, hash_func, equal_func> rank_map;
using std::string;
using std::shared_ptr;
class RSUser
{
public:
/**
* Constructor for the class
*/
RSUser (string user_name, rank_map movies_ranks,
shared_ptr<RecommenderSystem> recommender_system);
/**
* a getter for the user's name
* @return the username
*/
const string &get_name () const
{ return this->_user_name; }
/**
* function for adding a movie to the DB
* @param movie a Movie object
* @param features a vector of the movie's features
* @param rate the user rate for this movie
* @return true for success, false otherwise
*/
void add_movie_to_rs (const std::string &name, int year,
const std::vector<double> &features,
double rate);
/**
* a getter for the ranks map
* @return
*/
const rank_map &get_ranks () const
{ return this->_movies_rank; }
/**
* returns a recommendation according to the movie's content
* @return recommendation
*/
sp_movie get_recommendation_by_content () const;
/**
* returns a recommendation according to the similarity recommendation method
* @param k the number of the most similar movies to calculate by
* @return recommendation
*/
sp_movie get_recommendation_by_cf (int k) const;
/**
* predicts the score for a given movie
* @param name the name of the movie
* @param year the year the movie was created
* @param k the parameter which represents the number of the most similar
* movies to predict the score by
* @return predicted score for the given movie
*/
double
get_prediction_score_for_movie (const std::string &name, int year, int k)
const;
/**
* output stream operator
* @param os the output stream
* @param user the user
* @return output stream
*/
// TODO &operator<<
friend std::ostream &operator<< (std::ostream &os, const RSUser &user);
private:
string _user_name;
rank_map _movies_rank;
shared_ptr<RecommenderSystem> _recommender_system;
};
#endif //USER_H