jsat.io
Class DataWriter
- java.lang.Object
-
- jsat.io.DataWriter
-
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable
public abstract class DataWriter extends java.lang.Object implements java.io.CloseableThis interface defines a contract by which datapoints may be written out to a dataset file (such as a CSV) in an incremental fashion. This object is thread safe for all methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classDataWriter.DataSetType
-
Field Summary
Fields Modifier and Type Field and Description CategoricalData[]catInfothe categorical feature information for the whole corpusintdimthe number of numeric features for the whole corpusDataWriter.DataSetTypetypeThe type of dataset to be written out
-
Constructor Summary
Constructors Constructor and Description DataWriter(java.io.OutputStream out, CategoricalData[] catInfo, int dim, DataWriter.DataSetType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()voidfinish()To be called after all threads are done callingwritePoint(jsat.classifiers.DataPoint, double).voidwritePoint(DataPoint dp, double label)Write out the given data point to the output stream
-
-
-
Field Detail
-
type
public final DataWriter.DataSetType type
The type of dataset to be written out
-
catInfo
public final CategoricalData[] catInfo
the categorical feature information for the whole corpus
-
dim
public final int dim
the number of numeric features for the whole corpus
-
-
Constructor Detail
-
DataWriter
public DataWriter(java.io.OutputStream out, CategoricalData[] catInfo, int dim, DataWriter.DataSetType type) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
writePoint
public void writePoint(DataPoint dp, double label) throws java.io.IOException
Write out the given data point to the output stream- Parameters:
dp- the data point to write to the filelabel- The associated label for this dataum. Iftypeis aDataWriter.DataSetType.SIMPLEset, this value will be ignored. IfDataWriter.DataSetType.CLASSIFICATION, the value will be assumed to be an integer class label.- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOExceptionTo be called after all threads are done callingwritePoint(jsat.classifiers.DataPoint, double).- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.io.IOException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG