Documentation of 'jsat.datatransform.NumericalToHistogram' Java class
NumericalToHistogram
jsat.datatransform

Class NumericalToHistogram

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, DataTransform


    public class NumericalToHistogram
    extends java.lang.Object
    implements DataTransform
    This transform converts numerical features into categorical ones via a simple histogram. Bins will be created for each numeric feature of equal sizes. Each numeric feature will be converted to the same number of bins.
    This transform will handle missing values by simply ignoring them, and leaving the value missing in the transformed categorical variable.
    See Also:
    Serialized Form
    • Constructor Detail

      • NumericalToHistogram

        public NumericalToHistogram()
        Creates a new transform which will use at most 25 bins when converting numeric features. This may not be optimal for any given dataset
      • NumericalToHistogram

        public NumericalToHistogram(DataSet dataSet)
        Creates a new transform which will use O(sqrt(n)) bins for each numeric feature, where n is the number of data points in the dataset.
        Parameters:
        dataSet - the data set to create the transform from
      • NumericalToHistogram

        public NumericalToHistogram(int n)
        Creates a new transform which will use at most the specified number of bins
        Parameters:
        n - the number of bins to create
      • NumericalToHistogram

        public NumericalToHistogram(DataSet dataSet,
                                    int n)
        Creates a new transform which will use the specified number of bins for each numeric feature.
        Parameters:
        dataSet - the data set to create the transform from
        n - the number of bins to create
    • Method Detail

      • fit

        public void fit(DataSet dataSet)
        Description copied from interface: DataTransform
        Fits this transform to the given dataset. Some transforms can only be learned from classification or regression datasets. If an incompatible dataset type is given, a FailedToFitException exception may be thrown.
        Specified by:
        fit in interface DataTransform
        Parameters:
        dataSet - the dataset to fir this transform to
      • setNumberOfBins

        public void setNumberOfBins(int n)
        Sets the maximum number of histogram bins to use when creating the categorical version of numeric features.
        Parameters:
        n - the number of bins to create
      • getNumberOfBins

        public int getNumberOfBins()
        Returns:
        the maximum number of bins to create
      • guessNumberOfBins

        public static Distribution guessNumberOfBins(DataSet data)
        Attempts to guess the number of bins to use
        Parameters:
        data - the dataset to be transforms
        Returns:
        a distribution of the guess
      • transform

        public DataPoint transform(DataPoint dp)
        Description copied from interface: DataTransform
        Returns a new data point that is a transformation of the original data point. This new data point is a different object, but may contain the same references as the original data point. It is not guaranteed that you can mutate the transformed point without having a side effect on the original point.
        Specified by:
        transform in interface DataTransform
        Parameters:
        dp - the data point to apply a transformation to
        Returns:
        a transformed data point

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.