I am using sklearn.tree.ExtraTreeClassifier. It does not handle missing value in training data. All tree-based algorithms handle missing value internally. So, is there anything exceptional ExtraTreeClassifier algorithm or it is just that sklearn has not implemented handling missing values in ExtraTreeClassifier ?

ValueError: Input contains NaN, infinity or a value too large for dtype('float32')
  • 2
    $\begingroup$ ExtraTreeClassifier isn't the only one. Most of the sklearn classifiers I'm familiar with do not automatically "handle" missing data. You can add an imputation step to your pipeline using one of the included transformers in the sklearn.impute module or try a different package such as xgboost. $\endgroup$ – AffableAmbler Apr 23 at 19:15
  • $\begingroup$ Missing values sometime give cue about data and domain. Try to handle yourself and usjng proper reasoning. I mean, don't simply use mean or median l. Try to know why it is NaN. It's OK if your are just doing to learn modelling. Your Intuition is correct, SKlearn expect values in numeric form. $\endgroup$ – 10xAI Apr 24 at 5:12

Your Answer

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

Browse other questions tagged or ask your own question.