Package org.tribuo.data.csv
Class CSVSaver
java.lang.Object
org.tribuo.data.csv.CSVSaver
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
Saves a Dataset in CSV format suitable for loading by
CSVLoader
.
CSVSaver is thread safe and immutable.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCSVSaver()
Builds a CSV saver using the default separator and quote fromCSVIterator
.CSVSaver
(char separator, char quote) Builds a CSV saver using the supplied separator and quote. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
Field Details
-
DEFAULT_RESPONSE
The default response column name.- See Also:
-
-
Constructor Details
-
CSVSaver
public CSVSaver(char separator, char quote) Builds a CSV saver using the supplied separator and quote.- Parameters:
separator
- The column separator.quote
- The quote character.
-
CSVSaver
public CSVSaver()Builds a CSV saver using the default separator and quote fromCSVIterator
.
-
-
Method Details
-
save
public <T extends Output<T>> void save(Path csvPath, Dataset<T> dataset, String responseName) throws IOException Saves the dataset to the specified path.- Type Parameters:
T
- The output type.- Parameters:
csvPath
- The path to save to.dataset
- The dataset to save.responseName
- The name of the response variable.- Throws:
IOException
- If the disk write failed.
-
save
public <T extends Output<T>> void save(Path csvPath, Dataset<T> dataset, Set<String> responseNames) throws IOException Saves the dataset to the specified path.- Type Parameters:
T
- The output type.- Parameters:
csvPath
- The path to save to.dataset
- The dataset to save.responseNames
- The response names set.- Throws:
IOException
- If the disk write failed.
-