1mlpack_cf(1) User Commands mlpack_cf(1)
2
3
4
6 mlpack_cf - collaborative filtering
7
9 mlpack_cf [-a string] [-A bool] [-m unknown] [-I bool] [-N int] [-r double] [-n int] [-q string] [-R int] [-c int] [-s int] [-T string] [-t string] [-V bool] [-o string] [-M unknown] [-h -v]
10
12 This program performs collaborative filtering (CF) on the given
13 dataset. Given a list of user, item and preferences (the '--train‐
14 ing_file (-t)' parameter), the program will perform a matrix decomposi‐
15 tion and then can perform a series of actions related to collaborative
16 filtering. Alternately, the program can load an existing saved CF model
17 with the '--input_model_file (-m)' parameter and then use that model to
18 provide recommendations or predict values.
19
20 The input matrix should be a 3-dimensional matrix of ratings, where the
21 first dimension is the user, the second dimension is the item, and the
22 third dimension is that user's rating of that item. Both the users and
23 items should be numeric indices, not names. The indices are assumed to
24 start from 0.
25
26 A set of query users for which recommendations can be generated may be
27 specified with the '--query_file (-q)' parameter; alternately, recom‐
28 mendations may be generated for every user in the dataset by specifying
29 the ’--all_user_recommendations (-A)' parameter. In addition, the num‐
30 ber of recommendations per user to generate can be specified with the
31 ’--recommendations (-c)' parameter, and the number of similar users
32 (the size of the neighborhood) to be considered when generating recom‐
33 mendations can be specified with the '--neighborhood (-n)' parameter.
34
35 For performing the matrix decomposition, the following optimization
36 algorithms can be specified via the '--algorithm (-a)' parameter:
37
38 · ’RegSVD' -- Regularized SVD using a SGD optimizer
39
40 · ’NMF' -- Non-negative matrix factorization with alternating
41 least squares update rules
42
43 · ’BatchSVD' -- SVD batch learning
44
45 · ’SVDIncompleteIncremental' -- SVD incomplete incremental
46 learning
47
48 · ’SVDCompleteIncremental' -- SVD complete incremental learning
49
50 A trained model may be saved to with the '--output_model_file (-M)'
51 output parameter.
52
53 To train a CF model on a dataset 'training_set.csv' using NMF for
54 decomposition and saving the trained model to 'model.bin', one could
55 call:
56
57 $ cf --training_file training_set.csv --algorithm NMF --out‐
58 put_model_file model.bin
59
60 Then, to use this model to generate recommendations for the list of
61 users in the query set 'users.csv', storing 5 recommendations in 'rec‐
62 ommendations.csv', one could call
63
64 $ cf --input_model_file model.bin --query_file users.csv --recommenda‐
65 tions 5 --output_file recommendations.csv
66
68 --algorithm (-a) [string]
69 Algorithm used for matrix factorization. Default value 'NMF'.
70
71 --all_user_recommendations (-A) [bool]
72 Generate recommendations for all users.
73
74 --help (-h) [bool]
75 Default help info.
76
77 --info [string]
78 Get help on a specific module or option. Default value ''.
79
80 --input_model_file (-m) [unknown]
81 Trained CF model to load. Default value ''.
82
83 --iteration_only_termination (-I) [bool]
84 Terminate only when the maximum number of iterations is reached.
85
86 --max_iterations (-N) [int]
87 Maximum number of iterations. If set to zero, there is no limit
88 on the number of iterations. Default value 1000.
89
90 --min_residue (-r) [double]
91 Residue required to terminate the factorization (lower values
92 generally mean better fits). Default value 1e-05.
93
94 --neighborhood (-n) [int]
95 Size of the neighborhood of similar users to consider for each
96 query user. Default value 5.
97
98 --query_file (-q) [string]
99 List of query users for which recommendations should be gener‐
100 ated. Default value ''.
101
102 --rank (-R) [int]
103 Rank of decomposed matrices (if 0, a heuristic is used to esti‐
104 mate the rank). Default value 0. --recommendations (-c) [int]
105 Number of recommendations to generate for each query user.
106 Default value 5.
107
108 --seed (-s) [int]
109 Set the random seed (0 uses std::time(NULL)). Default value 0.
110
111 --test_file (-T) [string]
112 Test set to calculate RMSE on. Default value ''.
113
114 --training_file (-t) [string]
115 Input dataset to perform CF on. Default value ''.
116
117 --verbose (-v) [bool]
118 Display informational messages and the full list of parameters
119 and timers at the end of execution.
120
121 --version (-V) [bool]
122 Display the version of mlpack.
123
125 --output_file (-o) [string]
126 Matrix that will store output recommendations. Default value
127 ''.
128
129 --output_model_file (-M) [unknown]
130 Output for trained CF model. Default value ''.
131
133 For further information, including relevant papers, citations, and the‐
134 ory, consult the documentation found at http://www.mlpack.org or
135 included with your distribution of mlpack.
136
137
138
139mlpack-3.0.4 21 February 2019 mlpack_cf(1)