public final class ThresholdUserNeighborhood extends Object
Computes a neigbhorhood consisting of all users whose similarity to the given user meets or exceeds a
certain threshold. Similarity is defined by the given UserSimilarity
.
Constructor and Description |
---|
ThresholdUserNeighborhood(double threshold,
UserSimilarity userSimilarity,
DataModel dataModel) |
ThresholdUserNeighborhood(double threshold,
UserSimilarity userSimilarity,
DataModel dataModel,
double samplingRate) |
Modifier and Type | Method and Description |
---|---|
long[] |
getUserNeighborhood(long userID) |
void |
refresh(Collection<Refreshable> alreadyRefreshed)
Triggers "refresh" -- whatever that means -- of the implementation.
|
String |
toString() |
public ThresholdUserNeighborhood(double threshold, UserSimilarity userSimilarity, DataModel dataModel)
threshold
- similarity thresholduserSimilarity
- similarity metricdataModel
- data modelIllegalArgumentException
- if threshold is Double.NaN
, or if samplingRate is not positive and less than or equal
to 1.0, or if userSimilarity or dataModel are null
public ThresholdUserNeighborhood(double threshold, UserSimilarity userSimilarity, DataModel dataModel, double samplingRate)
threshold
- similarity thresholduserSimilarity
- similarity metricdataModel
- data modelsamplingRate
- percentage of users to consider when building neighborhood -- decrease to trade quality for
performanceIllegalArgumentException
- if threshold or samplingRate is Double.NaN
, or if samplingRate is not positive and less
than or equal to 1.0, or if userSimilarity or dataModel are null
public long[] getUserNeighborhood(long userID) throws TasteException
userID
- ID of user for which a neighborhood will be computedTasteException
- if an error occurs while accessing datapublic final void refresh(Collection<Refreshable> alreadyRefreshed)
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.
refresh
in interface Refreshable
alreadyRefreshed
- Refreshable
s that are known to have already been
refreshed as a result of an initial call to a {#refresh(Collection)} method on some
object. This ensure that objects in a refresh dependency graph aren't refreshed twice
needlessly.Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.