public static class CsvDataset.CsvBuilder<T extends CsvDataset.CsvBuilder<T>>
extends ai.djl.training.dataset.RandomAccessDataset.BaseBuilder<T>
CsvDataset.| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.csv.CSVFormat |
csvFormat |
protected java.net.URL |
csvUrl |
protected java.util.List<CsvDataset.Feature> |
features |
protected java.util.List<CsvDataset.Feature> |
labels |
| Modifier | Constructor and Description |
|---|---|
protected |
CsvBuilder() |
| Modifier and Type | Method and Description |
|---|---|
T |
addCategoricalFeature(java.lang.String name)
Adds a categorical feature to the feature set.
|
T |
addCategoricalFeature(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Integer> map,
boolean onehotEncode)
Adds a categorical feature to the feature set with specified mapping.
|
T |
addCategoricalLabel(java.lang.String name)
Adds a categorical feature to the label set.
|
T |
addCategoricalLabel(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Integer> map,
boolean onehotEncode)
Adds a categorical feature to the feature set with specified mapping.
|
T |
addFeature(CsvDataset.Feature... features)
Adds the features to the feature set.
|
T |
addLabel(CsvDataset.Feature... labels)
Adds the features to the label set.
|
T |
addNumericFeature(java.lang.String name)
Adds a numeric feature to the feature set.
|
T |
addNumericLabel(java.lang.String name)
Adds a number feature to the label set.
|
CsvDataset |
build()
Builds the new
CsvDataset. |
T |
optCsvFile(java.nio.file.Path csvFile)
Sets the optional CSV file path.
|
T |
optCsvUrl(java.lang.String csvUrl)
Sets the optional CSV file URL.
|
protected T |
self() |
T |
setCsvFormat(org.apache.commons.csv.CSVFormat csvFormat)
Sets the CSV file format.
|
protected java.net.URL csvUrl
protected org.apache.commons.csv.CSVFormat csvFormat
protected java.util.List<CsvDataset.Feature> features
protected java.util.List<CsvDataset.Feature> labels
protected T self()
self in class ai.djl.training.dataset.RandomAccessDataset.BaseBuilder<T extends CsvDataset.CsvBuilder<T>>public T optCsvFile(java.nio.file.Path csvFile)
csvFile - the CSV file pathpublic T optCsvUrl(java.lang.String csvUrl)
csvUrl - the CSV file URLpublic T setCsvFormat(org.apache.commons.csv.CSVFormat csvFormat)
csvFormat - the CSVFormatpublic T addFeature(CsvDataset.Feature... features)
features - the featurespublic T addNumericFeature(java.lang.String name)
name - the feature namepublic T addCategoricalFeature(java.lang.String name)
name - the feature namepublic T addCategoricalFeature(java.lang.String name, java.util.Map<java.lang.String,java.lang.Integer> map, boolean onehotEncode)
name - the feature namemap - a map contains categorical value maps to indexonehotEncode - true if use onehot encodepublic T addLabel(CsvDataset.Feature... labels)
labels - the labelspublic T addNumericLabel(java.lang.String name)
name - the label namepublic T addCategoricalLabel(java.lang.String name)
name - the feature namepublic T addCategoricalLabel(java.lang.String name, java.util.Map<java.lang.String,java.lang.Integer> map, boolean onehotEncode)
name - the feature namemap - a map contains categorical value maps to indexonehotEncode - true if use onehot encodepublic CsvDataset build()
CsvDataset.CsvDataset