CFEngine API

org.recommender.algorithms
Class TestStats

java.lang.Object
  |
  +--org.recommender.algorithms.TestStats

public class TestStats
extends java.lang.Object

This class provides methods to store and print out experiment results.

Author:
Daniel Lowd

Field Summary
(package private)  int[][] confusionMatrix
          Keep track of successful and failed predictions.
(package private)  DataManager dataMgr
           
(package private)  int lastUserID
          UserID of the last rating added.
(package private)  int MAX_RATING
           
(package private)  int numFailed
          Number of ratings we could not predict
(package private)  int numRatings
          Number of ratings predicted.
(package private)  int numUserFailed
           
(package private)  int numUserRated
           
(package private)  float totalDistance
           
(package private)  float totalDistSquared
           
(package private)  float totalUserCoverage
           
(package private)  float totalUserDistance
           
(package private)  float totalUserDistSquared
           
(package private)  float userDistance
          Statistics for the current user, allowing us to do averages over all users rather than all ratings.
(package private)  float userDistSquared
           
(package private)  int usersTested
          Total number of users tested.
 
Constructor Summary
TestStats(DataManager dataMgr)
          Constructor, initialize a TestStats object.
 
Method Summary
 void addRating(int userID, int itemID, float actualRating, float predictedRating)
          When a new experiment result comes, update result stats.
 float getAvgCoverage()
          Accessor, return average coverage
 float getAvgMAE()
          Accessor, return average MAE
 float getAvgMSE()
          Accessor, return average MSE
 float getCoverage()
          Accessor, return Coverage
 float getMAE()
          Accessor, return MAE
 float getMSE()
          Accessor, return MSE
 java.lang.String toString()
          Convert the major results into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numRatings

int numRatings
Number of ratings predicted.


numFailed

int numFailed
Number of ratings we could not predict


totalDistance

float totalDistance

totalDistSquared

float totalDistSquared

lastUserID

int lastUserID
UserID of the last rating added. (We assume that all ratings from one user are grouped together.)


userDistance

float userDistance
Statistics for the current user, allowing us to do averages over all users rather than all ratings.


userDistSquared

float userDistSquared

totalUserDistance

float totalUserDistance

totalUserDistSquared

float totalUserDistSquared

numUserRated

int numUserRated

numUserFailed

int numUserFailed

totalUserCoverage

float totalUserCoverage

usersTested

int usersTested
Total number of users tested.


confusionMatrix

int[][] confusionMatrix
Keep track of successful and failed predictions. Rows represent actual rating; columns represent predicted rating. The column MAX_RATING+1 represents ratings that the algorithm could not predict.


dataMgr

DataManager dataMgr

MAX_RATING

int MAX_RATING
Constructor Detail

TestStats

public TestStats(DataManager dataMgr)
Constructor, initialize a TestStats object.

Parameters:
dataMgr - the DataManager to get data from
Method Detail

addRating

public void addRating(int userID,
                      int itemID,
                      float actualRating,
                      float predictedRating)
When a new experiment result comes, update result stats.

Parameters:
userID -
itemID -
actualRating -
predictedRating -

toString

public java.lang.String toString()
Convert the major results into a String.

Overrides:
toString in class java.lang.Object
Returns:
retVal String of results

getMAE

public float getMAE()
Accessor, return MAE

Returns:
MAE

getMSE

public float getMSE()
Accessor, return MSE

Returns:
MSE

getCoverage

public float getCoverage()
Accessor, return Coverage

Returns:
Coverage

getAvgMAE

public float getAvgMAE()
Accessor, return average MAE

Returns:
Average MAE

getAvgMSE

public float getAvgMSE()
Accessor, return average MSE

Returns:
Average MSE

getAvgCoverage

public float getAvgCoverage()
Accessor, return average coverage

Returns:
Average coverage

CFEngine API

Copyright © 2003 - Oregon State University www.orst.edu