CFEngine API

org.recommender.algorithms.Experimental
Class DumbPopAlgorithm

java.lang.Object
  |
  +--org.recommender.algorithms.Experimental.DumbPopAlgorithm
All Implemented Interfaces:
CFAlgorithm

public class DumbPopAlgorithm
extends java.lang.Object
implements CFAlgorithm

Describes an implementation of the CFAlgorithm interface to make CF predictions using a poor non-personalized prediction algorithm. The ratings it predicts are simply the average ratings for each movie. This generally doesn't work as well as PopAlgorithm, which takes into account different user means.

Author:
Daniel Lowd <dlowd@cs.orst.edu>

Constructor Summary
DumbPopAlgorithm(DataManager mgr)
          Constructor, simply assigns DataManager.
 
Method Summary
 long getAveragePredictionTime()
          Return average prediction time.
 ItemPrediction[] getRecommendations(int activeUser, int n)
          Returns top n recommendations.
 ItemPrediction[] getRecommendationsByType(int activeUser, int n, int type)
          Yun Wang Return top n recommendations of specific type.
 ItemPrediction predictRating(int activeUser, int item)
          Asks the prediction engine to return a prediction for how a particular user will rate a particular item.
 java.lang.String toString()
          Return the name of this algorithm.
 void updateUser(int userID)
          Requires no action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DumbPopAlgorithm

public DumbPopAlgorithm(DataManager mgr)
Constructor, simply assigns DataManager.

Parameters:
mgr -
Method Detail

getRecommendationsByType

public ItemPrediction[] getRecommendationsByType(int activeUser,
                                                 int n,
                                                 int type)
                                          throws java.sql.SQLException,
                                                 CFNotImplementedException
Yun Wang Return top n recommendations of specific type.

Specified by:
getRecommendationsByType in interface CFAlgorithm
Parameters:
activeUser -
n -
type -
Returns:
itemPredList
Throws:
java.sql.SQLException
CFNotImplementedException

getRecommendations

public ItemPrediction[] getRecommendations(int activeUser,
                                           int n)
                                    throws java.sql.SQLException,
                                           CFNotImplementedException
Returns top n recommendations. Uses the same algorithm as predictRating, but predicts all items the user has not rated, rather than just one. Sorts the items in reverse order of rating and returns the list.

Specified by:
getRecommendations in interface CFAlgorithm
Parameters:
activeUser - user to predict for
n - number of recommendations to acquire
Returns:
itemPredList
Throws:
java.sql.SQLException
CFNotImplementedException

predictRating

public ItemPrediction predictRating(int activeUser,
                                    int item)
                             throws CFNotImplementedException
Description copied from interface: CFAlgorithm
Asks the prediction engine to return a prediction for how a particular user will rate a particular item. Note: Predicted Rating must be in the range designated by the dataset. Use DataManger's getMaxRating() and getMinRating to verify this.

Specified by:
predictRating in interface CFAlgorithm
Parameters:
activeUser -
item -
Returns:
predictedRating
CFNotImplementedException

updateUser

public void updateUser(int userID)
                throws CFNotImplementedException
Requires no action.

Specified by:
updateUser in interface CFAlgorithm
Parameters:
userID -
CFNotImplementedException

getAveragePredictionTime

public long getAveragePredictionTime()
                              throws CFNotImplementedException
Return average prediction time.

Specified by:
getAveragePredictionTime in interface CFAlgorithm
Returns:
long
CFNotImplementedException

toString

public java.lang.String toString()
Return the name of this algorithm.

Specified by:
toString in interface CFAlgorithm
Overrides:
toString in class java.lang.Object
Returns:
String

CFEngine API

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