Class DensityTransform

java.lang.Object
smile.plot.vega.DensityTransform

public class DensityTransform extends Object
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 Details Link icon

    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • toPrettyString Link icon

      public String toPrettyString()
      Returns the specification in pretty print.
      Returns:
      the specification in pretty print.
    • cumulative Link icon

      public DensityTransform cumulative(boolean flag)
      Produces density estimates or cumulative density estimates.
      Parameters:
      flag - If true, produce cumulative density estimates. Otherwise, density estimates.
      Returns:
      this object.
    • counts Link icon

      public DensityTransform counts(boolean flag)
      Produces probability estimates or smoothed counts.
      Parameters:
      flag - If true, produce smoothed counts. Otherwise, probability estimates.
      Returns:
      this object.
    • bandwidth Link icon

      public DensityTransform bandwidth(double width)
      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 Link icon

      public DensityTransform extent(double min, double max)
      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 Link icon

      public DensityTransform minSteps(int steps)
      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 Link icon

      public DensityTransform maxSteps(int steps)
      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 Link icon

      public DensityTransform steps(int 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 Link icon

      public DensityTransform as(String... fields)
      Sets the output fields for the sample value and corresponding density estimate.
      Parameters:
      fields - the output fields.
      Returns:
      this object.