CFEngine API

org.recommender.algorithms.Experimental
Class HortingAlgorithm

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

public class HortingAlgorithm
extends java.lang.Object
implements CFAlgorithm

Describes an implementation of the CFAlgorithm interface to make CF predictions using the graph-theoretic algorithm described by Aggarwal, et al based on notions of horting and predictability.

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

Field Summary
(package private)  long hortTime
          Keep track of total time spent horting and predicting
(package private)  long predictTime
           
 
Constructor Summary
HortingAlgorithm(DataManager dataMgr)
          Constructor, when neighborLists unavailable
HortingAlgorithm(DataManager dataMgr, java.util.ArrayList neighborLists)
          Constructor with neighborLists available
 
Method Summary
 long getAveragePredictionTime()
          Get average prediction time.
 java.util.ArrayList getNeighborLists()
          Return neighborLists
 ItemPrediction[] getRecommendations(int activeUser, int n)
          Returns top n recommendations.
 ItemPrediction[] getRecommendationsByType(int activeUser, int n, int type)
          Yun Wang Return top n recommendations of specific type.
 ItemPrediction predictRating(int userID, int itemID)
          Get predicted rating for a user's item
 java.lang.String toString()
          Return the name of this algorithm
 void updateUser(int userID)
          When new user comes in, update the neighborLists and maxUser and HortingArray.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hortTime

long hortTime
Keep track of total time spent horting and predicting


predictTime

long predictTime
Constructor Detail

HortingAlgorithm

public HortingAlgorithm(DataManager dataMgr)
Constructor, when neighborLists unavailable

Parameters:
dataMgr -

HortingAlgorithm

public HortingAlgorithm(DataManager dataMgr,
                        java.util.ArrayList neighborLists)
Constructor with neighborLists available

Parameters:
dataMgr -
neighborLists -
Method Detail

getNeighborLists

public java.util.ArrayList getNeighborLists()
Return neighborLists

Returns:
neighborLists

predictRating

public ItemPrediction predictRating(int userID,
                                    int itemID)
                             throws CFNotImplementedException
Get predicted rating for a user's item

Specified by:
predictRating in interface CFAlgorithm
Parameters:
userID -
itemID -
Returns:
predicted rating
CFNotImplementedException

getAveragePredictionTime

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

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

getRecommendationsByType

public ItemPrediction[] getRecommendationsByType(int activeUser,
                                                 int n,
                                                 int type)
                                          throws java.sql.SQLException,
                                                 CFNotImplementedException
Yun Wang Return top n recommendations of specific type.

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:
ratingsArray
Throws:
java.sql.SQLException
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

updateUser

public void updateUser(int userID)
                throws CFNotImplementedException
When new user comes in, update the neighborLists and maxUser and HortingArray.

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

CFEngine API

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