org.apache.mahout.cf.taste.impl.transforms
Class CaseAmplification

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.transforms.CaseAmplification
All Implemented Interfaces:
Refreshable, SimilarityTransform

public final class CaseAmplification
extends Object
implements SimilarityTransform

Applies "case amplification" to similarities. This essentially makes big values bigger and small values smaller by raising each score to a power. It could however be used to achieve the opposite effect.


Constructor Summary
CaseAmplification(double factor)
           Creates a transformation based on the given factor.
 
Method Summary
 void refresh(Collection<Refreshable> alreadyRefreshed)
           Triggers "refresh" -- whatever that means -- of the implementation.
 String toString()
           
 double transformSimilarity(long id1, long id2, double value)
           Transforms one similarity value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaseAmplification

public CaseAmplification(double factor)

Creates a transformation based on the given factor.

Parameters:
factor - transformation factor
Throws:
IllegalArgumentException - if factor is 0.0 or Double.NaN
Method Detail

transformSimilarity

public double transformSimilarity(long id1,
                                  long id2,
                                  double value)

Transforms one similarity value. This implementation is such that it's possible to define this transformation on one value in isolation. The "thing" parameters are therefore unused.

Specified by:
transformSimilarity in interface SimilarityTransform
Parameters:
id1 - unused
id2 - unused
value - similarity to transform
Returns:
value<sup>factor</sup> if value is nonnegative; -value<sup>-factor</sup> otherwise

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 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 - s that are known to have already been refreshed as a result of an initial call to a 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-2012 The Apache Software Foundation. All Rights Reserved.