1
$\begingroup$

My data set has:

  • 20 categorical nominal predictor variables, each variable has on average 5 distinct possible values
  • 1 dependent binary class variable to be predicted by the Naive Bayes classifier
  • 8000 rows/observations

For one specific categorical nominal predictor variable about half (4000) of the rows/observations have a null/missing/NA value. I will refer to these as NA values.

Is it valid to include the NA values in the training of the classifier model? If I omit all rows/observations which have a NA value in that single variable I will lose half my training data. If I omit that single variable from all rows/observations I will lose some useful training information.

Intuitively to me it appears valid to include the NA values, but I am unable to implement a model in R using caret that includes the NA values, so I was wondering if theoretically it is incorrect.

$\endgroup$

2 Answers 2

2
$\begingroup$

Being able to Implement the code does not necessarily indicate that the strategy is ideal though! From what I understood your problem, there can be 2 different approaches. You will have to experiment with the performance of the model on the test dataset to choose the right one.

A. Replace the null values with the not null mode of the corresponding columns B. Replace them with 'other' category to accommodate missing-not-at-random concept!

Both methods are equally useful depending on the nature of the input data. I will not recommend dropping rows or columns unless you have a reason to believe that they will disturb the modeling to a large extent!

$\endgroup$
2
  • $\begingroup$ Thanks for your answer. I am not clear on the 2 options. For option A, are you suggesting I find the categorical value which appears most in the variable/column that contains the nulls, i.e. the mode, and replace all the nulls with that mode? For option B, are you suggesting replacing the N/A with some string value such as "unknown" instead of Nulls? $\endgroup$
    – MattG
    Nov 10, 2020 at 16:29
  • $\begingroup$ You got both of them correct! Option B considers the null values as a new category and builds the model accordingly. But it's prone to overfitting as the test records with null values might get biased predictions. Option A is better if the number of missing values is on the lower end $\endgroup$
    – Arighna
    Nov 10, 2020 at 19:41
1
$\begingroup$

you can either use mode imputation method or KNN imputation method to handle missing data.

omitting NAs is not a good solution at all.

$\endgroup$
1
  • $\begingroup$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Oct 18, 2021 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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