-
Notifications
You must be signed in to change notification settings - Fork 20
[routine][statistics] Update the statistics module + add returned_dtype + unify functions
#200
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
Merged
MadAlex1997
merged 15 commits into
Mojo-Numerics-and-Algorithms-group:pre-0.6
from
forfudan:update
Jan 29, 2025
Merged
[routine][statistics] Update the statistics module + add returned_dtype + unify functions
#200
MadAlex1997
merged 15 commits into
Mojo-Numerics-and-Algorithms-group:pre-0.6
from
forfudan:update
Jan 29, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…umerics-and-Algorithms-group#197) Merge pre-0.5 branch to main branch for release of V0.5. See `docs/changelog.md` for differences.
commit 539af95 Author: ZHU Yuhao 朱宇浩 <[email protected]> Date: Tue Jan 28 22:14:28 2025 +0100 [routine][random] Update the random module + unify behaviors + add `randint` (Mojo-Numerics-and-Algorithms-group#199) The `random` module was created at quite an early stage. A lot of things should be re-considered. This PR aims to refactor the random module by: 1. Aligning the functional behaviors as much as possible with `numpy` while keeping internal consistency of style: The `shape` always comes as the first argument. 2. For all functions, accept `shape` as an `NDArrayShape`. Meanwhile, we still provide overloads for `*shape: Int`. (`shape: List[Int]` is also possible but not recommened). 3. `rand` now generates uniformed distributed values and does not accept integral types. 4. `randint` is added to generate random integral values based on `low` and `high`. add tests for it. 5. `random_exponential` is renamed as `exponential` (same as numpy)[https://numpy.org/doc/stable/reference/random/generated/numpy.random.exponential.html#numpy.random.exponential].
MadAlex1997
approved these changes
Jan 29, 2025
75fb2a5
into
Mojo-Numerics-and-Algorithms-group:pre-0.6
2 checks passed
forfudan
added a commit
to forfudan/NuMojo
that referenced
this pull request
Jan 30, 2025
…dtype` + unify functions (Mojo-Numerics-and-Algorithms-group#200) This PR makes some updates to the `statistics` module: 1. Add `returned_dtype` to several functions (`mean`, `median`) which defaults to `f64`. 2. Add an overload of `mean` that calculates the average of all items and returns a scalar. Remove the function `cummean`. 3. Add `variance` and `std` functions. Remove `cumpvariance` and `cumpstd` functions (the formulae are not correct). 4. Incorporate the changes into the corresponding `NDArray`. Add `variance` and `std` methods. 5. Fix the current tests and add tests for statistics module. 6. Add more detailed docstring for functions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes some updates to the
statisticsmodule:returned_dtypeto several functions (mean,median) which defaults tof64.meanthat calculates the average of all items and returns a scalar. Remove the functioncummean.varianceandstdfunctions. Removecumpvarianceandcumpstdfunctions (the formulae are not correct).NDArray. Addvarianceandstdmethods.