SLIM  1.0
Sparse Linear Methods (SLIM) for top-n recommender systems
 All Data Structures Files Functions Variables Typedefs Macros Pages
test_slim_predict.c
Go to the documentation of this file.
1 /**************************************************************/
2 /*! \file test_slim_predict.c
3  \brief This is to test slim_predict
4 
5  \author Xia Ning
6  \version 1.0
7  \date 2011-2012
8  \copyright GNU Public License
9 */
10 /**************************************************************/
11 
12 #include<slim.h>
13 
14 /**************************************************************/
15 /*! \brief The main entry for the testing
16  */
17 /**************************************************************/
18 int main(int argc, char * argv[]){
19 
20  srand(0);
21 
22  /* parse command line */
23  ctrl_t * ctrl = create_ctrl();
24  parse_cmdline(ctrl, argc, argv);
25 
26  /* I/O */
27  gk_csr_t * train = gk_csr_Read(ctrl->train_file, GK_CSR_FMT_CSR, 1, 1);
28  gk_csr_t * test = gk_csr_Read(ctrl->test_file, GK_CSR_FMT_CSR, 1, 1);
29  gk_csr_t * model = gk_csr_Read(ctrl->model_file, GK_CSR_FMT_CSR, 1, 1);
30 
31  /* preprocess training data */
32  preprocess(ctrl, train, test);
33 
34 
35  /* learning */
36  slim_predict(ctrl, train, test, model);
37 
38 
39  /* clean up */
40  free_ctrl(ctrl);
41  gk_csr_Free(&train);
42  gk_csr_Free(&test);
43  gk_csr_Free(&model);
44 
45 }