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 booleanallowNoLabelsprotected java.util.List<Feature>featuresprotected java.util.List<Feature>labels
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaddCategoricalFeature(java.lang.String name)Adds a categorical feature to the feature set.TaddCategoricalFeature(java.lang.String name, boolean onehotEncode)Adds a categorical feature to the feature set.TaddCategoricalFeature(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.TaddCategoricalLabel(java.lang.String name)Adds a categorical feature to the label set.TaddCategoricalLabel(java.lang.String name, boolean onehotEncode)Adds a categorical feature to the label set.TaddCategoricalLabel(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.TaddFeature(Feature... features)Adds the features to the feature set.TaddLabel(Feature... labels)Adds the features to the label set.TaddNumericFeature(java.lang.String name)Adds a numeric feature to the feature set.TaddNumericFeature(java.lang.String name, boolean normalize)Adds a numeric feature to the feature set.TaddNumericLabel(java.lang.String name)Adds a number feature to the label set.TaddNumericLabel(java.lang.String name, boolean normalize)Adds a number feature to the label set.TnoLabels()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
-
-