|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprea.main.Splitter
public class Splitter
This class helps to save train/test split and similarity prefetch files. This may be used for repeated experiment on same environment.
Field Summary | |
---|---|
static java.lang.String[] |
columnName
The list of item names, provided with the dataset. |
static int |
itemCount
The number of items. |
static SparseVector |
itemRateAverage
Average rating for each item. |
static int |
MEAN_ABS_DIFF
Similarity measure code for Mean Absoulte Difference. |
static int |
MEAN_SQUARE_DIFF
Similarity measure code for Mean Squared Difference. |
static int |
PEARSON_CORR
Similarity measure code for Pearson Correlation. |
static SparseMatrix |
rateMatrix
Rating matrix for train dataset. |
static double |
testRatio
Ratio of dataset which will be used for test purpose. |
static int |
userCount
The number of users. |
static SparseVector |
userRateAverage
Average rating for each user. |
static int |
VECTOR_COS
Similarity measure code for Vector Cosine. |
Constructor Summary | |
---|---|
Splitter()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] argv)
Main method for reading the arff file, writing split and similarity results. |
private static void |
readArff(java.lang.String fileName)
Read the data file in ARFF format, and store it in rating matrix. |
private static double |
similarity(boolean rowOriented,
SparseVector i1,
SparseVector i2,
double i1Avg,
double i2Avg,
int method)
Calculate similarity between two given vectors. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static double testRatio
public static final int PEARSON_CORR
public static final int VECTOR_COS
public static final int MEAN_SQUARE_DIFF
public static final int MEAN_ABS_DIFF
public static SparseMatrix rateMatrix
public static SparseVector userRateAverage
public static SparseVector itemRateAverage
public static java.lang.String[] columnName
public static int userCount
public static int itemCount
Constructor Detail |
---|
public Splitter()
Method Detail |
---|
public static void main(java.lang.String[] argv)
argv
- The argument list. First two are required: input file name and testset ratio.
Next two are optional, indicating whether it computes and prints similarity for users and items.private static double similarity(boolean rowOriented, SparseVector i1, SparseVector i2, double i1Avg, double i2Avg, int method)
rowOriented
- Use true if user-based, false if item-based.i1
- The first vector to calculate similarity.i2
- The second vector to calculate similarity.i1Avg
- The average of elements in the first vector.i2Avg
- The average of elements in the second vector.method
- The code of similarity measure to be used.
It can be one of the following: PEARSON_CORR, VECTOR_COS,
MEAN_SQUARE_DIFF, MEAN_ABS_DIFF, or INVERSE_USER_FREQUENCY.
private static void readArff(java.lang.String fileName)
fileName
- The name of data file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |