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

[ML] Distinguish missing and empty categorical values #1034

Merged
merged 6 commits into from
Mar 4, 2020

Conversation

tveasey
Copy link
Contributor

@tveasey tveasey commented Mar 3, 2020

Currently, it is impossible to distinguish missing categorical fields and fields whose values are the empty string (the exchange format between C++ and Java doesn't support optional strings). This can cause issues for inference, which does understand the difference. Also, since these could be semantically different we would ideally distinguish them from the standpoint of training.

This change introduces a custom string to denote a missing value. By default this is the \0 character, but is configurable. This will also allow us to clean up the handling of the missing target category for test data passed to classification, but I've left TODOs until the Java has been updated or we'll break integration tests.

I also found myself needing to introduce another parameter to CDataFrameAnalysisSpecificationFactory. I've taken the opportunity to introduce setters for the various parameters since the many optional parameters were becoming unsustainable.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

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

LGTM

@droberts195
Copy link
Contributor

It seems that the test of numeric missing field value is actually causing a fatal error that stops the test suite:

FATAL CLogger.cc@385 Input error: you can't use a number (0) to denote a missing field value.

So that test needs to replace the fatal error handler.

But I’m happy to merge as soon as the CI passes.

…t I don't

want to change this behaviour in this PR. Also, fix some formatting broken when
we were first experimenting with auto formatting.
@tveasey
Copy link
Contributor Author

tveasey commented Mar 4, 2020

It turns out the \0 is converted to zero by our stringToType method. It checks and returns false if the std::string is empty. It feels to me like this should instead check the c_str length. However, this is a slightly risky change and not needed for this PR, so I just added special case handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants