Class TabularDataset

  • All Implemented Interfaces:
    ai.djl.training.dataset.Dataset
    Direct Known Subclasses:
    CsvDataset

    public abstract class TabularDataset
    extends ai.djl.training.dataset.RandomAccessDataset
    A abstract class for creating tabular datasets.
    • Field Summary

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

        dataBatchifier, device, labelBatchifier, limit, pipeline, prefetchNumber, sampler, targetPipeline
    • Constructor Summary

      Constructors 
      Constructor Description
      TabularDataset​(TabularDataset.BaseBuilder<?> builder)
      Creates a new instance of RandomAccessDataset with the given necessary configurations.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      ai.djl.training.dataset.Record get​(ai.djl.ndarray.NDManager manager, long index)
      abstract java.lang.String getCell​(long rowIndex, java.lang.String featureName)
      Returns a cell in the dataset.
      java.util.List<Feature> getFeatures()
      Returns the dataset features.
      int getFeatureSize()
      Gets the feature size of current TabularDataset.
      java.util.List<Feature> getLabels()
      Returns the dataset labels.
      int getLabelSize()
      Gets the label size of current TabularDataset.
      ai.djl.ndarray.NDList getRowFeatures​(ai.djl.ndarray.NDManager manager, long index, java.util.List<Feature> selected)
      Returns the designated features (either data or label features) from a row.
      ai.djl.translate.TranslatorOptions matchingTranslatorOptions()
      protected void prepareFeaturizers()
      Prepares the PreparedFeaturizers.
      • Methods inherited from class ai.djl.training.dataset.RandomAccessDataset

        availableSize, getData, getData, getData, getData, newSubDataset, newSubDataset, randomSplit, size, subDataset, subDataset, subDataset, subDataset, toArray
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface ai.djl.training.dataset.Dataset

        prepare, prepare
    • Field Detail

      • features

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

        protected java.util.List<Feature> labels
    • Constructor Detail

      • TabularDataset

        public TabularDataset​(TabularDataset.BaseBuilder<?> builder)
        Creates a new instance of RandomAccessDataset with the given necessary configurations.
        Parameters:
        builder - a builder with the necessary configurations
    • Method Detail

      • getFeatureSize

        public int getFeatureSize()
        Gets the feature size of current TabularDataset.
        Returns:
        the feature size
      • getLabelSize

        public int getLabelSize()
        Gets the label size of current TabularDataset.
        Returns:
        the feature size
      • getFeatures

        public java.util.List<Feature> getFeatures()
        Returns the dataset features.
        Returns:
        the dataset features
      • getLabels

        public java.util.List<Feature> getLabels()
        Returns the dataset labels.
        Returns:
        the dataset labels
      • get

        public ai.djl.training.dataset.Record get​(ai.djl.ndarray.NDManager manager,
                                                  long index)
        Specified by:
        get in class ai.djl.training.dataset.RandomAccessDataset
      • getRowFeatures

        public ai.djl.ndarray.NDList getRowFeatures​(ai.djl.ndarray.NDManager manager,
                                                    long index,
                                                    java.util.List<Feature> selected)
        Returns the designated features (either data or label features) from a row.
        Parameters:
        manager - the manager used to create the arrays
        index - the index of the requested data item
        selected - the features to pull from the row
        Returns:
        the features formatted as an NDList
      • prepareFeaturizers

        protected void prepareFeaturizers()
        Prepares the PreparedFeaturizers.
      • getCell

        public abstract java.lang.String getCell​(long rowIndex,
                                                 java.lang.String featureName)
        Returns a cell in the dataset.
        Parameters:
        rowIndex - the row index or record index for the cell
        featureName - the feature or column of the cell
        Returns:
        the value of the cell at that row and column
      • matchingTranslatorOptions

        public ai.djl.translate.TranslatorOptions matchingTranslatorOptions()