CFEngine API

org.recommender.algorithms.Experimental
Class BayesNetAlgorithm

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

public class BayesNetAlgorithm
extends java.lang.Object
implements CFAlgorithm

Describes an implementation of the CFAlgorithm interface to make CF predictions using the popularity algorithm: just average ratings from all users.

Author:
Daniel Lowd

Field Summary
(package private)  BayesNet model
           
 
Constructor Summary
BayesNetAlgorithm(DataManager mgr)
          Get algorithm properties and initialize a BayesNet object.
 
Method Summary
 long getAveragePredictionTime()
          Return average prediction time
 ItemRating[] getRecommendations(int activeUser, int n)
          Returns top n recommendations Not yet complete
 ItemRating[] 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 activeUser, int item)
          predicts the rating for the given user and item.
 java.lang.String toString()
          Return the name of this algorithm
 void updateUser(int userID)
          Update user information, not yet complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

model

BayesNet model
Constructor Detail

BayesNetAlgorithm

public BayesNetAlgorithm(DataManager mgr)
                  throws CFNotImplementedException
Get algorithm properties and initialize a BayesNet object.

Parameters:
mgr - the DataManager of data
Method Detail

getRecommendations

public ItemRating[] getRecommendations(int activeUser,
                                       int n)
                                throws java.sql.SQLException,
                                       CFNotImplementedException
Returns top n recommendations Not yet complete

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

getRecommendationsByType

public ItemRating[] getRecommendationsByType(int activeUser,
                                             int n,
                                             int type)
                                      throws java.sql.SQLException,
                                             CFNotImplementedException
Description copied from interface: CFAlgorithm
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.

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

predictRating

public ItemPrediction predictRating(int activeUser,
                                    int item)
                             throws CFNotImplementedException
predicts the rating for the given user and item.

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

updateUser

public void updateUser(int userID)
                throws CFNotImplementedException
Update user information, not yet complete.

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:
average prediction time
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 the name of this algorithm

CFEngine API

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