Package ai.djl.basicdataset.tabular
Class TabularDataset.BaseBuilder<T extends TabularDataset.BaseBuilder<T>>
- java.lang.Object
-
- ai.djl.training.dataset.RandomAccessDataset.BaseBuilder<T>
-
- ai.djl.basicdataset.tabular.TabularDataset.BaseBuilder<T>
-
- Type Parameters:
T
- the builder type
- Direct Known Subclasses:
CsvDataset.CsvBuilder
- Enclosing class:
- TabularDataset
public abstract static class TabularDataset.BaseBuilder<T extends TabularDataset.BaseBuilder<T>> extends ai.djl.training.dataset.RandomAccessDataset.BaseBuilder<T>
Used to build aTabularDataset
.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
allowNoLabels
protected java.util.List<Feature>
features
protected java.util.List<Feature>
labels
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
addCategoricalFeature(java.lang.String name)
Adds a categorical feature to the feature set.T
addCategoricalFeature(java.lang.String name, boolean onehotEncode)
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, boolean onehotEncode)
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(Feature... features)
Adds the features to the feature set.T
addLabel(Feature... labels)
Adds the features to the label set.T
addNumericFeature(java.lang.String name)
Adds a numeric feature to the feature set.T
addNumericFeature(java.lang.String name, boolean normalize)
Adds a numeric feature to the feature set.T
addNumericLabel(java.lang.String name)
Adds a number feature to the label set.T
addNumericLabel(java.lang.String name, boolean normalize)
Adds a number feature to the label set.T
noLabels()
Indicates the dataset should not have any labels.
-
-
-
Method Detail
-
addFeature
public T addFeature(Feature... features)
Adds the features to the feature set.- Parameters:
features
- the features- Returns:
- this builder
-
addNumericFeature
public T addNumericFeature(java.lang.String name)
Adds a numeric feature to the feature set.- Parameters:
name
- the feature name- Returns:
- this builder
-
addNumericFeature
public T addNumericFeature(java.lang.String name, boolean normalize)
Adds a numeric feature to the feature set.- Parameters:
name
- the feature namenormalize
- true to normalize the column- Returns:
- this builder
-
addCategoricalFeature
public T addCategoricalFeature(java.lang.String name)
Adds a categorical feature to the feature set.- Parameters:
name
- the feature name- Returns:
- this builder
-
addCategoricalFeature
public T addCategoricalFeature(java.lang.String name, boolean onehotEncode)
Adds a categorical feature to the feature set.- Parameters:
name
- the feature nameonehotEncode
- true to use onehot encode- Returns:
- this builder
-
addCategoricalFeature
public 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.- Parameters:
name
- the feature namemap
- a map contains categorical value maps to indexonehotEncode
- true to use onehot encode- Returns:
- this builder
-
addLabel
public T addLabel(Feature... labels)
Adds the features to the label set.- Parameters:
labels
- the labels- Returns:
- this builder
-
addNumericLabel
public T addNumericLabel(java.lang.String name)
Adds a number feature to the label set.- Parameters:
name
- the label name- Returns:
- this builder
-
addNumericLabel
public T addNumericLabel(java.lang.String name, boolean normalize)
Adds a number feature to the label set.- Parameters:
name
- the label namenormalize
- true to normalize the column- Returns:
- this builder
-
addCategoricalLabel
public T addCategoricalLabel(java.lang.String name)
Adds a categorical feature to the label set.- Parameters:
name
- the feature name- Returns:
- this builder
-
addCategoricalLabel
public T addCategoricalLabel(java.lang.String name, boolean onehotEncode)
Adds a categorical feature to the label set.- Parameters:
name
- the feature nameonehotEncode
- true if use onehot encode- Returns:
- this builder
-
addCategoricalLabel
public 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.- Parameters:
name
- the feature namemap
- a map contains categorical value maps to indexonehotEncode
- true if use onehot encode- Returns:
- this builder
-
noLabels
public T noLabels()
Indicates the dataset should not have any labels.- Returns:
- this builder
-
-