Class IndexExtractor

java.lang.Object
org.tribuo.data.columnar.extractors.IndexExtractor
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>, FieldExtractor<Long>

public class IndexExtractor extends Object implements FieldExtractor<Long>
An Extractor with special casing for loading the index from a Row. The index is written out as a Long.

This is the row wise count, i.e., the number of examples that the data source has processed, rather than anything extracted from the data.

  • Constructor Details

    • IndexExtractor

      public IndexExtractor(String metadataName)
      Extracts the index, writing to the supplied metadata field name.
      Parameters:
      metadataName - The metadata field to write to.
    • IndexExtractor

      public IndexExtractor()
      Extracts the index writing to the default metadata field name Example.NAME.
  • Method Details

    • getMetadataName

      public String getMetadataName()
      Description copied from interface: FieldExtractor
      Gets the metadata key name. This is the key into which this value will be written in an Example if it is given to RowProcessor.
      Specified by:
      getMetadataName in interface FieldExtractor<Long>
      Returns:
      The metadata key name.
    • getValueType

      public Class<Long> getValueType()
      Description copied from interface: FieldExtractor
      Gets the class of the value produced by this extractor.
      Specified by:
      getValueType in interface FieldExtractor<Long>
      Returns:
      The class of the value.
    • extract

      public Optional<Long> extract(ColumnarIterator.Row row)
      Description copied from interface: FieldExtractor
      Returns Optional which is filled if extraction succeeded.
      Specified by:
      extract in interface FieldExtractor<Long>
      Parameters:
      row - The raw row from which to extract a value
      Returns:
      A value.
    • 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>