prea.util
Class Loss

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

public class Loss
extends java.lang.Object

This is a class implementing loss functions generally used in collaborative filtering algorithms.

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

Constructor Summary
Loss()
           
 
Method Summary
static double asymmetricLoss(double realRate, double predictedRate, double minValue, double maxValue)
          Asymmetric loss matrix/function.
private static int bound(double value, double minValue, double maxValue)
          Return the rounded index for a rating in a given range
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Loss

public Loss()
Method Detail

asymmetricLoss

public static double asymmetricLoss(double realRate,
                                    double predictedRate,
                                    double minValue,
                                    double maxValue)
Asymmetric loss matrix/function. Note that this should be used only for discrete ratings.

Parameters:
realRate - Target real rating.
predictedRate - Target predicted rating.
minValue - Possible minimum value of the domain.
maxValue - Possible maximum value of the domain.
Returns:
Asymmetric loss for the given target rating.

bound

private static int bound(double value,
                         double minValue,
                         double maxValue)
Return the rounded index for a rating in a given range

Parameters:
value - The target rating to bound.
minValue - The minimum of given range.
maxValue - The maximum of given range.
Returns:
the bounded index.