|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprea.util.Distance
public class Distance
This is a class implementing various distance measures of two vectors.
| Constructor Summary | |
|---|---|
Distance()
|
|
| Method Summary | |
|---|---|
private static void |
changePermutationIndex(int[] uItemID,
int[] vItemID)
Given two permutation, re-index the id to the set {1,2,.., n}, where n is the total items of the two permutations. |
static void |
computeAverageRank(double[] score,
double[] prb)
Return the average rank of each score with/without ties prb=(lowrank+(tie-1)/2)/(k+1) |
static double |
distanceKendall(int[] uItemID,
double[] uScore,
int[] vItemID,
double[] vScore,
int n)
Return the Kendall's Tau distance for two rankings. |
private static double |
distanceKendallParsed(int[] uItemID,
double[] uPrb,
int[] vItemID,
double[] vPrb,
int n)
Return intermediate Kendall's Tau distance for two rankings parsed by prb |
static double |
distanceNDCG(int[] uItemID,
double[] relevance,
int[] vItemID,
double[] userScore)
Return NDCG score for a ranked list given the scores and relevance of items in the list. |
static double |
distanceSpearman(int[] uItemID,
double[] uScore,
int[] vItemID,
double[] vScore,
int n)
Return Spearman distance for two rankings. |
static double |
distanceSpearmanParsed(int[] uItemID,
double[] uPrb,
int[] vItemID,
double[] vPrb,
int n)
Return the Spearman distance for two rankings parsed by probability |
private static double |
preferProbability(double avgRank_i,
double avgRank_j)
Return the probability of the item i is preferred to the item j. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Distance()
| Method Detail |
|---|
public static double distanceNDCG(int[] uItemID,
double[] relevance,
int[] vItemID,
double[] userScore)
uItemID - array of userIdsrelevance - array of relevances for userIdsvItemID - array of userIds may/maynot be in the same order as uItemIDuserScore - array of scores for userIds
private static void changePermutationIndex(int[] uItemID,
int[] vItemID)
uItemID - array of itemID sorted increasinglyvItemID - array of itemID sorted increasingly
private static double distanceKendallParsed(int[] uItemID,
double[] uPrb,
int[] vItemID,
double[] vPrb,
int n)
uItemID - array of itemID sorted increasinglyuPrb - array of probability for user uvItemID - array of itemID for user v sorted increasinglyvPrb - array of probability for user vn - the number of total items
public static double distanceKendall(int[] uItemID,
double[] uScore,
int[] vItemID,
double[] vScore,
int n)
uItemID - array of itemIDuScore - array of score for user uvItemID - array of itemID for user vvScore - array of scores for user vn - the number of total items
public static double distanceSpearmanParsed(int[] uItemID,
double[] uPrb,
int[] vItemID,
double[] vPrb,
int n)
uItemID - array of itemID sorted increasinglyuPrb - array of probability for user uvItemID - array of itemID for user v sorted increasinglyvPrb - array of probability for user vn - the number of total items
public static double distanceSpearman(int[] uItemID,
double[] uScore,
int[] vItemID,
double[] vScore,
int n)
uItemID - array of itemIDuScore - array of score for user uvItemID - array of itemID for user vvScore - array of scores for user vn - the number of total items
public static void computeAverageRank(double[] score,
double[] prb)
score - The array of scoresprb - The array of average ranks will be filled.
private static double preferProbability(double avgRank_i,
double avgRank_j)
avgRank_i - The average rank of item iavgRank_j - The average rank of item j
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||