org.apache.mahout.ep
Class Mapping

java.lang.Object
  extended by org.apache.mahout.math.function.DoubleFunction
      extended by org.apache.mahout.ep.Mapping
All Implemented Interfaces:
org.apache.hadoop.io.Writable
Direct Known Subclasses:
Mapping.Exponential, Mapping.Identity, Mapping.LogLimit, Mapping.SoftLimit

public abstract class Mapping
extends DoubleFunction
implements org.apache.hadoop.io.Writable

Provides coordinate tranformations so that evolution can proceed on the entire space of reals but have the output limited and squished in convenient (and safe) ways.


Nested Class Summary
static class Mapping.Exponential
           
static class Mapping.Identity
           
static class Mapping.LogLimit
           
static class Mapping.SoftLimit
           
 
Method Summary
static Mapping exponential()
          Maps results to positive values.
static Mapping exponential(double scale)
          Maps results to positive values.
static Mapping identity()
          Maps results to themselves.
static Mapping logLimit(double low, double high)
          Maps input to positive values in the open interval (min, max) with 0 going to the geometric mean.
static Mapping softLimit(double min, double max)
          Maps input to the open interval (min, max) with 0 going to the mean of min and max.
static Mapping softLimit(double min, double max, double scale)
          Maps input to the open interval (min, max) with 0 going to the mean of min and max.
 
Methods inherited from class org.apache.mahout.math.function.DoubleFunction
apply, isDensifying
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.io.Writable
readFields, write
 

Method Detail

softLimit

public static Mapping softLimit(double min,
                                double max,
                                double scale)
Maps input to the open interval (min, max) with 0 going to the mean of min and max. When scale is large, a larger proportion of values are mapped to points near the boundaries. When scale is small, a larger proportion of values are mapped to points well within the boundaries.

Parameters:
min - The largest lower bound on values to be returned.
max - The least upper bound on values to be returned.
scale - Defines how sharp the boundaries are.
Returns:
A mapping that satisfies the desired constraint.

softLimit

public static Mapping softLimit(double min,
                                double max)
Maps input to the open interval (min, max) with 0 going to the mean of min and max. When scale is large, a larger proportion of values are mapped to points near the boundaries.

Parameters:
min - The largest lower bound on values to be returned.
max - The least upper bound on values to be returned.
Returns:
A mapping that satisfies the desired constraint.
See Also:
softLimit(double, double, double)

logLimit

public static Mapping logLimit(double low,
                               double high)
Maps input to positive values in the open interval (min, max) with 0 going to the geometric mean. Near the geometric mean, values are distributed roughly geometrically.

Parameters:
low - The largest lower bound for output results. Must be >0.
high - The least upper bound for output results. Must be >0.
Returns:
A mapped value.

exponential

public static Mapping exponential()
Maps results to positive values.

Returns:
A positive value.

exponential

public static Mapping exponential(double scale)
Maps results to positive values.

Parameters:
scale - If large, then large values are more likely.
Returns:
A positive value.

identity

public static Mapping identity()
Maps results to themselves.

Returns:
The original value.


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