Package smile.plot.vega
Class DensityTransform
java.lang.Object
smile.plot.vega.DensityTransform
The density transform performs one-dimensional kernel density estimation
over an input data stream and generates a new data stream of samples of
the estimated densities.
-
Method Summary
Modifier and TypeMethodDescriptionSets the output fields for the sample value and corresponding density estimate.bandwidth
(double width) Sets the bandwidth (standard deviation) of the Gaussian kernel.counts
(boolean flag) Produces probability estimates or smoothed counts.cumulative
(boolean flag) Produces density estimates or cumulative density estimates.extent
(double min, double max) Sets a [min, max] domain from which to sample the distribution.maxSteps
(int steps) Sets the maximum number of samples to take along the extent domain for plotting the density.minSteps
(int steps) Sets the minimum number of samples to take along the extent domain for plotting the density.steps
(int steps) Sets the exact number of samples to take along the extent domain for plotting the density.Returns the specification in pretty print.toString()
-
Method Details
-
toString
-
toPrettyString
Returns the specification in pretty print.- Returns:
- the specification in pretty print.
-
cumulative
Produces density estimates or cumulative density estimates.- Parameters:
flag
- If true, produce cumulative density estimates. Otherwise, density estimates.- Returns:
- this object.
-
counts
Produces probability estimates or smoothed counts.- Parameters:
flag
- If true, produce smoothed counts. Otherwise, probability estimates.- Returns:
- this object.
-
bandwidth
Sets the bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott's rule.- Parameters:
width
- the bandwidth (standard deviation) of the Gaussian kernel.- Returns:
- this object.
-
extent
Sets a [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field.- Parameters:
min
- the minimum value of the density value field.max
- the maximum value of the density value field.- Returns:
- this object.
-
minSteps
Sets the minimum number of samples to take along the extent domain for plotting the density.- Parameters:
steps
- the minimum number of samples to take.- Returns:
- this object.
-
maxSteps
Sets the maximum number of samples to take along the extent domain for plotting the density.- Parameters:
steps
- the maximum number of samples to take.- Returns:
- this object.
-
steps
Sets the exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities.- Parameters:
steps
- the exact number of samples to take.- Returns:
- this object.
-
as
Sets the output fields for the sample value and corresponding density estimate.- Parameters:
fields
- the output fields.- Returns:
- this object.
-