-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Random Forest Prediction and np.nan #19767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Random forests don't support nans, in fit or in predict. Is this a feature request or a bug report? The HistGradientBoosting esitmators are the only ones to natively support nans (I think). You'll need impute the data if you want to use RFs. The error message you get is strange. How did you fit the estimator? You should get something like
|
X is expected to be I am closing this issue because it looks like a duplicate. |
@MQSchleich Feel free to comment in case that we missed something in your original, in which case we would reopen this issue. |
Honestly, I was just reproducing a case without giving you the whole code base. The bug occurred when getting input from a data frame after converting it to a list, having 1 np.nan value. However, it is not bad at all that the forest throws an error. Only the message was so confusing, I needed some time to figure out what was going on. Therefore, I suggest it is actually better to not throw an error but continue processing and to throw a warning. |
Describe the bug
When running my processing workflow on a "dirty" dataset containing np.nan values the algorithm does not handle the case.
Steps/Code to Reproduce
Example:
Expected Results
No error is thrown, or at least a warning that there is a np.nan value there.
Actual Results
Versions
The text was updated successfully, but these errors were encountered: