CFEngine API

org.recommender.algorithms
Interface CFAlgorithm

All Known Implementing Classes:
BayesNetAlgorithm, ClusteringAlgorithm, ContinuousBayesNetAlgorithm, DumbPopAlgorithm, HortingAlgorithm, ItemItemAlgorithm, PersonalityAlgorithm, PopAlgorithm, SimpleDistributionAlgorithm, SimplePearsonAlgorithm, SimpleSVD, SVD_Cosine, SVD_Pearson, TransNeighborAlgorithm, UserItem2Algorithm, UserItemAlgorithm, VectorSimilarityAlgorithm

public interface CFAlgorithm

Interface for a collaborative filtering algorithm.

Author:
Sameer Kadam, Matt McLaughlin

Method Summary
 long getAveragePredictionTime()
          Very useful to get the prediction time after a bunch of experiment Should be implemented within each algorithm class.
 ItemPrediction[] getRecommendations(int activeUser, int n)
          Return top n recommendations for the active user.
 ItemPrediction[] getRecommendationsByType(int activeUser, int n, int type)
          Added by Yun Wang Return top n recommendations for the active user of specific type.
 ItemPrediction predictRating(int userID, int itemID)
          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 algorithm.
 void updateUser(int userID)
          Notify algorithm that the given user's ratings have changed.
 

Method Detail

predictRating

public ItemPrediction predictRating(int userID,
                                    int itemID)
                             throws CFNotImplementedException
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.

Parameters:
userID -
itemID -
Returns:
predictedRating
CFNotImplementedException

getRecommendations

public ItemPrediction[] getRecommendations(int activeUser,
                                           int n)
                                    throws java.sql.SQLException,
                                           CFNotImplementedException
Return top n recommendations for the active user. Note: Returned array contains only recommendations for non-rated items. All recommendations must be valid. If there is an insufficient number of recommendations to fulfill the requested amount, return a filled array of size equal to the number of valid recommendations. All recommendations' predicted values must comply to same guidelines set forth by predictRating() in CFAlgorithm.

Parameters:
activeUser -
n -
Returns:
itemPredList
Throws:
java.sql.SQLException
CFNotImplementedException

toString

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

Overrides:
toString in class java.lang.Object
Returns:
String

getAveragePredictionTime

public long getAveragePredictionTime()
                              throws CFNotImplementedException
Very useful to get the prediction time after a bunch of experiment Should be implemented within each algorithm class.

Returns:
average prediction time
CFNotImplementedException

updateUser

public void updateUser(int userID)
                throws CFNotImplementedException
Notify algorithm that the given user's ratings have changed.

Parameters:
userID -
CFNotImplementedException

getRecommendationsByType

public ItemPrediction[] getRecommendationsByType(int activeUser,
                                                 int n,
                                                 int type)
                                          throws java.sql.SQLException,
                                                 CFNotImplementedException
Added by Yun Wang Return top n recommendations for the active user of specific type. Note: Returned array contains only recommendations for non-rated items. All recommendations must be valid. If there is an insufficient number of recommendations to fulfill the requested amount, return a filled array of size equal to the number of valid recommendations. All recommendations' predicted values must comply to same guidelines set forth by predictRating() in CFAlgorithm.

Parameters:
activeUser -
n -
type -
Returns:
itemPredList
Throws:
java.sql.SQLException
CFNotImplementedException

CFEngine API

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