[go: nahoru, domu]

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

categorical values represented as '?' are saved to arff file as missing values #114

Open
sebhrusen opened this issue Dec 4, 2020 · 1 comment

Comments

@sebhrusen
Copy link
sebhrusen commented Dec 4, 2020

Hi, I understand that this may look llike an expected behaviour but this can lead to unexpected results in the following scenario:

  • arff file with quoted question marks as categorical values and data: e.g. @attribute feat1 {'?', 'A', 'B', 'C'}
  • arff.load() reads those '?' as strings.
  • arff.write() (for example after sampling the original data) then writes the '?' from loaded data without quotes: @attribute feat1 {?, A, B, C}
  • arff.load() the last file interpretes ? as missing value (None).

see openml/automlbenchmark#209 for a hack implemented locally to prevent this, but this hack also means that it would not be possible anymore to represent missing values as ? in arff files saved with the library.

Suugesting to add a param to arff.dump signature, for example:

def dump(obj, fp, missing_values=[None, '?']):
    pass

allowing user to call arff.dump(o, f, missing_values=[None]) when ? should not be considered as a missing value, and therefore be quoted.

@jnothman
Copy link
Contributor

I don't see what's wrong with your fix by changing _RE_QUOTE_CHARS. I don't think it should stop missing values working, but I've not tested it.

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

No branches or pull requests

2 participants