|
CFEngine API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.recommender.algorithms.Experimental.UserItemAlgorithm
Describes an implementation of the CFAlgorithm interface to make CF predictions using a modification of the Simple Pearson Correlation method. We find neighbors using Pearson correlations, but weight the effect of each item by its similarity to the target item we're predicting. i.e. in computing the similarity between two users, some items have a larger effect than others.
Field Summary | |
(package private) float[] |
itemAverages
|
(package private) float[][] |
itemWeights
|
Constructor Summary | |
UserItemAlgorithm(DataManager dataMgr)
Initialize parameters, set up neighborhood, and calculate item average. |
Method Summary | |
(package private) void |
calcItemAverages()
Calculate item averages. |
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 |
float |
getWeight(int activeitem,
int neighbor)
Weight the effect of each item by its similarity to the target item we're predicting. |
SimilarityWeight |
getWeight(int activeuser,
int neighbor,
int item)
Calculate CorrelatinCoeff for an item between the activeuser and one neighbor. |
ItemPrediction |
predictRating(int activeUser,
int item)
Predicts the rating for the given user and item. |
(package private) void |
setUpNeighborhoods()
Set up neighborhood using pearson correlations. |
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 |
Field Detail |
float[][] itemWeights
float[] itemAverages
Constructor Detail |
public UserItemAlgorithm(DataManager dataMgr)
dataMgr
- the DataManager to get data fromMethod Detail |
void setUpNeighborhoods()
public float getWeight(int activeitem, int neighbor)
activeitem
- neighbor
- void calcItemAverages()
public ItemPrediction[] getRecommendations(int activeUser, int n) throws java.sql.SQLException, CFNotImplementedException
getRecommendations
in interface CFAlgorithm
activeUser
- n
-
java.sql.SQLException
CFNotImplementedException
public ItemPrediction[] getRecommendationsByType(int activeUser, int n, int type) throws java.sql.SQLException, CFNotImplementedException
getRecommendationsByType
in interface CFAlgorithm
activeUser
- n
- type
-
java.sql.SQLException
CFNotImplementedException
public ItemPrediction predictRating(int activeUser, int item) throws CFNotImplementedException
predictRating
in interface CFAlgorithm
activeUser
- item
-
CFNotImplementedException
public long getAveragePredictionTime() throws CFNotImplementedException
getAveragePredictionTime
in interface CFAlgorithm
CFNotImplementedException
public SimilarityWeight getWeight(int activeuser, int neighbor, int item)
activeuser
- neighbor
-
public void updateUser(int userID) throws CFNotImplementedException
updateUser
in interface CFAlgorithm
userID
-
CFNotImplementedException
public java.lang.String toString()
toString
in interface CFAlgorithm
toString
in class java.lang.Object
|
CFEngine API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |