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
CsvDatasetrepresents the dataset that stored in a .csv file.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCsvDataset.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.CSVFormatcsvFormatprotected java.util.List<org.apache.commons.csv.CSVRecord>csvRecordsprotected java.net.URLcsvUrl-
Fields inherited from class ai.djl.basicdataset.tabular.TabularDataset
features, labels
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCsvDataset(CsvDataset.CsvBuilder<?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longavailableSize()static CsvDataset.CsvBuilder<?>builder()Creates a builder to build aAmesRandomAccess.java.lang.StringgetCell(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.voidprepare(ai.djl.util.Progress progress)-
Methods inherited from class ai.djl.basicdataset.tabular.TabularDataset
get, getFeatures, getFeatureSize, getLabels, getLabelSize, getRowFeatures, matchingTranslatorOptions, prepareFeaturizers
-
Methods inherited from class ai.djl.training.dataset.RandomAccessDataset
getData, getData, getData, getData, newSubDataset, newSubDataset, randomSplit, size, subDataset, subDataset, subDataset, subDataset, toArray
-
-
-
-
Constructor Detail
-
CsvDataset
protected CsvDataset(CsvDataset.CsvBuilder<?> builder)
-
-
Method Detail
-
getCell
public java.lang.String getCell(long rowIndex, java.lang.String featureName)Returns a cell in the dataset.- Specified by:
getCellin 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:
availableSizein 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
-
-