问题
in Weka there is a filter called "ReplaceMissingValues" that permit to replace all missing values in a dataset using the mean of each attribute. I'd like to replace missing values, for a certain attribute, using the mean of values that belong to a certain class. For example in a binary dataset I think that is more correct to replace a missing value for an attribute in record that belong to the positive class using the mean calculated with only the records that belong to the positive class. So how is possible to realized it? How can we replace values only for record that belong to a certain class?
回答1:
If you want to replace missing values of Class A by taking the mean calculated from the training instances of that particular class A, then you are "bias"ing your dataset. To avoid bias (which eventually will overfit your trained model), it is wise to use the default "replace missing values" function- i.e., to consider mean and mode of all training instances rather than of just that particular class.
来源:https://stackoverflow.com/questions/10269884/replace-missing-values-with-mean-weka