public class NumericalToHistogram extends Object implements DataTransform
Constructor and Description |
---|
NumericalToHistogram()
Creates a new transform which will use at most 25 bins when converting
numeric features.
|
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.
|
NumericalToHistogram(DataSet dataSet,
int n)
Creates a new transform which will use the specified number of bins for
each numeric feature.
|
NumericalToHistogram(int n)
Creates a new transform which will use at most the specified number of bins
|
Modifier and Type | Method and Description |
---|---|
NumericalToHistogram |
clone() |
void |
fit(DataSet dataSet)
Fits this transform to the given dataset.
|
int |
getNumberOfBins() |
static Distribution |
guessNumberOfBins(DataSet data)
Attempts to guess the number of bins to use
|
void |
setNumberOfBins(int n)
Sets the maximum number of histogram bins to use when creating the categorical version of numeric features.
|
DataPoint |
transform(DataPoint dp)
Returns a new data point that is a transformation of the original data
point.
|
public NumericalToHistogram()
public NumericalToHistogram(DataSet dataSet)
dataSet
- the data set to create the transform frompublic NumericalToHistogram(int n)
n
- the number of bins to createpublic NumericalToHistogram(DataSet dataSet, int n)
dataSet
- the data set to create the transform fromn
- the number of bins to createpublic void fit(DataSet dataSet)
DataTransform
FailedToFitException
exception may be
thrown.fit
in interface DataTransform
dataSet
- the dataset to fir this transform topublic void setNumberOfBins(int n)
n
- the number of bins to createpublic int getNumberOfBins()
public static Distribution guessNumberOfBins(DataSet data)
data
- the dataset to be transformspublic DataPoint transform(DataPoint dp)
DataTransform
transform
in interface DataTransform
dp
- the data point to apply a transformation topublic NumericalToHistogram clone()
clone
in interface DataTransform
clone
in class Object
Copyright © 2017. All rights reserved.