SLIM  1.0
Sparse Linear Methods (SLIM) for top-n recommender systems
 All Data Structures Files Functions Variables Typedefs Macros Pages
struct.h
Go to the documentation of this file.
1 /**************************************************************/
2 /*! \file
3 
4  \brief This file contains all the necessary data structures
5 */
6 /**************************************************************/
7 
8 
9 #ifndef __STRUCT_H__
10 #define __STRUCT_H__
11 
12 
13 
14 /**************************************************************/
15 /*!
16  \brief A data structure for timer
17  */
18 /**************************************************************/
19 typedef struct {
20 
21  /*! The start time */
22  clock_t start;
23  /*! The end time */
24  clock_t end;
25 
26 }ctimer_t;
27 
28 
29 
30 /**************************************************************/
31 /*!
32  \brief A data structure for ctrl parameters
33  */
34 /**************************************************************/
35 typedef struct{
36 
37  /*! a file name that contains the training data in csr format */
38  char * train_file;
39  /*! a file name that contains the testing data in csr format */
40  char * test_file;
41  /*! a file name into which the model in csr format will be output */
42  char * model_file;
43  /*! a file name into which the prediction will be output */
44  char * pred_file;
45 
46  /*! debug level, default 0 */
47  int dbglvl;
48 
49  /*! the regularization parameter for L-1 norm */
50  double lambda;
51  /*! the regularization parameter for L-2 norm */
52  double beta;
53 
54  /*! the starting column index from which the coefficient matrix is calculated */
55  int starti;
56  /*! the ending column index from which the coefficient matrix is calculated */
57  int endi;
58 
59  /*! optimality tolerance */
60  double optTol;
61  /*! max number of iterations allowed in BCLS solver */
63 
64  /*! lower bound for BCLS */
65  double bl;
66  /*! upper bound for BCLS */
67  double bu;
68 
69  /*! if feature selection is applied */
70  int fs;
71  /*! a file name which contains a constraint matrix in csr format for feature selection */
72  char * fs_file;
73 
74  /*! number of features to use if feature selection is applied*/
75  int k;
76 
77  /*! block size for data dump */
78  int bsize;
79 
80  /*! number of ratings */
81  int nratings;
82 
83  /*! the number of recommendations to be recommended */
84  int topn;
85 
86  /*! need to transpose the matrix */
87  int transpose;
88 
89 }ctrl_t;
90 
91 
92 
93 /**************************************************************/
94 /*!
95  \brief A matrix structure used for BCLS. This is adopted from
96  BCLS.
97  */
98 /**************************************************************/
99 typedef struct cs_sparse{
100 
101  /*! maximum number of entries */
102  int nzmax ;
103  /*! number of rows */
104  int m ;
105  /*! number of columns */
106  int n ;
107  /*! column pointers (size n+1) or col indices (size nzmax) */
108  int *p ;
109  /*! row indices, size nzmax */
110  int *i ;
111  /*! numerical values, size nzmax */
112  float *x ;
113  /*! number of entries in triplet matrix, -1 for compressed-col */
114  int nz ;
115 
116 }cs;
117 
118 /**************************************************************/
119 /*!
120  \brief A workspace structure used for BCLS. This is adopated
121  from BCLS.
122  */
123 /**************************************************************/
124 typedef struct {
125 
126  /*! a matrix*/
127  cs *A;
128  /*! max number of iterations allowed in BCLS solver */
130  /*! the active columns */
131  int * acol;
132 
133 } worksp;
134 
135 
136 
137 #endif