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 String
pattern
protected int
patternPosition
-
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 Writable
getLabelForPath(String path)
Writable
getLabelForPath(URI uri)
boolean
inferLabelClasses()
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:
getLabelForPath
in interfacePathLabelGenerator
-
getLabelForPath
public Writable getLabelForPath(URI uri)
- Specified by:
getLabelForPath
in interfacePathLabelGenerator
-
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 interfacePathLabelGenerator
- Returns:
- whether label classes should be inferred
-
-