public class CSV extends Object
DEFAULT_DELIMITER
and
DEFAULT_COMMENT
respectively.Double.NaN
and as -1 for categorical features.Modifier and Type | Field and Description |
---|---|
static char |
DEFAULT_COMMENT |
static char |
DEFAULT_DELIMITER |
Modifier and Type | Method and Description |
---|---|
static SimpleDataSet |
read(Path path,
char delimiter,
int lines_to_skip,
char comment,
Set<Integer> cat_cols)
Reads in the given CSV dataset as a simple CSV file
|
static SimpleDataSet |
read(Path path,
int lines_to_skip,
Set<Integer> cat_cols)
Reads in the given CSV dataset as a simple CSV file
|
static SimpleDataSet |
read(Reader reader,
char delimiter,
int lines_to_skip,
char comment,
Set<Integer> cat_cols)
Reads in the given CSV dataset as a simple CSV file
|
static SimpleDataSet |
read(Reader reader,
int lines_to_skip,
Set<Integer> cat_cols)
Reads in the given CSV dataset as a simple CSV file
|
static ClassificationDataSet |
readC(int classification_target,
Path path,
char delimiter,
int lines_to_skip,
char comment,
Set<Integer> cat_cols)
Reads in a CSV dataset as a classification dataset.
|
static ClassificationDataSet |
readC(int classification_target,
Path path,
int lines_to_skip,
Set<Integer> cat_cols)
Reads in a CSV dataset as a classification dataset.
|
static ClassificationDataSet |
readC(int classification_target,
Reader reader,
char delimiter,
int lines_to_skip,
char comment,
Set<Integer> cat_cols)
Reads in a CSV dataset as a classification dataset.
|
static ClassificationDataSet |
readC(int classification_target,
Reader reader,
int lines_to_skip,
Set<Integer> cat_cols)
Reads in a CSV dataset as a classification dataset.
|
static RegressionDataSet |
readR(int numeric_target_column,
Path path,
char delimiter,
int lines_to_skip,
char comment,
Set<Integer> cat_cols)
Reads in a CSV dataset as a regression dataset.
|
static RegressionDataSet |
readR(int numeric_target_column,
Path path,
int lines_to_skip,
Set<Integer> cat_cols)
Reads in a CSV dataset as a regression dataset.
|
static RegressionDataSet |
readR(int numeric_target_column,
Reader reader,
char delimiter,
int lines_to_skip,
char comment,
Set<Integer> cat_cols)
Reads in a CSV dataset as a regression dataset.
|
static RegressionDataSet |
readR(int numeric_target_column,
Reader reader,
int lines_to_skip,
Set<Integer> cat_cols)
Reads in a CSV dataset as a regression dataset.
|
static void |
write(DataSet<?> data,
Path path)
Writes out the given dataset as a CSV file.
|
static void |
write(DataSet<?> data,
Path path,
char delimiter)
Writes out the given dataset as a CSV file.
|
static void |
write(DataSet<?> data,
Writer writer)
Writes out the given dataset as a CSV file.
|
static void |
write(DataSet<?> data,
Writer writer,
char delimiter)
Writes out the given dataset as a CSV file.
|
public static final char DEFAULT_DELIMITER
public static final char DEFAULT_COMMENT
public static RegressionDataSet readR(int numeric_target_column, Path path, int lines_to_skip, Set<Integer> cat_cols) throws IOException
numeric_target_column
- the column index (starting from zero) of the
feature that will be the target regression valuepath
- the reader for the CSV contentlines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)cat_cols
- a set of the indices to treat as categorical features.IOException
public static RegressionDataSet readR(int numeric_target_column, Reader reader, int lines_to_skip, Set<Integer> cat_cols) throws IOException
numeric_target_column
- the column index (starting from zero) of the
feature that will be the target regression valuereader
- the reader for the CSV contentlines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)cat_cols
- a set of the indices to treat as categorical features.IOException
public static RegressionDataSet readR(int numeric_target_column, Path path, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException
numeric_target_column
- the column index (starting from zero) of the
feature that will be the target regression valuepath
- the CSV file to readdelimiter
- the delimiter to separate columns, usually a commalines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)comment
- the character used to indicate the start of a comment.
Once this character is reached, anything at and after the character will
be ignored.cat_cols
- a set of the indices to treat as categorical features.IOException
public static RegressionDataSet readR(int numeric_target_column, Reader reader, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException
numeric_target_column
- the column index (starting from zero) of the
feature that will be the target regression valuereader
- the reader for the CSV contentdelimiter
- the delimiter to separate columns, usually a commalines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)comment
- the character used to indicate the start of a comment.
Once this character is reached, anything at and after the character will
be ignored.cat_cols
- a set of the indices to treat as categorical features.IOException
public static ClassificationDataSet readC(int classification_target, Path path, int lines_to_skip, Set<Integer> cat_cols) throws IOException
classification_target
- the column index (starting from zero) of the
feature that will be the categorical target valuepath
- the CSV file to readlines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)cat_cols
- a set of the indices to treat as categorical features.IOException
public static ClassificationDataSet readC(int classification_target, Reader reader, int lines_to_skip, Set<Integer> cat_cols) throws IOException
classification_target
- the column index (starting from zero) of the
feature that will be the categorical target valuereader
- the reader for the CSV contentlines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)cat_cols
- a set of the indices to treat as categorical features.IOException
public static ClassificationDataSet readC(int classification_target, Reader reader, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException
classification_target
- the column index (starting from zero) of the
feature that will be the categorical target valuereader
- the reader for the CSV contentdelimiter
- the delimiter to separate columns, usually a commalines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)comment
- the character used to indicate the start of a comment.
Once this character is reached, anything at and after the character will
be ignored.cat_cols
- a set of the indices to treat as categorical features.IOException
public static ClassificationDataSet readC(int classification_target, Path path, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException
classification_target
- the column index (starting from zero) of the
feature that will be the categorical target valuepath
- the CSV filedelimiter
- the delimiter to separate columns, usually a commalines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)comment
- the character used to indicate the start of a comment.
Once this character is reached, anything at and after the character will
be ignored.cat_cols
- a set of the indices to treat as categorical features.IOException
public static SimpleDataSet read(Path path, int lines_to_skip, Set<Integer> cat_cols) throws IOException
path
- the CSV filelines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)cat_cols
- a set of the indices to treat as categorical features.IOException
public static SimpleDataSet read(Reader reader, int lines_to_skip, Set<Integer> cat_cols) throws IOException
reader
- the reader for the CSV contentlines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)cat_cols
- a set of the indices to treat as categorical features.IOException
public static SimpleDataSet read(Path path, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException
path
- the CSV file to readdelimiter
- the delimiter to separate columns, usually a commalines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)comment
- the character used to indicate the start of a comment.
Once this character is reached, anything at and after the character will
be ignored.cat_cols
- a set of the indices to treat as categorical features.IOException
public static SimpleDataSet read(Reader reader, char delimiter, int lines_to_skip, char comment, Set<Integer> cat_cols) throws IOException
reader
- the reader for the CSV contentdelimiter
- the delimiter to separate columns, usually a commalines_to_skip
- the number of lines to skip when reading in the CSV
(used to skip header information)comment
- the character used to indicate the start of a comment.
Once this character is reached, anything at and after the character will
be ignored.cat_cols
- a set of the indices to treat as categorical features.IOException
public static void write(DataSet<?> data, Path path) throws IOException
data
- the dataset object to save as a CSV filepath
- the path to write the CSV toIOException
public static void write(DataSet<?> data, Writer writer) throws IOException
data
- the dataset object to save as a CSV filewriter
- the output writer to write the CSV toIOException
public static void write(DataSet<?> data, Path path, char delimiter) throws IOException
data
- the dataset object to save as a CSV filepath
- the path to write the CSV todelimiter
- the delimiter between column values, normally a commaIOException
public static void write(DataSet<?> data, Writer writer, char delimiter) throws IOException
data
- the dataset object to save as a CSV filewriter
- the output writer to write the CSV todelimiter
- the delimiter between column values, normally a commaIOException
Copyright © 2017. All rights reserved.