Skip to content
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

add error and warning on new factor levels for prediction #2794

Merged
merged 4 commits into from
Oct 28, 2020

Conversation

jakob-r
Copy link
Sponsor Member

@jakob-r jakob-r commented Oct 26, 2020

General problem: New factor levels appeared during prediction.

Behaviour: fix.factors.prediction = TRUE will convert new factors to NAs

Concrete problem: There is no warning that this happens.

More concrete problem: Some learners (eg. ksvm) will just drop rows with NAs in prediction, leading to fewer predictions than in newdata. (#2771)

Less heavy problem: Some learners (eg. ranger) will complain about NAs, but the user does not now where these are comming from (#2611)

Solution: Create a warning, when NAs are created, throw an error if prediction has not the right number of items. Both in combination will hopefully give the user a clue of what is happening.

Also related: #2602

@pat-s
Copy link
Member

pat-s commented Oct 28, 2020

Thanks @jakob-r! Could you also add a descriptive NEWS entry for this?

@jakob-r
Copy link
Sponsor Member Author

jakob-r commented Oct 28, 2020

done.

Copy link
Member

@pat-s pat-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM.

@pat-s pat-s merged commit 7d2138f into master Oct 28, 2020
@pat-s pat-s deleted the fix2771__factor_na branch October 28, 2020 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants