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

Histogram enhancements #2812

Merged
merged 4 commits into from
Jun 22, 2018
Merged

Histogram enhancements #2812

merged 4 commits into from
Jun 22, 2018

Conversation

philippjfr
Copy link
Member

Various enhancements for the histogram operation:

  • Remove individually parameter which didn't do anything
  • Added cumulative parameter to compute cumulative histogram (Feature request: cumulative hist #2811)
  • Added option to pass in explicit list/array of bins
  • Adds unit tests

@philippjfr philippjfr added the type: enhancement Minor feature or improvement to an existing feature label Jun 19, 2018
@@ -486,6 +486,12 @@ class histogram(Operation):
bin_range = param.NumericTuple(default=None, length=2, doc="""
Specifies the range within which to compute the bins.""")

bins = param.ClassSelector(default=None, class_=(np.ndarray, list), doc="""
Copy link
Contributor

Choose a reason for hiding this comment

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

What about tuples or pandas series? Do we want to support lots of different types or force a single type?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd be okay adding tuples I suppose, although that doesn't seem particularly common.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should use a known set of types for 'list-like' types. Could you open an issue about this? Doesn't need to be fixed in this PR.

Copy link
Member Author

@philippjfr philippjfr Jun 20, 2018

Choose a reason for hiding this comment

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

After considering this I'm not sure this makes sense tbh. It's simply too dependent on the particular use case. In many cases ndarray and lists might be used interchangeably but often supporting arrays doesn't really make sense. Then there's lists and tuples, which again can be used interchangeably in some cases but are treated completely differently in others.

I've now added tuples here, but I don't think that generalizes in any real sense.

Copy link
Member

Choose a reason for hiding this comment

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

You're not sure it makes sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

My (not particularly strongly held) opinion is that it should only support lists: ndarray depends on numpy (not a built-in) and as Philipp points out we have cases where we treat tuples and lists differently. For parameters we would often enforce lists with param.List instead of a class selector which is what would have probably made more sense here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Anyway, this is a minor point which we can decide on later and fix in a subsequent PR if we want to. I'll go ahead and merge.

@jlstevens
Copy link
Contributor

Made one comment. Otherwise looks good.

@philippjfr philippjfr force-pushed the histogram_enhancements branch from 0edd7aa to 8b870d5 Compare June 20, 2018 18:24
@jlstevens
Copy link
Contributor

Looks good. Merging.

@jlstevens jlstevens merged commit eda6350 into master Jun 22, 2018
@philippjfr philippjfr deleted the histogram_enhancements branch July 4, 2018 11:13
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants