-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreProc.h
More file actions
executable file
·94 lines (68 loc) · 2.41 KB
/
PreProc.h
File metadata and controls
executable file
·94 lines (68 loc) · 2.41 KB
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
90
91
92
93
94
#ifndef PREPROC_H_
#define PREPROC_H_
#include "nfx.h"
#include "NetflixDataNG.h"
using namespace utils;
namespace tool {
class PreProc {
private:
NetflixDataNG data;
// Variables for getting and storing ratings data.
movie** moviesByUser;
rate** ratingsByUser;
unsigned short* noViewingsPerUser;
unsigned int** datesByUser;
unsigned short ** whatIndexAMovieIsToAUser;
user** usersByMovie;
unsigned long* noViewingsPerMovie;
rate** ratesByMovie;
unsigned int** datesByMovie;
double** workingCopyOfRatingsByUser;
q **bigRatings;
user * bigPredictionUsers;
q *bigPrediction;
long int numPredictions;
// Doubles for processing the ratings etc.
double mAllAdd, mUserAddMean, mUserAddVar, mMovieAddMean, mMovieAddVar,
mUserGivenMovieMean, mUserGivenMovieVariance, mWVar, mDPVar;
public:
// Constructor and Destructor
PreProc(bool isDebug, bool isTest);
~PreProc();
// Go function
void go();
private:
// Functions for processing & calculating the statistics of each model part
void allAdds();
void userSideAverages(bool IsWithMovieAveragesGiven);
void movieSideAverages();
void wAndDpFit();
// Function for deciding what size variables to use for the larger model
void memoryCapacityTest();
// Function for working out the all-info rating, bit by bit
void writeBigRatingFile();
void testBigRatingFile();
void writeBigPredictionFile();
void testBigPredictionFile();
q makeBig(user u, movie m, uint date, rate rating);
void sortUserStuffByDate(movie* &thisMovies, rate* &thisRatings,
uint* &thisDates, uint beginIndex, uint endIndex);
uint partitionUserStuffByDate(movie* &thisMovies, rate* &thisRatings,
uint* &thisDates, uint beginIndex, uint endIndex);
void swap(movie* &thisMovies, rate* &thisRatings, uint* &thisDates,
uint index1, uint index2);
void sortMovieStuffByDate(user* &thisUsers, rate* &thisRatings,
uint* &thisDates, uint beginIndex, uint endIndex);
uint partitionMovieStuffByDate(user* &thisUsers, rate* &thisRatings,
uint* &thisDates, uint beginIndex, uint endIndex);
void swap(user* &thisUsers, rate* &thisRatings, uint* &thisDates,
uint index1, uint index2);
void checkUserDatesAreInOrder();
void checkMovieDatesAreInOrder();
uint getUserRatingHistoryFromDate(user u, uint targetDate,
uint numOfDaysHistory);
uint getUserEra(user u, uint ratingDate, uint upperLimit);
uint getMovieEra(movie m, uint ratingDate, uint upperLimit);
};
}
#endif /*PREPROC_H_*/