fixunknowns
Process data by marking rows with unknown values
Syntax
[y,ps] = fixunknowns(X)
[y,ps] = fixunknowns(X,FP)
Y = fixunknowns('apply',X,PS)
X = fixunknowns('reverse',Y,PS)
name = fixunknowns('name')
fp = fixunknowns('pdefaults')
pd = fixunknowns('pdesc')
fixunknowns('pcheck',fp)
Description
fixunknowns
processes matrices by replacing each row containing unknown
values (represented by NaN
) with two rows of information.
The first row contains the original row, with NaN
values replaced by the
row’s mean. The second row contains 1 and 0 values, indicating which values in the first row
were known or unknown, respectively.
[y,ps] = fixunknowns(X)
takes these inputs,
X |
|
and returns
Y |
|
PS | Process settings that allow consistent processing of values |
[y,ps] = fixunknowns(X,FP)
takes an empty struct FP
of parameters.
Y = fixunknowns('apply',X,PS)
returns Y
, given
X
and settings PS
.
X = fixunknowns('reverse',Y,PS)
returns X
, given
Y
and settings PS
.
name = fixunknowns('name')
returns the name of this process
method.
fp = fixunknowns('pdefaults')
returns the default process parameter
structure.
pd = fixunknowns('pdesc')
returns the process parameter
descriptions.
fixunknowns('pcheck',fp)
throws an error if any parameter is
illegal.
Examples
Here is how to format a matrix with a mixture of known and unknown values in its second row:
x1 = [1 2 3 4; 4 NaN 6 5; NaN 2 3 NaN] [y1,ps] = fixunknowns(x1)
Next, apply the same processing settings to new values:
x2 = [4 5 3 2; NaN 9 NaN 2; 4 9 5 2] y2 = fixunknowns('apply',x2,ps)
Reverse the processing of y1
to get x1
again.
x1_again = fixunknowns('reverse',y1,ps)
More About
Version History
Introduced in R2006a