1
$\begingroup$

I have a dataset with features such as last_visit_n_days_ago, last_purchase_n_days_ago. These features are unavailable for many rows, which might have an important predictive value. The question is what to put in these cells if I want to use a learning algorithm that does not support missing values. My options are:

  • super large number (e.g. 1e38) to
  • the maximal number available for this database, plus some margin. What can be a good margin in this case
  • something else
$\endgroup$

1 Answer 1

0
$\begingroup$

It depends on the model you are going to use. If it is tree-based, a value outside the existing range will suffice. This will, however, not work for all models (e.g. linear regression)

Other approaches to consider:

  • Drop the rows with missing values (if there aren't too many)
  • Fill them with the mean/median/most_frequent value
  • Fill them using another model like KNN (sklearn or impyute), or even more advanced model.
$\endgroup$

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.