Class PatternPathLabelGenerator

  • All Implemented Interfaces:
    Serializable, PathLabelGenerator

    public class PatternPathLabelGenerator
    extends Object
    implements PathLabelGenerator
    Returns a label derived from the base name of the path. Splits the base name of the path with the given regex pattern, and returns the patternPosition'th element of the array.
    Author:
    saudet
    See Also:
    Serialized Form
    • Field Detail

      • pattern

        protected String pattern
      • patternPosition

        protected int patternPosition
    • Constructor Detail

      • PatternPathLabelGenerator

        public PatternPathLabelGenerator​(String pattern)
      • PatternPathLabelGenerator

        public PatternPathLabelGenerator​(String pattern,
                                         int patternPosition)
    • Method Detail

      • inferLabelClasses

        public boolean inferLabelClasses()
        Description copied from interface: PathLabelGenerator
        If true: infer the set of possible label classes, and convert these to integer indexes. If when true, the returned Writables should be text writables.

        For regression use cases (or PathLabelGenerator classification instances that do their own label -> integer assignment), this should return false.
        Specified by:
        inferLabelClasses in interface PathLabelGenerator
        Returns:
        whether label classes should be inferred