Class SimpleTransform
java.lang.Object
org.tribuo.transform.transformations.SimpleTransform
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TransformationProvenance>,Serializable,Transformation,Transformer,TransformStatistics
public final class SimpleTransform
extends Object
implements Transformer, Transformation, TransformStatistics
This is used for stateless functions such as exp, log, addition or multiplication by a constant.
It's a Transformation, Transformer and TransformStatistics as it has no data dependent state. This means a single Transformer can be used for every feature in a dataset.
Wraps a DoubleUnaryOperator which actually performs the
transformation.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumOperations understood by this Transformation.static final classProvenance forSimpleTransform. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SimpleTransformadd(double operand) Generate a SimpleTransform that adds the operand to each value.static SimpleTransformbinarise()Generate a SimpleTransform that sets negative and zero values to zero and positive values to one.Returns itself.static SimpleTransformdiv(double operand) Generate a SimpleTransform that divides each value by the operand.static SimpleTransformexp()Generate a SimpleTransform that appliesMath.exp(double).Returns itself.static SimpleTransformlog()Generate a SimpleTransform that appliesMath.log(double).static SimpleTransformmul(double operand) Generate a SimpleTransform that multiplies each value by the operand.voidNo-op on this TransformStatistics.voidobserveSparse(int count) No-op on this TransformStatistics.voidobserveValue(double value) No-op on this TransformStatistics.voidUsed by the OLCUT configuration system, and should not be called by external code.static SimpleTransformsub(double operand) Generate a SimpleTransform that subtracts the operand from each value.static SimpleTransformthreshold(double min, double max) Generate a SimpleTransform that sets values below min to min, and values above max to max.toString()doubletransform(double input) Apply the operation to the input.
-
Field Details
-
EPSILON
- See Also:
-
-
Method Details
-
postConfig
Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfigin interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
getProvenance
- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<TransformationProvenance>
-
observeValue
No-op on this TransformStatistics.- Specified by:
observeValuein interfaceTransformStatistics- Parameters:
value- The value to observe
-
observeSparse
No-op on this TransformStatistics.- Specified by:
observeSparsein interfaceTransformStatistics
-
observeSparse
No-op on this TransformStatistics.- Specified by:
observeSparsein interfaceTransformStatistics- Parameters:
count- The number of sparse values.
-
generateTransformer
Returns itself.- Specified by:
generateTransformerin interfaceTransformStatistics- Returns:
- this.
-
createStats
Returns itself.- Specified by:
createStatsin interfaceTransformation- Returns:
- this.
-
transform
Apply the operation to the input.- Specified by:
transformin interfaceTransformer- Parameters:
input- The input value to transform.- Returns:
- The transformed value.
-
toString
-
exp
Generate a SimpleTransform that appliesMath.exp(double).- Returns:
- The exponential function.
-
log
Generate a SimpleTransform that appliesMath.log(double).- Returns:
- The logarithm function.
-
add
Generate a SimpleTransform that adds the operand to each value.- Parameters:
operand- The operand to add.- Returns:
- An addition function.
-
sub
Generate a SimpleTransform that subtracts the operand from each value.- Parameters:
operand- The operand to subtract.- Returns:
- A subtraction function.
-
mul
Generate a SimpleTransform that multiplies each value by the operand.- Parameters:
operand- The operand to multiply.- Returns:
- A multiplication function.
-
div
Generate a SimpleTransform that divides each value by the operand.- Parameters:
operand- The divisor.- Returns:
- A division function.
-
binarise
Generate a SimpleTransform that sets negative and zero values to zero and positive values to one.- Returns:
- A binarising function.
-
threshold
Generate a SimpleTransform that sets values below min to min, and values above max to max.- Parameters:
min- The minimum value. To not threshold below, set toDouble.NEGATIVE_INFINITY.max- The maximum value. To not threshold above, set toDouble.POSITIVE_INFINITY.- Returns:
- A thresholding function.
-