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 a TabularDataset.
  • Field Details

    • features

      protected List<Feature> features
    • labels

      protected List<Feature> labels
    • allowNoLabels

      protected boolean allowNoLabels
  • Constructor Details

    • BaseBuilder

      protected BaseBuilder()
  • Method Details

    • addFeature

      public T addFeature(Feature... features)
      Adds the features to the feature set.
      Parameters:
      features - the features
      Returns:
      this builder
    • addNumericFeature

      public T addNumericFeature(String name)
      Adds a numeric feature to the feature set.
      Parameters:
      name - the feature name
      Returns:
      this builder
    • addNumericFeature

      public T addNumericFeature(String name, boolean normalize)
      Adds a numeric feature to the feature set.
      Parameters:
      name - the feature name
      normalize - true to normalize the column
      Returns:
      this builder
    • addCategoricalFeature

      public T addCategoricalFeature(String name)
      Adds a categorical feature to the feature set.
      Parameters:
      name - the feature name
      Returns:
      this builder
    • addCategoricalFeature

      public T addCategoricalFeature(String name, boolean onehotEncode)
      Adds a categorical feature to the feature set.
      Parameters:
      name - the feature name
      onehotEncode - true to use onehot encode
      Returns:
      this builder
    • addCategoricalFeature

      public T addCategoricalFeature(String name, Map<String,Integer> map, boolean onehotEncode)
      Adds a categorical feature to the feature set with specified mapping.
      Parameters:
      name - the feature name
      map - a map contains categorical value maps to index
      onehotEncode - 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(String name)
      Adds a number feature to the label set.
      Parameters:
      name - the label name
      Returns:
      this builder
    • addNumericLabel

      public T addNumericLabel(String name, boolean normalize)
      Adds a number feature to the label set.
      Parameters:
      name - the label name
      normalize - true to normalize the column
      Returns:
      this builder
    • addCategoricalLabel

      public T addCategoricalLabel(String name)
      Adds a categorical feature to the label set.
      Parameters:
      name - the feature name
      Returns:
      this builder
    • addCategoricalLabel

      public T addCategoricalLabel(String name, boolean onehotEncode)
      Adds a categorical feature to the label set.
      Parameters:
      name - the feature name
      onehotEncode - true if use onehot encode
      Returns:
      this builder
    • addCategoricalLabel

      public T addCategoricalLabel(String name, Map<String,Integer> map, boolean onehotEncode)
      Adds a categorical feature to the feature set with specified mapping.
      Parameters:
      name - the feature name
      map - a map contains categorical value maps to index
      onehotEncode - true if use onehot encode
      Returns:
      this builder
    • noLabels

      public T noLabels()
      Indicates the dataset should not have any labels.
      Returns:
      this builder