CFEngine API

org.recommender.algorithms.Experimental
Class TransNeighborAlgorithm

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

public class TransNeighborAlgorithm
extends java.lang.Object
implements CFAlgorithm

Implementation of a transitive nearest-neighbor CF algorithm. Find neighbors using Pearson correlation. If none of our neighbors have rated a given item, try our neighbors' neighbors.

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

Constructor Summary
TransNeighborAlgorithm(DataManager dataMgr)
          Constructor, initialize algorithm parameters.
 
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)
          Not yet complete
 SimilarityWeight getWeight(int activeUser, int neighbor)
          Compute a correlation between activeUser and one neighbor.
 void linkToPredictors(int userID)
          Link to predictors.
 ItemPrediction predictRating(int activeUser, int item)
          predicts the rating for the given user and item.
 java.lang.String toString()
          Returns a simple text identifier for 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
 

Constructor Detail

TransNeighborAlgorithm

public TransNeighborAlgorithm(DataManager dataMgr)
Constructor, initialize algorithm parameters.

Parameters:
dataMgr -
Method Detail

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

getRecommendations

public ItemPrediction[] getRecommendations(int activeUser,
                                           int n)
                                    throws java.sql.SQLException,
                                           CFNotImplementedException
Returns top n recommendations.

Specified by:
getRecommendations in interface CFAlgorithm
Parameters:
activeUser -
n -
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
Return average prediction time.

Specified by:
getAveragePredictionTime in interface CFAlgorithm
Returns:
long
CFNotImplementedException

getWeight

public SimilarityWeight getWeight(int activeUser,
                                  int neighbor)
Compute a correlation between activeUser and one neighbor.

Parameters:
activeUser -
neighbor -
Returns:
SimilarityWeight

linkToPredictors

public void linkToPredictors(int userID)
Link to predictors.

Parameters:
userID -

toString

public java.lang.String toString()
Returns a simple text identifier for 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