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

fix to support int labels #219

Merged
merged 8 commits into from
Dec 5, 2014
Merged

Conversation

mheilman
Copy link
Contributor

@mheilman mheilman commented Dec 5, 2014

Integer labels get converted to numpy.int64 objects when the input is read in, and these can't be JSON-serialized. This causes run_experiment to fail when trying to write JSON results files---specifically, the descriptive statistics about the training data.

I adapted this solution for a related problem:
http://stackoverflow.com/questions/11561932/why-does-json-dumpslistnp-arange5-fail-while-json-dumpsnp-arange5-tolis

Check out this craziness:

ipdb> json.dumps(np.float64(4.0))
'4.0'
ipdb> json.dumps(np.int64(4))
*** TypeError: 4 is not JSON serializable
ipdb> 

@mheilman mheilman added the bug label Dec 5, 2014
mheilman and others added 3 commits December 5, 2014 10:42
- Remove accidental use of `test_directory` for a feature file.
- Update name of results file.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.11%) when pulling 963531f on feature/numpy_int64_label_fix into ef8ff57 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.11%) when pulling 551c201 on feature/numpy_int64_label_fix into ef8ff57 on master.

task=cross_validate

[Input]
featuresets=[["test_int_labels_cv"]]
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're using train_file, you shouldn't use featuresets. In fact, I thought we had it set so that it would raise an exception if you tried to use both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, I forgot to take that out

@coveralls
Copy link

Coverage Status

Coverage increased (+0.11%) when pulling 45ac49a on feature/numpy_int64_label_fix into ef8ff57 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.11%) when pulling 45ac49a on feature/numpy_int64_label_fix into ef8ff57 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.11%) when pulling 45ac49a on feature/numpy_int64_label_fix into ef8ff57 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.11%) when pulling 45ac49a on feature/numpy_int64_label_fix into ef8ff57 on master.

@dan-blanchard
Copy link
Contributor

Thanks for catching this!

dan-blanchard added a commit that referenced this pull request Dec 5, 2014
…int64_label_fix

fix to support int labels
@dan-blanchard dan-blanchard merged commit f5fcfae into master Dec 5, 2014
@dan-blanchard dan-blanchard deleted the feature/numpy_int64_label_fix branch December 5, 2014 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants