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

All Superinterfaces:
Refreshable
All Known Implementing Classes:
AbstractItemSimilarity, CachingItemSimilarity, CityBlockSimilarity, EuclideanDistanceSimilarity, FileItemSimilarity, GenericItemSimilarity, LogLikelihoodSimilarity, PearsonCorrelationSimilarity, TanimotoCoefficientSimilarity, UncenteredCosineSimilarity

public interface ItemSimilarity
extends Refreshable

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

See Also:
UserSimilarity

Method Summary
 long[] allSimilarItemIDs(long itemID)
           
 double[] itemSimilarities(long itemID1, long[] itemID2s)
          A bulk-get version of itemSimilarity(long, long).
 double itemSimilarity(long itemID1, long itemID2)
           Returns the degree of similarity, of two items, based on the preferences that users have expressed for the items.
 
Methods inherited from interface org.apache.mahout.cf.taste.common.Refreshable
refresh
 

Method Detail

itemSimilarity

double itemSimilarity(long itemID1,
                      long itemID2)
                      throws TasteException

Returns the degree of similarity, of two items, based on the preferences that users have expressed for the items.

Parameters:
itemID1 - first item ID
itemID2 - second item ID
Returns:
similarity between the items, in [-1,1] or Double.NaN similarity is unknown
Throws:
NoSuchItemException - if either item is known to be non-existent in the data
TasteException - if an error occurs while accessing the data

itemSimilarities

double[] itemSimilarities(long itemID1,
                          long[] itemID2s)
                          throws TasteException

A bulk-get version of itemSimilarity(long, long).

Parameters:
itemID1 - first item ID
itemID2s - second item IDs to compute similarity with
Returns:
similarity between itemID1 and other items
Throws:
NoSuchItemException - if any item is known to be non-existent in the data
TasteException - if an error occurs while accessing the data

allSimilarItemIDs

long[] allSimilarItemIDs(long itemID)
                         throws TasteException
Returns:
all IDs of similar items, in no particular order
Throws:
TasteException


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