org.apache.mahout.cf.taste.similarity
Interface UserSimilarity

All Superinterfaces:
Refreshable
All Known Implementing Classes:
CachingUserSimilarity, CityBlockSimilarity, EuclideanDistanceSimilarity, GenericUserSimilarity, LogLikelihoodSimilarity, PearsonCorrelationSimilarity, SpearmanCorrelationSimilarity, TanimotoCoefficientSimilarity, UncenteredCosineSimilarity

public interface UserSimilarity
extends Refreshable

Implementations of this interface define a notion of similarity between two users. Implementations should return values in the range -1.0 to 1.0, with 1.0 representing perfect similarity.

See Also:
ItemSimilarity

Method Summary
 void setPreferenceInferrer(PreferenceInferrer inferrer)
           Attaches a PreferenceInferrer to the UserSimilarity implementation.
 double userSimilarity(long userID1, long userID2)
           Returns the degree of similarity, of two users, based on the their preferences.
 
Methods inherited from interface org.apache.mahout.cf.taste.common.Refreshable
refresh
 

Method Detail

userSimilarity

double userSimilarity(long userID1,
                      long userID2)
                      throws TasteException

Returns the degree of similarity, of two users, based on the their preferences.

Parameters:
userID1 - first user ID
userID2 - second user ID
Returns:
similarity between the users, in [-1,1] or Double.NaN similarity is unknown
Throws:
NoSuchUserException - if either user is known to be non-existent in the data
TasteException - if an error occurs while accessing the data

setPreferenceInferrer

void setPreferenceInferrer(PreferenceInferrer inferrer)

Attaches a PreferenceInferrer to the UserSimilarity implementation.

Parameters:
inferrer - PreferenceInferrer


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.