Package ai.djl.basicdataset.tabular
Class CsvDataset
- java.lang.Object
-
- ai.djl.training.dataset.RandomAccessDataset
-
- ai.djl.basicdataset.tabular.TabularDataset
-
- ai.djl.basicdataset.tabular.CsvDataset
-
- All Implemented Interfaces:
ai.djl.training.dataset.Dataset
- Direct Known Subclasses:
AirfoilRandomAccess
,AmazonReview
,AmesRandomAccess
,DailyDelhiClimate
,MovieLens100k
public class CsvDataset extends TabularDataset
CsvDataset
represents the dataset that stored in a .csv file.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CsvDataset.CsvBuilder<T extends CsvDataset.CsvBuilder<T>>
Used to build aCsvDataset
.-
Nested classes/interfaces inherited from class ai.djl.basicdataset.tabular.TabularDataset
TabularDataset.BaseBuilder<T extends TabularDataset.BaseBuilder<T>>
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.csv.CSVFormat
csvFormat
protected java.util.List<org.apache.commons.csv.CSVRecord>
csvRecords
protected java.net.URL
csvUrl
-
Fields inherited from class ai.djl.basicdataset.tabular.TabularDataset
features, labels
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CsvDataset(CsvDataset.CsvBuilder<?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
availableSize()
static CsvDataset.CsvBuilder<?>
builder()
Creates a builder to build aAmesRandomAccess
.protected java.lang.String
getCell(long rowIndex, java.lang.String featureName)
Returns a cell in the dataset.java.util.List<java.lang.String>
getColumnNames()
Returns the column names of the CSV file.void
prepare(ai.djl.util.Progress progress)
-
Methods inherited from class ai.djl.basicdataset.tabular.TabularDataset
get, getRowFeatures, prepareFeaturizers
-
Methods inherited from class ai.djl.training.dataset.RandomAccessDataset
getData, getData, getData, getData, randomSplit, size, subDataset, toArray
-
-
-
-
Constructor Detail
-
CsvDataset
protected CsvDataset(CsvDataset.CsvBuilder<?> builder)
-
-
Method Detail
-
getCell
protected java.lang.String getCell(long rowIndex, java.lang.String featureName)
Returns a cell in the dataset.- Specified by:
getCell
in classTabularDataset
- Parameters:
rowIndex
- the row index or record index for the cellfeatureName
- the feature or column of the cell- Returns:
- the value of the cell at that row and column
-
availableSize
protected long availableSize()
- Specified by:
availableSize
in classai.djl.training.dataset.RandomAccessDataset
-
prepare
public void prepare(ai.djl.util.Progress progress) throws java.io.IOException
- Throws:
java.io.IOException
-
builder
public static CsvDataset.CsvBuilder<?> builder()
Creates a builder to build aAmesRandomAccess
.- Returns:
- a new builder
-
getColumnNames
public java.util.List<java.lang.String> getColumnNames()
Returns the column names of the CSV file.- Returns:
- a list of column name
-
-