Class TabularDataset.BaseBuilder<T extends 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 Summary

      Fields 
      Modifier and Type Field Description
      protected boolean allowNoLabels  
      protected java.util.List<Feature> features  
      protected java.util.List<Feature> labels  
      • Fields inherited from class ai.djl.training.dataset.RandomAccessDataset.BaseBuilder

        dataBatchifier, device, labelBatchifier, limit, pipeline, prefetchNumber, sampler, targetPipeline
    • 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.
      • Methods inherited from class ai.djl.training.dataset.RandomAccessDataset.BaseBuilder

        addTargetTransform, addTransform, getSampler, optDataBatchifier, optDevice, optLabelBatchifier, optLimit, optPipeline, optPrefetchNumber, optTargetPipeline, self, setSampling, setSampling, setSampling
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • features

        protected java.util.List<Feature> features
      • labels

        protected java.util.List<Feature> labels
      • allowNoLabels

        protected boolean allowNoLabels
    • Constructor Detail

      • BaseBuilder

        protected BaseBuilder()
    • 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 name
        normalize - 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 name
        onehotEncode - 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 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​(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 name
        normalize - 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 name
        onehotEncode - 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 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