1
$\begingroup$

I have a dataset which contains few variables whose values do not change. Some of the variables are non-numeric (for example all values for that variable contain the value 5) and few variables are real-valued but all same values. When doing standardization of the variables so that each is a zero mean and variance 1, these variables give NaN values. Therefore, is it ok to exclude such variables (irrespective of being categorical or real-valued) that contain constant values from the normalization/standardization step? These variables are important as features hence I cannot delete them. Is there any other way to handle such variables?

$\endgroup$
3
  • $\begingroup$ "These variables are important as features" -> the fact that a feature has a constant value is not compatible with this feature being important for the task. This can be tested by removing the feature or changing its constant value: the model will predict exactly the same result. $\endgroup$
    – Erwan
    Sep 13, 2020 at 10:44
  • $\begingroup$ Thank you for your comment and the answer. So you suggest that I should exclude such variables from the input? $\endgroup$
    – Sm1
    Sep 13, 2020 at 14:40
  • $\begingroup$ Yes I think so. $\endgroup$
    – Erwan
    Sep 13, 2020 at 15:06

1 Answer 1

1
$\begingroup$

By definition, if these columns or features contain a constant value and yet the output variables change, then they are not influencing the output and likely can be ignored.

A more formal test is to determine how much of the variance between a model that uses that feature is attributable to that feature.

A simple example to illustrate this principle is to look up examples of PCA. In those examples, the technique tries and identifies feature that drive the most variance.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.