CFEngine API

org.recommender.algorithms.Experimental
Class SVD_Cosine

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

public class SVD_Cosine
extends java.lang.Object
implements CFAlgorithm

Describes an implementation of the CFAlgorithm interface to make CF predictions using the SVD + Cosine correlation method. This is just an experimentally testing algorithm, and only the predictRating method is implemented. Some parameters are hard-coded. If you want to test this algorithm yourself, please change the parameters accordingly. Default paramters: number of users: 943 number of items: 1682 number of training ratings: 80000 number of test ratings: 20000

Author:
Shuzhen Nong

Field Summary
(package private)  float[][] A_original
           
(package private)  float[] avg_row
           
(package private)  float[][] CosineOfUser
           
 
Constructor Summary
SVD_Cosine(DataManager mgr)
          Constructor, simply assigns DataManager.
 
Method Summary
 long getAveragePredictionTime()
          Not implemented
 ItemPrediction[] getRecommendations(int activeUser, int n)
          Not implemented
 ItemPrediction[] getRecommendationsByType(int activeUser, int n, int type)
          Not implemented
 ItemPrediction predictRating(int activeUser, int item)
          Predict ratings using nearest neighbor algorithm -- user correlations are based on the Cosine distance between users' ratings on "features"
 void SVD_CosineOperation()
          Compute the Cosine distance based on users' ratings on "features"
 java.lang.String toString()
          return the name of this algorithm
 void updateUser(int userID)
          Not implemented
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CosineOfUser

float[][] CosineOfUser

A_original

float[][] A_original

avg_row

float[] avg_row
Constructor Detail

SVD_Cosine

public SVD_Cosine(DataManager mgr)
Constructor, simply assigns DataManager.

Parameters:
mgr -
Method Detail

getRecommendationsByType

public ItemPrediction[] getRecommendationsByType(int activeUser,
                                                 int n,
                                                 int type)
                                          throws java.sql.SQLException,
                                                 CFNotImplementedException
Not implemented

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 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
Predict ratings using nearest neighbor algorithm -- user correlations are based on the Cosine distance between users' ratings on "features"

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

updateUser

public void updateUser(int userID)
                throws CFNotImplementedException
Not implemented

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

getAveragePredictionTime

public long getAveragePredictionTime()
                              throws CFNotImplementedException
Not implemented

Specified by:
getAveragePredictionTime in interface CFAlgorithm
Returns:
average prediction time
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

SVD_CosineOperation

public void SVD_CosineOperation()
Compute the Cosine distance based on users' ratings on "features"


CFEngine API

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