Class TransformationMap

java.lang.Object
org.tribuo.transform.TransformationMap
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>

public class TransformationMap extends Object implements com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
A carrier type for a set of transformations to be applied to a Dataset.

Feature specific transformations are specified using a regex. If multiple regexes match a given feature, then an IllegalArgumentException is thrown when Dataset.createTransformers(TransformationMap) is called.

Global transformations are applied after all feature specific transformations.

Transformations only operate on observed values. To operate on implicit zeros then first call MutableDataset.densify() on the datasets. See org.tribuo.transform for a more detailed discussion of densify.

  • Constructor Details

    • TransformationMap

      public TransformationMap(List<Transformation> globalTransformations, Map<String,List<Transformation>> featureTransformations)
      Creates a transformation map from the supplied global transformation list, and per feature transformations.
      Parameters:
      globalTransformations - The global transformations.
      featureTransformations - The per feature transformations.
    • TransformationMap

      public TransformationMap(List<Transformation> globalTransformations)
      Creates a TransformationMap with only global transformations.
      Parameters:
      globalTransformations - The global transformations.
    • TransformationMap

      public TransformationMap(Map<String,List<Transformation>> featureTransformations)
      Creates a TransformationMap with only per feature transformations.
      Parameters:
      featureTransformations - The per feature transformations.
  • Method Details

    • postConfig

      public void postConfig()
      Used by the OLCUT configuration system, and should not be called by external code.
      Specified by:
      postConfig in interface com.oracle.labs.mlrg.olcut.config.Configurable
    • validateTransformations

      public boolean validateTransformations(FeatureMap featureMap)
      Checks that a given transformation set doesn't have conflicts when applied to the supplied featureMap.
      Parameters:
      featureMap - The featureMap to check.
      Returns:
      True if the transformation set doesn't have conflicts, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getGlobalTransformations

      public List<Transformation> getGlobalTransformations()
      Gets the global transformations in this TransformationMap.
      Returns:
      The global transformations
    • getFeatureTransformations

      public Map<String,List<Transformation>> getFeatureTransformations()
      Gets the map of feature specific transformations.
      Returns:
      The feature specific transformations.
    • getProvenance

      public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()
      Specified by:
      getProvenance in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>