Skip to content

Commit

Permalink
Histogram (#9)
Browse files Browse the repository at this point in the history
* Adding skeleton provided by jturner

* Added some IDE-related files

* Adding missing pieces - now it compiles

* Reusing code of from<Vec> in from<Array1>

* Fixed bugs, better method names, exported methods needed for doc tests.

* Reorganized code in a submodule

* Created Bins struct - split code between Bins and Edges

* Added get method to Bins

* Implemented IntoIterator for Edges

* Added doc tests for all methods of Edges

* Fixed typos

* All Bins' methods have been documented

* Fixed typo

* Better formulation in docs

* Fixed typo, better wording

* Added short docstring to BinNotFound

* Improved docstring for `get`

* HistogramExt trait has been added with a minimal signature

* Removed trait parameter D from HistogramExt trait signature

* Added docstrings to histogram method

* Implemented histogram method; renamed edges to bins in HistogramCounts constructor

* Exporting HistogramExt trait

* Added ndim field to HistogramCounts to implement dimensionality check in add_dimensions

* Improving docstring

* Added docstring to Bins::new

* Removed trailing white line at the end of the file

* Checked Edges::from methods

* Checked right-exclusiveness and left-inclusiveness

* Edges are now duplicates-free

* Removed ndim from the HistogramCounts struct; created a ndim method instead

* HistogramCounts renamed to Histogram

* Added comment to get explaining why it's not implemented using the Index trait for Bins

* Fixed docs

* Added docs to histogram submodule; exported HistogramExt as top level trait

* Revised docstring for HistogramExt

* Added quickcheck test for deduplication

* Added test for out of bounds access to bins using get

* Added as_view method to Histogram

* Added a doc_test to add_observation

* Bins and Edges are now clonable

* add_observation doctest is now green

* Added `grid` method to Histogram to access self.bins

* Added grid submodule to histogram submodule

* Added Grid struct

* Replaced bins with grid in Histogram

* Compilation is green

* Implement From<Vec<Bins<A>>> for Grid. Tests are green

* Implement From<Vec<Bins<A>>> for Grid. Tests are green

* grid.iter renamed to iter_projections

* grid.iter renamed to iter_projections

* index method added to Grid. Histogram.add_observation refactored to use it

* Improved docs

* Added Grid::shape and used it in Histogram constructor

* Panic is ensured by grid.index method

* Added get method to Grid

* Testing the whole histogram matrix in doctest, instead of a single entry

* Added docstring to Grid

* Added dosctring to Grid::ndim

* Added docstring to all method on Grid. Remove iter_projections

* Ignoring Grid sketches, they are not tests

* Added panics notice on Grid::get

* Re-indexed all docs from 0 instead of 1, for consistency with rust notation.

* Minor doc fixes

* Bugfix in matrixmultiply is now available in ndarray master branch

* Adding bins builders

* Brittle implementation of quantile_mut for 1d arrays

* Refactored FreedmanDiaconis implementation

* All important bin building strategies are covered

* Added signature for GridBuilder

* Implemented from_array for GridBuilder

* Implemented build for GridBuilder

* GridBuilder is exported as top level struct

* Explicitly require a view. Refactored builders to match it

* Added comment to clarify

* More docs for Grid

* Added docs to GridBuilder

* Added docs to GridBuilder's method

* Renamed BinsBuilder to BinsBuildingStrategy

* EquiSpaces is private

* Added docs to BinsBuildingStrategy

* Documented bin_width method

* Docs for all strategies

* Added detailed docs to all strategies using NumPy as base (almost verbatim)

* Renamed `builders` submodule to `strategies`

* Errors is not top-level in histogram

* Documented quantile_mut

* Added docs to QuantileExt1d

* Return false for failing tests in quickcheck

Co-Authored-By: LukeMathWalker <LukeMathWalker@users.noreply.github.com>

* Return false for failing tests in quickcheck

Co-Authored-By: LukeMathWalker <LukeMathWalker@users.noreply.github.com>

* rust,ignore => text

Co-Authored-By: LukeMathWalker <LukeMathWalker@users.noreply.github.com>

* rust,ignore => text

Co-Authored-By: LukeMathWalker <LukeMathWalker@users.noreply.github.com>

* Fixed typo

* Added mention of duplicates getting dropped

* Destructure a tuple in one go

* All methods in one impl block

* index => index_of; range => range_of

* indexes => indices_of

* Clearer inizialization

* Using reference instead of view

* Dervice Clone, Debug, Eq and PartialEq for all relevant structs

* Typo

* Omitting turbofish notation

* Better doc

* No need to use counters

* Omitting turbofish notation

* Using reference instead of view, index => index_of

* Avoids cloning

* Shortened imports

* Add note on ignoring points outside the grid

* Fix doctest

* Better formatting

* Better formatting

* Fix parenthesis

* Fixed docs

* get => index

* Better formatting

* Importing macro without macro_use

* Return option instead of Result from index_of

* get => index

* Simplified method body

* Simplified method body

* Simplified method body

* Silence compiler warning

* Using ? syntax

* Add Ok(())

* as_view => counts

* Fixed doc tests

* Bumped Rust version to 1.30

* Reuse quantile_axis_mut implementation

* Convert as_slice to as_array_view

* Fixed broken tests

* Added expected grid

* Fixed FD

* Fixed doctest

* Refactored bin strategies - one extra bin is now added to the right to make sure the maximum does not get dropped

* Added explanation for extra bin to the docs

* Using an associated type for BinsBuildingStrategy - reduced type parameters from 2 to 1

* Added panics conditions.

* Update src/quantile.rs

Co-Authored-By: LukeMathWalker <LukeMathWalker@users.noreply.github.com>

* Added test for panic condition

* For strategies, ask for a reference instead of a view

* Test panics for Sqrt

* Test Rice panics

* Test Sturges panics

* Test FreedmanDiaconis panics

* Tested Auto panics
  • Loading branch information
LukeMathWalker authored Nov 18, 2018
1 parent cee262a commit fcbe35a
Show file tree
Hide file tree
Showing 11 changed files with 1,410 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/target
**/*.rs.bk
Cargo.lock

# IDE-related
tags
rusty-tags.vi
.vscode
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ addons:
- libssl-dev
cache: cargo
rust:
- 1.28.0
- 1.30.0
- stable
- beta
- nightly
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ndarray = "0.12"
noisy_float = "0.1"
num-traits = "0.2"
rand = "0.5"
itertools = { version = "0.7.0", default-features = false }

[dev-dependencies]
quickcheck = "0.7"
Expand Down
Loading

0 comments on commit fcbe35a

Please sign in to comment.