Class SVMLightRecordReader
- java.lang.Object
-
- org.datavec.api.records.reader.BaseRecordReader
-
- org.datavec.api.records.reader.impl.LineRecordReader
-
- org.datavec.api.records.reader.impl.misc.SVMLightRecordReader
-
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,Configurable,RecordReader
- Direct Known Subclasses:
LibSvmRecordReader
public class SVMLightRecordReader extends LineRecordReader
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringALLOWED_DELIMITERSprotected booleanappendLabelstatic StringCOMMENT_CHARstatic StringFEATURE_DELIMITERstatic StringLABEL_DELIMITERstatic WritableLABEL_ONEstatic WritableLABEL_ZEROprotected booleanmultilabelstatic StringMULTILABELstatic StringNAME_SPACEstatic StringNUM_ATTRIBUTESstatic StringNUM_FEATURESstatic StringNUM_LABELSprotected intnumFeaturesprotected intnumLabelsstatic WritableONEstatic StringPREFERRED_DELIMITERstatic StringQID_PREFIXprotected WritablerecordLookaheadstatic WritableZEROstatic StringZERO_BASED_INDEXINGstatic StringZERO_BASED_LABEL_INDEXINGprotected booleanzeroBasedIndexingprotected booleanzeroBasedLabelIndexing-
Fields inherited from class org.datavec.api.records.reader.impl.LineRecordReader
charset, conf, initialized, lineIndex, locations, splitIndex
-
Fields inherited from class org.datavec.api.records.reader.BaseRecordReader
inputSplit, listeners, streamCreatorFn
-
Fields inherited from interface org.datavec.api.records.reader.RecordReader
APPEND_LABEL, LABELS
-
-
Constructor Summary
Constructors Constructor Description SVMLightRecordReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected WritablegetNextRecord()Helper function to help detect lines that are commented out.booleanhasNext()Whether there are anymore recordsvoidinitialize(Configuration conf, InputSplit split)Must be called before attempting to read records.List<Writable>next()Return next record as list of Writables.RecordnextRecord()Return next Record.protected voidonLocationOpen(URI location)List<Writable>record(URI uri, DataInputStream dataInputStream)Load the record from the given DataInputStream UnlikeRecordReader.next()the internal state of the RecordReader is not modified Implementations of this method should not close the DataInputStreamvoidreset()Reset record reader iteratorvoidsetConf(Configuration conf)Set configuration.-
Methods inherited from class org.datavec.api.records.reader.impl.LineRecordReader
close, closeIfRequired, getConf, getIterator, getLabels, initialize, loadFromMetaData, loadFromMetaData, resetSupported
-
Methods inherited from class org.datavec.api.records.reader.BaseRecordReader
batchesSupported, getListeners, invokeListeners, next, setListeners, setListeners
-
-
-
-
Field Detail
-
NAME_SPACE
public static final String NAME_SPACE
-
NUM_FEATURES
public static final String NUM_FEATURES
-
ZERO_BASED_INDEXING
public static final String ZERO_BASED_INDEXING
-
ZERO_BASED_LABEL_INDEXING
public static final String ZERO_BASED_LABEL_INDEXING
-
MULTILABEL
public static final String MULTILABEL
-
NUM_LABELS
public static final String NUM_LABELS
-
COMMENT_CHAR
public static final String COMMENT_CHAR
- See Also:
- Constant Field Values
-
ALLOWED_DELIMITERS
public static final String ALLOWED_DELIMITERS
- See Also:
- Constant Field Values
-
PREFERRED_DELIMITER
public static final String PREFERRED_DELIMITER
- See Also:
- Constant Field Values
-
FEATURE_DELIMITER
public static final String FEATURE_DELIMITER
- See Also:
- Constant Field Values
-
LABEL_DELIMITER
public static final String LABEL_DELIMITER
- See Also:
- Constant Field Values
-
QID_PREFIX
public static final String QID_PREFIX
- See Also:
- Constant Field Values
-
ZERO
public static final Writable ZERO
-
ONE
public static final Writable ONE
-
LABEL_ZERO
public static final Writable LABEL_ZERO
-
LABEL_ONE
public static final Writable LABEL_ONE
-
numFeatures
protected int numFeatures
-
zeroBasedIndexing
protected boolean zeroBasedIndexing
-
zeroBasedLabelIndexing
protected boolean zeroBasedLabelIndexing
-
appendLabel
protected boolean appendLabel
-
multilabel
protected boolean multilabel
-
numLabels
protected int numLabels
-
recordLookahead
protected Writable recordLookahead
-
NUM_ATTRIBUTES
public static final String NUM_ATTRIBUTES
-
-
Method Detail
-
initialize
public void initialize(Configuration conf, InputSplit split) throws IOException, InterruptedException
Must be called before attempting to read records.- Specified by:
initializein interfaceRecordReader- Overrides:
initializein classLineRecordReader- Parameters:
conf- DataVec configurationsplit- FileSplit- Throws:
IOExceptionInterruptedException
-
setConf
public void setConf(Configuration conf)
Set configuration.- Specified by:
setConfin interfaceConfigurable- Overrides:
setConfin classLineRecordReader- Parameters:
conf- DataVec configuration- Throws:
IOExceptionInterruptedException
-
getNextRecord
protected Writable getNextRecord()
Helper function to help detect lines that are commented out. May read ahead and cache a line.- Returns:
-
hasNext
public boolean hasNext()
Description copied from interface:RecordReaderWhether there are anymore records- Specified by:
hasNextin interfaceRecordReader- Overrides:
hasNextin classLineRecordReader- Returns:
-
next
public List<Writable> next()
Return next record as list of Writables.- Specified by:
nextin interfaceRecordReader- Overrides:
nextin classLineRecordReader- Returns:
-
nextRecord
public Record nextRecord()
Return next Record.- Specified by:
nextRecordin interfaceRecordReader- Overrides:
nextRecordin classLineRecordReader- Returns:
-
record
public List<Writable> record(URI uri, DataInputStream dataInputStream) throws IOException
Description copied from interface:RecordReaderLoad the record from the given DataInputStream UnlikeRecordReader.next()the internal state of the RecordReader is not modified Implementations of this method should not close the DataInputStream- Specified by:
recordin interfaceRecordReader- Overrides:
recordin classLineRecordReader- Throws:
IOException- if error occurs during reading from the input stream
-
reset
public void reset()
Description copied from interface:RecordReaderReset record reader iterator- Specified by:
resetin interfaceRecordReader- Overrides:
resetin classLineRecordReader
-
onLocationOpen
protected void onLocationOpen(URI location)
- Overrides:
onLocationOpenin classLineRecordReader
-
-