Package org.datavec.api.io.labels
Class PatternPathLabelGenerator
- java.lang.Object
-
- org.datavec.api.io.labels.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 Summary
Fields Modifier and Type Field Description protected Stringpatternprotected intpatternPosition
-
Constructor Summary
Constructors Constructor Description PatternPathLabelGenerator(String pattern)PatternPathLabelGenerator(String pattern, int patternPosition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WritablegetLabelForPath(String path)WritablegetLabelForPath(URI uri)booleaninferLabelClasses()If true: infer the set of possible label classes, and convert these to integer indexes.
-
-
-
Field Detail
-
pattern
protected String pattern
-
patternPosition
protected int patternPosition
-
-
Method Detail
-
getLabelForPath
public Writable getLabelForPath(String path)
- Specified by:
getLabelForPathin interfacePathLabelGenerator
-
getLabelForPath
public Writable getLabelForPath(URI uri)
- Specified by:
getLabelForPathin interfacePathLabelGenerator
-
inferLabelClasses
public boolean inferLabelClasses()
Description copied from interface:PathLabelGeneratorIf 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:
inferLabelClassesin interfacePathLabelGenerator- Returns:
- whether label classes should be inferred
-
-