main
Class Prea

java.lang.Object
  extended by 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. 3. 26
Version:
1.1
Author:
Joonseok Lee

Field Summary
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 boolean ITEM_SIM_PREFETCH
          Indicating whether loading pre-calculated item similarity file or not
static int itemCount
          The number of items.
static SparseVector itemRateAverage
          Average of ratings for each item.
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 SPLIT_PREFETCH
          Indicating whether loading split file or not
static double TEST_RATIO
          Proportion of items which will be used for test purpose.
static SparseMatrix testMatrix
          Rating matrix for test items.
static boolean USER_SIM_PREFETCH
          Indicating whether loading pre-calculated user similarity file or not
static int userCount
          The number of users.
static SparseVector userRateAverage
          Average of ratings for each user.
 
Constructor Summary
Prea()
           
 
Method Summary
private static void calculateAverage()
          Calculate average of ratings for each user and each item.
static void main(java.lang.String[] argv)
          Test examples for every algorithm.
private static void readArff(java.lang.String fileName)
          Read the data file in ARFF format, and store it in rating matrix.
private static void readSplitData(java.lang.String fileName)
          Split the rating matrix into train and test set, by given split data file.
private static void recoverTestItems()
          Items in testMatrix are moved to original rateMatrix.
private static void split(double testRatio)
          Items which will be used for test purpose are moved from rateMatrix to testMatrix.
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

TEST_RATIO

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

See Also:
Constant Field Values

SPLIT_PREFETCH

public static boolean SPLIT_PREFETCH
Indicating whether loading split file or not


USER_SIM_PREFETCH

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


ITEM_SIM_PREFETCH

public static boolean ITEM_SIM_PREFETCH
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.


dataFileName

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

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.

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.

split

private static void split(double testRatio)
Items which will be used for test purpose are moved from rateMatrix to testMatrix.

Parameters:
testRatio - proportion of items which will be used for test purpose.

recoverTestItems

private static void recoverTestItems()
Items in testMatrix are moved to original rateMatrix.


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.

readSplitData

private static void readSplitData(java.lang.String fileName)
Split the rating matrix into train and test set, by given split data file.

Parameters:
fileName - the name of split data file.

calculateAverage

private static void calculateAverage()
Calculate average of ratings for each user and each item. Calculated results are stored in two arrays, userRateAverage and itemRateAverage.