CFEngine API

org.recommender.algorithms.Experimental
Class VectorSimilarityAlgorithm

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

public class VectorSimilarityAlgorithm
extends java.lang.Object
implements CFAlgorithm

Describes an implementation of the CFAlgorithm interface to make CF predictions using the vector similarity method. Includes an implementation of inverse user frequency weighting from Breese et al 1998, but it doesn't help and isn't recommended. May be buggy.

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

Constructor Summary
VectorSimilarityAlgorithm(DataManager dataMgr)
          Constructor.
 
Method Summary
 long getAveragePredictionTime()
          Return average prediction time.
 ItemPrediction[] getRecommendations(int activeUser, int n)
          Not yet complete
 ItemPrediction[] getRecommendationsByType(int activeUser, int n, int type)
          Not yet complete
 SimilarityWeight getWeightIUF(int activeUser, int neighbor)
          Calculate weight between two users using inverse user frequency.
 ItemPrediction predictRating(int activeUser, int item)
          Predict rating for activeUser' item.
 java.lang.String toString()
          Return the name of this algorithm.
 void updateUser(int userID)
          Not yet complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VectorSimilarityAlgorithm

public VectorSimilarityAlgorithm(DataManager dataMgr)
Constructor.

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 complete

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
Predict rating for activeUser' item.

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

getAveragePredictionTime

public long getAveragePredictionTime()
                              throws CFNotImplementedException
Return average prediction time.

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

getWeightIUF

public SimilarityWeight getWeightIUF(int activeUser,
                                     int neighbor)
Calculate weight between two users using inverse user frequency.

Parameters:
activeUser -
neighbor -
Returns:
SimilarityWeight

updateUser

public void updateUser(int userID)
                throws CFNotImplementedException
Not yet complete. This algorithm will utterly fail if users with userID's greater than the previously largest userID are added while it is running.

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