Package smile.plot.vega
Class ImputeTransform
java.lang.Object
smile.plot.vega.ImputeTransform
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 Summary
Modifier and TypeMethodDescriptionSets the frame to control the window over which the specified method is applied.Sets the data fields by which to group the values.keyvals
(double[] values) Sets the key values that should be considered for imputation.keyvals
(double start, double stop, double step) Sets the sequence of key values that should be considered for imputation.Sets the imputation method to use for the field value of imputed data objects.Returns the specification in pretty print.toString()
value
(com.fasterxml.jackson.databind.JsonNode value) Sets the field value to use when the imputation method is "value".
-
Method Details
-
toString
-
toPrettyString
Returns the specification in pretty print.- Returns:
- the specification in pretty print.
-
keyvals
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
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
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
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
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
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.
-