Histogram by LukeMathWalker · Pull Request #8 · rust-ndarray/ndarray-stats · GitHub
Skip to content

Histogram#8

Closed
LukeMathWalker wants to merge 72 commits into
rust-ndarray:masterfrom
LukeMathWalker:histogram
Closed

Histogram#8
LukeMathWalker wants to merge 72 commits into
rust-ndarray:masterfrom
LukeMathWalker:histogram

Conversation

@LukeMathWalker

Copy link
Copy Markdown
Member

It took me a while, but I managed to pull together a good candidate for histogram-related functionalities (histogram, histogram2d and histogramdd in Numpy).

Bins are formalized in their own submodule, bins:

  • Bin1d, basic building block, reuses Range* structs from the standard library;
  • Bins1d, collection of Bin1d;
  • BinNd, n-dimensional bin. It supports any region in an n-dimensional space that can be expressed as a product of intervals;
  • BinsNd, collection of n-dimensional bins.

With BinsNd we can express collections of bins that are more general than the ones supported by NumPy.

Two top-level traits are provided to implement an histogram method, for ArrayBase and one-dimensional ArrayBase. Right now the computational complexity is the same, apart from a slightly different API (point being ArrayBase<Data<Elem=T>> or a &T, but I plan to enhance Bin1d::contains to enable an implementation of Bins1d::find that uses binary search. This will probably require to enforce non-overlapping bins at creation time for Bins1d.

I am now going to implement all the different string options for bins in np.histogram_bin_edges as builders, but I wanted to get the PR out to get your feedback on the direction @jturner314

@jturner314

Copy link
Copy Markdown
Member

@LukeMathWalker

Copy link
Copy Markdown
Member Author

@LukeMathWalker LukeMathWalker deleted the histogram branch November 18, 2018 16:57
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.

2 participants