## org.apache.mahout.cf.taste.impl.similarity
Class GenericUserSimilarity

    java.lang.Object
      org.apache.mahout.cf.taste.impl.similarity.GenericUserSimilarity

All Implemented Interfaces:
  Refreshable, UserSimilarity

    public final class GenericUserSimilarity

extends Object
implements UserSimilarity

Nested Class Summary
`static class` `GenericUserSimilarity.UserUserSimilarity`

Constructor Summary
`GenericUserSimilarity(Iterable<GenericUserSimilarity.UserUserSimilarity> similarities)`
`GenericUserSimilarity(Iterable<GenericUserSimilarity.UserUserSimilarity> similarities, int maxToKeep)`
`GenericUserSimilarity(UserSimilarity otherSimilarity, DataModel dataModel)`
`GenericUserSimilarity(UserSimilarity otherSimilarity, DataModel dataModel, int maxToKeep)`

Method Summary
`void` `refresh(Collection<Refreshable> alreadyRefreshed)` Triggers "refresh" -- whatever that means -- of the implementation.
`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 class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GenericUserSimilarity

    public GenericUserSimilarity(Iterable<GenericUserSimilarity.UserUserSimilarity> similarities)

### GenericUserSimilarity

    public GenericUserSimilarity(Iterable<GenericUserSimilarity.UserUserSimilarity> similarities,
                                 int maxToKeep)

### GenericUserSimilarity

    public GenericUserSimilarity(UserSimilarity otherSimilarity,
                                 DataModel dataModel)
                          throws TasteException

Throws:
  `TasteException`

### GenericUserSimilarity

    public GenericUserSimilarity(UserSimilarity otherSimilarity,
                                 DataModel dataModel,
                                 int maxToKeep)
                          throws TasteException

Throws:
  `TasteException`

Method Detail

### userSimilarity

    public double userSimilarity(long userID1,
                                 long userID2)

  Description copied from interface: `UserSimilarity`

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

  Specified by:
    `userSimilarity` in interface `UserSimilarity`
  Parameters:
    `userID1` - first user ID
    `userID2` - second user ID
  Returns:
    similarity between the users, in [-1,1] or `Double.NaN` similarity is unknown

### setPreferenceInferrer

    public void setPreferenceInferrer(PreferenceInferrer inferrer)

  Description copied from interface: `UserSimilarity`

  Attaches a `PreferenceInferrer` to the `UserSimilarity` implementation.

  Specified by:
    `setPreferenceInferrer` in interface `UserSimilarity`
  Parameters:
    `inferrer` - `PreferenceInferrer`

### refresh

    public void refresh(Collection<Refreshable> alreadyRefreshed)

  Description copied from interface: `Refreshable`

  Triggers "refresh" -- whatever that means -- of the implementation. The general contract is that any `Refreshable` should always leave itself in a consistent, operational state, and that the refresh atomically updates internal state from old to new.

  Specified by:
    `refresh` in interface `Refreshable`
  Parameters:
    `alreadyRefreshed` - `Refreshable`s that are known to have already been refreshed as a result of an initial call to a `Refreshable.refresh(Collection)` method on some object. This ensure that objects in a refresh dependency graph aren't refreshed twice needlessly.

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