Class ImputeTransform

java.lang.Object
smile.plot.vega.ImputeTransform

public class ImputeTransform extends Object
The impute transform groups data and determines missing values of the key field within each group. For each missing value in each group, the impute transform will produce a new tuple with the imputed field generated based on a specified imputation method (by using a constant value or by calculating statistics such as mean within each group).
  • Method Details

    • toString

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

      public String toPrettyString()
      Returns the specification in pretty print.
      Returns:
      the specification in pretty print.
    • keyvals

      public ImputeTransform keyvals(double[] values)
      Sets the key values that should be considered for imputation.
      Parameters:
      values - the key values that should be considered for imputation.
      Returns:
      this object.
    • keyvals

      public ImputeTransform keyvals(double start, double stop, double step)
      Sets the sequence of key values that should be considered for imputation.
      Parameters:
      start - The starting value of the sequence.
      stop - The ending value(exclusive) of the sequence.
      step - The step value between sequence entries.
      Returns:
      this object.
    • groupby

      public ImputeTransform groupby(String... fields)
      Sets the data fields by which to group the values. Imputation will then be performed on a per-group basis.
      Parameters:
      fields - the data fields by which to group the values. Imputation will then be performed on a per-group basis.
      Returns:
      this object.
    • frame

      public ImputeTransform frame(Integer first, Integer last)
      Sets the frame to control the window over which the specified method is applied. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. For example, the value [-5, 5] indicates that the window should include five objects preceding and five objects following the current object.

      Default value [null, null] indicating that the window includes all objects.

      Parameters:
      first - the offset of the first object in the sliding window.
      last - the offset of the first object in the sliding window.
      Returns:
      this object.
    • method

      public ImputeTransform method(String method)
      Sets the imputation method to use for the field value of imputed data objects.
      Parameters:
      method - "value", "mean", "median", "max" or "min".
      Returns:
      this object.
    • value

      public ImputeTransform value(com.fasterxml.jackson.databind.JsonNode value)
      Sets the field value to use when the imputation method is "value".
      Parameters:
      value - the field value to use when the imputation method is "value".
      Returns:
      this object.