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

more checks for inconsistent feature names #47

Merged
merged 2 commits into from
Apr 2, 2021

Conversation

WillForan
Copy link
Contributor

@WillForan WillForan commented Dec 11, 2020

I may have totally misunderstood the structure of add_samplet.
It looks like _data was modified before feature_names was checked which lead to #45 . I pulled the checks out and into _check_feature_names and also pushed a ValueError for feature dim mismatch into _check_features (to fix the tests I broke).

I think the same mismatch issue might exist for attrs. But I didn't want to work on that yet -- in case I totally missed the point.

I added two tests that check for a new exception type InvalidFeatureNamesException. But reviewing it now, those should maybe be ValueError to be consistent with the other add_samplet errors (?)

As part of the tests, I created a decorator forall_dataset_types to avoid putting a for loop around each test. I'm not sure if that will make debugging the tests harder. (They made writing them marginally easier)

Happy to revise if I'm not way off base. But feel free to cherry pick if any of it could be useful too.

Currently throws out anything that doesn't exactly match previous
feature names. A better solution might be to reorder features if
features_names are out of order. Also could make np.nan in features if
feature_names are missing
Accidentally removed the check. Instead of putting back into
add_samplet, moved the code into _check_features. DRYs up the check in
__setitem__
@WillForan WillForan changed the title more checks for inconsitant feature names more checks for inconsistent feature names Dec 11, 2020
@raamana
Copy link
Owner

raamana commented Dec 13, 2020

Thanks a lot Will for this PR - let me take a look

@raamana raamana merged commit fbbf2ff into raamana:master Apr 2, 2021
@raamana
Copy link
Owner

raamana commented Apr 2, 2021

Sorry for the delay in reviewing @WillForan! Thanks very much for this useful PR.

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