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

Infinity as Edges for Binning #133

Merged
merged 73 commits into from
Jun 22, 2020
Merged

Infinity as Edges for Binning #133

merged 73 commits into from
Jun 22, 2020

Conversation

jeff-hernandez
Copy link
Collaborator

@jeff-hernandez jeff-hernandez commented May 5, 2020

This closes #114 by supporting infinite edges when binning labels.

Example

Create a label times object.

>>> data = [226.93, 47.95, 283.46, 31.54]
>>> lt = LabelTimes({'target': data})
>>> lt
    target
0  226.93
1   47.95
2  283.46
3   31.54

Bin values using infinite edges.

>>> lt.bin(['-inf', 100, 'inf'])
            target
0   (100.0, inf]
1  (-inf, 100.0]
2   (100.0, inf]
3  (-inf, 100.0]

@jeff-hernandez jeff-hernandez requested a review from rwedge May 26, 2020 20:30
@jeff-hernandez jeff-hernandez changed the title Include Lowest and Highest when Binning Infinity as Edges for Binning May 26, 2020
@jeff-hernandez jeff-hernandez changed the base branch from label_times_refactor to master June 17, 2020 17:49
@jeff-hernandez jeff-hernandez changed the base branch from master to label_times_refactor June 17, 2020 17:49
@jeff-hernandez jeff-hernandez changed the base branch from label_times_refactor to master June 17, 2020 19:55
Copy link
Contributor

@thehomebrewnerd thehomebrewnerd left a comment

Choose a reason for hiding this comment

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

In general this looks good. Might be good to add a test in the unit tests to cover passing "inf" and "-inf" strings as bin edges along with a test to confirm that the precision parameter works as expected.

@jeff-hernandez
Copy link
Collaborator Author

Thanks @thehomebrewnerd. The docstring examples are configured as doctests which are included as unit tests in pytest.

Copy link
Contributor

@rwedge rwedge left a comment

Choose a reason for hiding this comment

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

Looks good!

@jeff-hernandez jeff-hernandez merged commit f95e9d7 into master Jun 22, 2020
@jeff-hernandez jeff-hernandez deleted the bin_transform branch June 26, 2020 19:50
@jeff-hernandez jeff-hernandez mentioned this pull request Jul 2, 2020
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.

Include Lowest and Highest when Binning
3 participants