Skip to content

Commit fcbe35a

Browse files
Histogram (#9)
* 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 <[email protected]> * Return false for failing tests in quickcheck Co-Authored-By: LukeMathWalker <[email protected]> * rust,ignore => text Co-Authored-By: LukeMathWalker <[email protected]> * rust,ignore => text Co-Authored-By: LukeMathWalker <[email protected]> * 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 <[email protected]> * 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
1 parent cee262a commit fcbe35a

File tree

11 files changed

+1410
-4
lines changed

11 files changed

+1410
-4
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
/target
22
**/*.rs.bk
33
Cargo.lock
4+
5+
# IDE-related
6+
tags
7+
rusty-tags.vi
8+
.vscode

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ addons:
77
- libssl-dev
88
cache: cargo
99
rust:
10-
- 1.28.0
10+
- 1.30.0
1111
- stable
1212
- beta
1313
- nightly

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ndarray = "0.12"
88
noisy_float = "0.1"
99
num-traits = "0.2"
1010
rand = "0.5"
11+
itertools = { version = "0.7.0", default-features = false }
1112

1213
[dev-dependencies]
1314
quickcheck = "0.7"

0 commit comments

Comments
 (0)