impute
Fills the missing values in the dataset with one of the following strategies (see Inputs section).
Syntax
[imputed_data, parameters] = impute(X)
[imputed_data, parameters] = impute(X, options)
Inputs
- X
- Input data to be imputed.
- options
- Type: struct
Outputs
- imputed_data
- Imputed input records.
- parameters
- Struct containing values required by imputeTransform function used on test data.
Example
Usage of impute
X = [1 2 3;
NaN 3 3;
7 6 2;
8 NaN NaN];
[X_scaled, parameters] = impute(X); %by default strategy is 'mean';
> X_scaled
X_scaled = [Matrix] 4 x 3
1.00000 2.00000 3.00000
5.33333 3.00000 3.00000
7.00000 6.00000 2.00000
8.00000 3.66667 2.66667
> parameters
parameters = struct [
cols: [Matrix] 0 x 0
constant: 0
fillers: [Matrix] 1 x 3
5.33333 3.66667 2.66667
strategy: mean
]
Comments
Output 'parameters' can be used by imputetransform function.