prea.util
Class EvaluationMetrics

java.lang.Object
  extended by prea.util.EvaluationMetrics

public class EvaluationMetrics
extends java.lang.Object

This is a unified class providing evaluation metrics, including comparison of predicted ratings and rank-based metrics, etc.

Since:
2012. 4. 20
Version:
1.1
Author:
Joonseok Lee, Mingxuan Sun

Field Summary
private  double asymmetricLoss
          Asymmetric Loss
private  int halflife
          Half-life in rank-based metrics
private  double hlu
          Rank-based Half-Life Utility (HLU)
private  double kendallsTau
          Rank-based Kendall's Tau
private  double mae
          Mean Absoulte Error (MAE)
private  double maxValue
          Maximum value of rating, existing in the dataset.
private  double minValue
          Minimum value of rating, existing in the dataset.
private  double mse
          Mean Squared Error (MSE)
private  double ndcg
          Rank-based Normalized Discounted Cumulative Gain (NDCG)
private  SparseMatrix predicted
          Predicted ratings by CF algorithms for test items.
private  int recommendCount
          The number of items to recommend, in rank-based metrics
private  double spearman
          Rank-based Spear
private  SparseMatrix testMatrix
          Real ratings for test items.
 
Constructor Summary
EvaluationMetrics(SparseMatrix tm, SparseMatrix p, double max, double min)
          Standard constructor for EvaluationMetrics class.
 
Method Summary
private  void build()
          Calculate all evaluation metrics with given real and predicted rating matrices.
 double getAsymmetricLoss()
          Getter method for Asymmetric loss
 double getHLU()
          Getter method for Rank-based Half-life score
 double getKendall()
          Getter method for Rank-based Kendall's Tau
 double getMAE()
          Getter method for Mean Absolute Error (MAE)
 double getMSE()
          Getter method for Mean Squared Error (MSE)
 double getNDCG()
          Getter method for Rank-based NDCG
 double getNMAE()
          Getter method for Normalized Mean Absolute Error (NMAE)
 double getRMSE()
          Getter method for Root of Mean Squared Error (RMSE)
 double getSpearman()
          Getter method for Rank-based Spearman score
 java.lang.String printMultiLine()
           
 java.lang.String printOneLine()
           
static java.lang.String printTitle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

testMatrix

private SparseMatrix testMatrix
Real ratings for test items.


predicted

private SparseMatrix predicted
Predicted ratings by CF algorithms for test items.


maxValue

private double maxValue
Maximum value of rating, existing in the dataset.


minValue

private double minValue
Minimum value of rating, existing in the dataset.


recommendCount

private int recommendCount
The number of items to recommend, in rank-based metrics


halflife

private int halflife
Half-life in rank-based metrics


mae

private double mae
Mean Absoulte Error (MAE)


mse

private double mse
Mean Squared Error (MSE)


hlu

private double hlu
Rank-based Half-Life Utility (HLU)


ndcg

private double ndcg
Rank-based Normalized Discounted Cumulative Gain (NDCG)


kendallsTau

private double kendallsTau
Rank-based Kendall's Tau


spearman

private double spearman
Rank-based Spear


asymmetricLoss

private double asymmetricLoss
Asymmetric Loss

Constructor Detail

EvaluationMetrics

public EvaluationMetrics(SparseMatrix tm,
                         SparseMatrix p,
                         double max,
                         double min)
Standard constructor for EvaluationMetrics class.

Parameters:
tm - Real ratings of test items.
p - Predicted ratings of test items.
max - Maximum value of rating, existing in the dataset.
min - Minimum value of rating, existing in the dataset.
Method Detail

getMAE

public double getMAE()
Getter method for Mean Absolute Error (MAE)

Returns:
Mean Absolute Error (MAE)

getNMAE

public double getNMAE()
Getter method for Normalized Mean Absolute Error (NMAE)

Returns:
Normalized Mean Absolute Error (NMAE)

getMSE

public double getMSE()
Getter method for Mean Squared Error (MSE)

Returns:
Mean Squared Error (MSE)

getRMSE

public double getRMSE()
Getter method for Root of Mean Squared Error (RMSE)

Returns:
Root of Mean Squared Error (RMSE)

getHLU

public double getHLU()
Getter method for Rank-based Half-life score

Returns:
Rank-based Half-life score

getNDCG

public double getNDCG()
Getter method for Rank-based NDCG

Returns:
Rank-based NDCG score

getKendall

public double getKendall()
Getter method for Rank-based Kendall's Tau

Returns:
Rank-based Kendall's Tau score

getSpearman

public double getSpearman()
Getter method for Rank-based Spearman score

Returns:
Rank-based Spearman score

getAsymmetricLoss

public double getAsymmetricLoss()
Getter method for Asymmetric loss

Returns:
Asymmetric loss

build

private void build()
Calculate all evaluation metrics with given real and predicted rating matrices.


printMultiLine

public java.lang.String printMultiLine()

printOneLine

public java.lang.String printOneLine()

printTitle

public static java.lang.String printTitle()