CFEngine API

org.recommender.algorithms.Experimental
Class PersonalityAlgorithm

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

public class PersonalityAlgorithm
extends java.lang.Object
implements CFAlgorithm

Describes an implementation of the CFAlgorithm interface to make CF predictions using the Personality Diagnosis algorithm described in Pennock et al, 1999.

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

Field Summary
(package private)  int lastUser
           
(package private)  float[][] probTable
           
(package private)  java.util.List similarityWeightList
           
 
Constructor Summary
PersonalityAlgorithm(DataManager dataMgr)
          Constructor, initialize algorithm parameters and DataManager.
 
Method Summary
 long getAveragePredictionTime()
          Return average prediction time.
 ItemPrediction[] getRecommendations(int activeUser, int n)
          Not yet implemented.
 ItemPrediction[] getRecommendationsByType(int activeUser, int n, int type)
          Not yet complete
 SimilarityWeight getWeight(int activeuser, int neighbor)
          Calculate relative probability that the activeuser is of the same personality type as the neighbor.
protected  float noiseProb(float r1, float r2)
          Find the probability that an observed rating of r1 corresponds to the "true" rating of r2, assuming that observed ratings differ from "true" ratings by adding Gaussian noise.
 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)
          Not yet implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

probTable

float[][] probTable

lastUser

int lastUser

similarityWeightList

java.util.List similarityWeightList
Constructor Detail

PersonalityAlgorithm

public PersonalityAlgorithm(DataManager dataMgr)
Constructor, initialize algorithm parameters and DataManager.

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
Not yet implemented.

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:
predictedRating
CFNotImplementedException

getAveragePredictionTime

public long getAveragePredictionTime()
Return average prediction time.

Specified by:
getAveragePredictionTime in interface CFAlgorithm
Returns:
average prediction time

noiseProb

protected float noiseProb(float r1,
                          float r2)
Find the probability that an observed rating of r1 corresponds to the "true" rating of r2, assuming that observed ratings differ from "true" ratings by adding Gaussian noise.

Parameters:
r1 - observed rating
r2 - hypothesized "true" rating
Returns:
probability

getWeight

public SimilarityWeight getWeight(int activeuser,
                                  int neighbor)
Calculate relative probability that the activeuser is of the same personality type as the neighbor. Note that the probabilities returned by this method will not sum to one; they must be normalized. This probability is returned as a SimilarityWeight, for convenience in sorting.

Parameters:
activeuser -
neighbor -
Returns:
SimilarityWeight

updateUser

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

Specified by:
updateUser in interface CFAlgorithm
Parameters:
userID -
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