prea.main
Class Prea

java.lang.Object
  extended by prea.main.Prea

public class Prea
extends java.lang.Object

The main class of this toolkit. It includes loading the dataset, splitting train/test set, and interface to evaluation for each algorithms.

Since:
2012. 4. 20
Version:
1.1
Author:
Joonseok Lee

Field Summary
static java.lang.String algorithmCode
          The code for an algorithm which will run.
static java.lang.String[] algorithmParameters
          Parameter list for the algorithm to run.
static java.lang.String[] columnName
          The list of item names, provided with the dataset.
static java.lang.String dataFileName
          The name of data file used for test.
static int evaluationMode
          Evaluation mode
static int foldCount
          The number of folds when k-fold cross-validation is used.
static int itemCount
          The number of items.
static SparseVector itemRateAverage
          Average of ratings for each item.
static boolean itemSimilarityPrefetch
          Indicating whether loading pre-calculated item similarity file or not
static int maxValue
          Maximum value of rating, existing in the dataset.
static int minValue
          Minimum value of rating, existing in the dataset.
static SparseMatrix rateMatrix
          Rating matrix for each user (row) and item (column)
static boolean runAllAlgorithms
          Indicating whether to run all algorithms.
static java.lang.String splitFileName
          The name of predefined split data file.
static SparseMatrix testMatrix
          Rating matrix for test items.
static double testRatio
          Proportion of items which will be used for test purpose.
static int userCount
          The number of users.
static SparseVector userRateAverage
          Average of ratings for each user.
static boolean userSimilarityPrefetch
          Indicating whether loading pre-calculated user similarity file or not
 
Constructor Summary
Prea()
           
 
Method Summary
static void main(java.lang.String[] argv)
          Test examples for every algorithm.
private static void parseCommandLine(java.lang.String[] command)
          Parse the command from user.
private static void readArff(java.lang.String fileName)
          Read the data file in ARFF format, and store it in rating matrix.
private static void run()
          Run an/all algorithm with given data, based on the setting from command arguments.
static void runAll()
          Run all algorithms with given data.
static void runIndividual(java.lang.String algorithmCode, java.lang.String[] parameters)
          Run one algorithm with customized parameters with given data.
static java.lang.String testRecommender(java.lang.String algorithmName, Recommender r)
          Test interface for a recommender system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataFileName

public static java.lang.String dataFileName
The name of data file used for test.


evaluationMode

public static int evaluationMode
Evaluation mode


testRatio

public static double testRatio
Proportion of items which will be used for test purpose.


splitFileName

public static java.lang.String splitFileName
The name of predefined split data file.


foldCount

public static int foldCount
The number of folds when k-fold cross-validation is used.


runAllAlgorithms

public static boolean runAllAlgorithms
Indicating whether to run all algorithms.


algorithmCode

public static java.lang.String algorithmCode
The code for an algorithm which will run.


algorithmParameters

public static java.lang.String[] algorithmParameters
Parameter list for the algorithm to run.


userSimilarityPrefetch

public static boolean userSimilarityPrefetch
Indicating whether loading pre-calculated user similarity file or not


itemSimilarityPrefetch

public static boolean itemSimilarityPrefetch
Indicating whether loading pre-calculated item similarity file or not


rateMatrix

public static SparseMatrix rateMatrix
Rating matrix for each user (row) and item (column)


testMatrix

public static SparseMatrix testMatrix
Rating matrix for test items. Not allowed to refer during training and validation phase.


userRateAverage

public static SparseVector userRateAverage
Average of ratings for each user.


itemRateAverage

public static SparseVector itemRateAverage
Average of ratings for each item.


userCount

public static int userCount
The number of users.


itemCount

public static int itemCount
The number of items.


maxValue

public static int maxValue
Maximum value of rating, existing in the dataset.


minValue

public static int minValue
Minimum value of rating, existing in the dataset.


columnName

public static java.lang.String[] columnName
The list of item names, provided with the dataset.

Constructor Detail

Prea

public Prea()
Method Detail

main

public static void main(java.lang.String[] argv)
Test examples for every algorithm. Also includes parsing the given parameters.

Parameters:
argv - The argument list. Each element is separated by an empty space. First element is the data file name, and second one is the algorithm name. Third and later includes parameters for the chosen algorithm. Please refer to our web site for detailed syntax.

run

private static void run()
Run an/all algorithm with given data, based on the setting from command arguments.


parseCommandLine

private static void parseCommandLine(java.lang.String[] command)
Parse the command from user.

Parameters:
command - The command string given by user.

testRecommender

public static java.lang.String testRecommender(java.lang.String algorithmName,
                                               Recommender r)
Test interface for a recommender system. Print MAE, RMSE, and rank-based half-life score for given test data.

Returns:
evaluation metrics and elapsed time for learning and evaluation.

runIndividual

public static void runIndividual(java.lang.String algorithmCode,
                                 java.lang.String[] parameters)
Run one algorithm with customized parameters with given data.


runAll

public static void runAll()
Run all algorithms with given data.


readArff

private static void readArff(java.lang.String fileName)
Read the data file in ARFF format, and store it in rating matrix. Peripheral information such as max/min values, user/item count are also set in this method.

Parameters:
fileName - The name of data file.