Class SimpleImputer
java.lang.Object
smile.feature.imputation.SimpleImputer
- All Implemented Interfaces:
Serializable, Function<Tuple,Tuple>, Transform
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApplies this transform to the given argument.static SimpleImputerFits the missing value imputation values.static SimpleImputerFits the missing value imputation values.static booleanhasMissing(Tuple x) Return true if the tuple x has missing values.static double[][]impute(double[][] data) Impute the missing values with column averages.toString()
-
Constructor Details
-
SimpleImputer
-
-
Method Details
-
hasMissing
Return true if the tuple x has missing values.- Parameters:
x- a tuple.- Returns:
- true if the tuple x has missing values.
-
apply
-
apply
-
toString
-
fit
Fits the missing value imputation values. Impute all the numeric columns with median, boolean/nominal columns with mode, and text columns with empty string.- Parameters:
data- the training data.columns- the columns to impute. If empty, impute all the applicable columns.- Returns:
- the imputer.
-
fit
Fits the missing value imputation values. Impute all the numeric columns with the mean of values in the range [lower, upper], boolean/nominal columns with mode, and text columns with empty string.- Parameters:
data- the training data.lower- the lower limit in terms of percentiles of the original distribution (e.g. 5th percentile).upper- the upper limit in terms of percentiles of the original distribution (e.g. 95th percentile).columns- the columns to impute. If empty, impute all the applicable columns.- Returns:
- the imputer.
-
impute
public static double[][] impute(double[][] data) Impute the missing values with column averages.- Parameters:
data- data with missing values.- Returns:
- the imputed data.
- Throws:
IllegalArgumentException- when the whole row or column is missing.
-