|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectOneClassTest
public class OneClassTest
This is an One-class Collaborative Filtering Test main file.
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 int |
ITEM_ORIENTED
|
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 double[][] |
itemSimilarity
Item Similarity |
static java.lang.String |
itemSimilarityFileName
The name of pre-calculated item similarity file, if it is used. |
static int |
MAX_DIFF
|
static int |
maxValue
Maximum value of rating, existing in the dataset. |
static int |
minValue
Minimum value of rating, existing in the dataset. |
static int |
NEIGHBOR_SIZE
The number of similar users/items to be used for estimation in neighborhood-based methods. |
static SparseMatrix |
rateMatrix
Rating matrix for each user (row) and item (column) |
static int |
SCORE_REFLECT
|
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 int |
THRESHOLD_ROULETTE
|
static int |
THRESHOLD_UNIFORM
|
static int |
UNIFORM_RANDOM
|
static int |
USER_ORIENTED
|
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 | |
---|---|
OneClassTest()
|
Method Summary | |
---|---|
private static void |
calculateAverage()
Calculate average of ratings for each user and each item. |
static void |
constantModelTest(int method)
Test interface for fast Constant Model baselines. |
static void |
fastNPCATest(double validationRatio,
int maxIter)
Test interface for fast NPCA. |
private static double |
getItemSuitability(int[] itemList,
int targetItem)
Calculate the suitability of an item for a specific user, assuming that the user likes items in the itemList. |
private static void |
hideRatingsAbs(double min,
double max)
Remove ratings from the rateMatrix, between min and max, inclusive. |
private static void |
hideRatingsTic(double tic)
|
private static int |
locateInProbDist(double[] distribution,
double value,
int min,
int max)
Return the index of given data from a cumulative probability distribution. |
static void |
main(java.lang.String[] argv)
Test examples for every algorithm. |
static void |
matrixFactorizationTest(int method,
int features,
double learningRate,
double regularizer,
double momentum,
int maxIter)
Test interface for fast Matrix-Factorization-based algorithms. |
static void |
memoryBasedTest(int k,
int method,
int similarityMethod,
boolean defaultUse,
double defaultValue)
Test interface for Memory-based algorithms. |
static void |
rankBasedTest(double kernelWidth)
Test interface for Mingxuan's Rank-based 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 |
readItemSimData()
Read the pre-calculated item similarity data file. |
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 |
sampleNegative(int sampleCount,
int method)
|
static void |
slopeOneTest()
Test interface for slope-one algorithm. |
private static void |
split(double testRatio)
Items which will be used for test purpose are moved from rateMatrix to testMatrix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double TEST_RATIO
public static final int NEIGHBOR_SIZE
public static boolean SPLIT_PREFETCH
public static boolean USER_SIM_PREFETCH
public static boolean ITEM_SIM_PREFETCH
public static int UNIFORM_RANDOM
public static int USER_ORIENTED
public static int ITEM_ORIENTED
public static int MAX_DIFF
public static int THRESHOLD_UNIFORM
public static int THRESHOLD_ROULETTE
public static int SCORE_REFLECT
public static SparseMatrix rateMatrix
public static SparseMatrix testMatrix
public static SparseVector userRateAverage
public static SparseVector itemRateAverage
public static int userCount
public static int itemCount
public static int maxValue
public static int minValue
public static java.lang.String[] columnName
public static java.lang.String dataFileName
public static java.lang.String itemSimilarityFileName
public static double[][] itemSimilarity
Constructor Detail |
---|
public OneClassTest()
Method Detail |
---|
public static void main(java.lang.String[] argv)
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.public static void constantModelTest(int method)
method
- The code for algorithm to be tested.public static void memoryBasedTest(int k, int method, int similarityMethod, boolean defaultUse, double defaultValue)
k
- The neighborhood size.method
- The code for algorithm to be tested.public static void slopeOneTest()
public static void matrixFactorizationTest(int method, int features, double learningRate, double regularizer, double momentum, int maxIter)
method
- The code for algorithm to be tested.features
- The number of features in low-rank matrix representation.learningRate
- The learning rate for gradient-descent.regularizer
- The regularization parameter.momentum
- The momentum parameter.maxIter
- Maximum The number of iteration.public static void fastNPCATest(double validationRatio, int maxIter)
validationRatio
- Fraction of items which will be used for validation.maxIter
- maximum The number of iteration.public static void rankBasedTest(double kernelWidth)
kernelWidth
- The kernel bandwidth.private static void split(double testRatio)
testRatio
- proportion of items which will be used for test purpose.private static void recoverTestItems()
private static void hideRatingsAbs(double min, double max)
min
- Minimum rating value to be deleted.max
- Maximum rating value to be deleted.private static void hideRatingsTic(double tic)
private static void sampleNegative(int sampleCount, int method)
private static int locateInProbDist(double[] distribution, double value, int min, int max)
distribution
- The cumulative probability distributionvalue
- The data value to locatemin
- The minimum index to deal withmax
- The maximum index to deal with
private static double getItemSuitability(int[] itemList, int targetItem)
itemList
- The list of items which are liked by an user.targetItem
- The target item which wants to know suitability for the user.
private static void readItemSimData()
private static void readArff(java.lang.String fileName)
fileName
- The name of data file.private static void readSplitData(java.lang.String fileName)
fileName
- the name of split data file.private static void calculateAverage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |