CFEngine API

org.recommender.algorithms.Experimental
Class UserItem2Algorithm

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

public class UserItem2Algorithm
extends java.lang.Object
implements CFAlgorithm

Describes an implementation of the CFAlgorithm interface to make CF predictions using a Pearson nearest neighbor algorithm, but limited to examining similar items using the Item-Item adjusted cosine algorithm described in Sarwar, et al, 2001. Item similarities are precomputed. Then, to make an individual prediction for a user and an item, we select the N items rated by the user most similar to the item we're predicting. This subset of the user's ratings is used for correlations, which in turn yield a list of neighbors for.

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

Field Summary
(package private)  java.util.List[] neighborLists
           
 
Constructor Summary
UserItem2Algorithm(DataManager dataMgr)
          Constructor, load parameters and set up neighborhoods.
 
Method Summary
 long getAveragePredictionTime()
          Very useful to get the prediction time after a bunch of experiment Should be implemented within each algorithm class.
 ItemRating[] getRecommendations(int activeUser, int n)
          Not yet implemented.
 ItemPrediction[] getRecommendationsByType(int activeUser, int n, int type)
          Not yet complete
 ItemPrediction predictRating(int activeUser, int item)
          predicts the rating for the given user and item
(package private)  void setUpNeighborhoods()
          Set up neighborhoods.
 java.lang.String toString()
          Return the name of this algorithm.
 void updateUser(int userID)
          Not yet implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

neighborLists

java.util.List[] neighborLists
Constructor Detail

UserItem2Algorithm

public UserItem2Algorithm(DataManager dataMgr)
Constructor, load parameters and set up neighborhoods.

Method Detail

setUpNeighborhoods

void setUpNeighborhoods()
Set up neighborhoods.


getRecommendations

public ItemRating[] getRecommendations(int activeUser,
                                       int n)
                                throws java.sql.SQLException,
                                       CFNotImplementedException
Not yet implemented.

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

getRecommendationsByType

public ItemPrediction[] getRecommendationsByType(int activeUser,
                                                 int n,
                                                 int type)
                                          throws java.sql.SQLException,
                                                 CFNotImplementedException
Not yet complete

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:
predicted rating
CFNotImplementedException

updateUser

public void updateUser(int userID)
                throws CFNotImplementedException
Not yet implemented.

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

getAveragePredictionTime

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

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:
the name of this algorithm.

CFEngine API

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