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

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

All Implemented Interfaces:
  Refreshable, PreferenceInferrer

    public final class AveragingPreferenceInferrer

extends Object
implements PreferenceInferrer

Implementations of this interface compute an inferred preference for a user and an item that the user has not expressed any preference for. This might be an average of other preferences scores from that user, for example. This technique is sometimes called "default voting".

Constructor Summary
`AveragingPreferenceInferrer(DataModel dataModel)`

Method Summary
`float` `inferPreference(long userID, long itemID)` Infers the given user's preference value for an item.
`void` `refresh(Collection<Refreshable> alreadyRefreshed)` Triggers "refresh" -- whatever that means -- of the implementation.
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### AveragingPreferenceInferrer

    public AveragingPreferenceInferrer(DataModel dataModel)
                                throws TasteException

Throws:
  `TasteException`

Method Detail

### inferPreference

    public float inferPreference(long userID,
                                 long itemID)
                          throws TasteException

  Description copied from interface: `PreferenceInferrer`

  Infers the given user's preference value for an item.

  Specified by:
    `inferPreference` in interface `PreferenceInferrer`
  Parameters:
    `userID` - ID of user to infer preference for
    `itemID` - item ID to infer preference for
  Returns:
    inferred preference
  Throws:
    `TasteException` - if an error occurs while inferring

### 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.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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