You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With respect to mean, average, std: var is implemented in the main ndarray crate - would it make sense to port it here?
I think it makes sense for ndarray-stats to provide *_skipnan variants (or whatever you want to call them) of those methods. However, it would make sense to add std_axis to ndarray since ndarray already has var_axis.
For methods that are already in ndarray, we could duplicate these methods as a trait in ndarray-stats for people who want to write generic code (where the implementations just call the instance methods). I'm ambivalent on this.
I'll slowly start working on this next week and then I'll get serious the week afterwards. Could you please give me commit/PR permissions to the repository @jturner314?
Okay, that sounds good. I've given you push access. Alternatively, if you'd like to have your repo be the main one instead of this one, that would be fine with me.
Added a bunch of tests to #9 and merged 🎉 It feels like ages since I started to work on it 😅 Your contribution was extremely helpful to get it in the shape it is right now, thanks a lot @jturner314!
What do we need to do in order to release on crates.io?
I am going to open a small PR to add crate-level documentation - a couple of lines, nothing major.
What do we need to do in order to release on crates.io?
Ideally, we'd eliminate the [patch.crates-io] section from the Cargo.toml before we can release on crates.io. (This might even be required, I'm not sure.) #11 removed the patch for noisy_float, but a new version of ndarray will need to be released for us to remove its patch. It would be nice to merge a couple more ndarray PRs before release; I'll take a look.
It would also be good to merge #12 and #13 before releasing.
Merged #12 and #13 - looking around it seems we can publish with [patch.crates-io] section in Cargo.toml, but I agree it is much nicer to point to ndarray 0.12.1 as a dependency instead of a revision on master.
Let's wait for that release and then we are good to go.
I have drafted a tentative roadmap with the features I'd like to add in the next release - please edit it with your comments and suggestions @jturner314
The roadmap looks good to me. I'm not familiar with the applications of higher order central moments (I'd usually use a histogram instead), but I don't mind adding them if people find them useful.
By the way, I invited you as an owner for the ndarray-stats crate, but I just realized that crates.io may not have sent the invitation if you haven't logged in before. Please let me know if you need me to re-send it.
Somehow I didn't receive an email notification, but the invite was on my dashboard - accepted it!
The main objective in that area is getting kurtosis and skewness, and given the kind of computation required to achieve that it makes sense to also roll out higher order central moments I'd say :)
Unless any of you have made a start on these, I'd be interested in having a go at either, or contributing. I'll try to spend some time in the next couple of days looking at what is involved with the Deviation functions.
❓ Does anyone have any implementation suggestions other than just trying to port from StatsBase.jl?
If anyone wants to collaborate on the code then let me know.
@LukeMathWalker thanks. What led you to that decision? Is there a particular data type you've seen used in ndarrays that would need this? If so I'm thinking I might use it in the test fixtures to make sure all methods have the same bounds.
I see it as a tradeoff between convenience and generality - I am not personally aware of any "popular" numerical type that is not Copy, but the cost of weakening it to Clone is so low that I see it as safe future-proofing @munckymagik
I wanted to code a simple weighted_mean for myself then contribute it
pub fn weighted_mean<A, S>(data: &ArrayBase<S, Ix1>, weights: &[A]) -> A
where
S: Data<Elem = A>,
A: Float,
{
data.iter().zip(weights).fold(A::zero(), |acc, (&d, &w)| acc + d * w)
}
but I realize that it's too simple. This code is only useful for 1D arrays, or flattened matrices/images, etc. I can change the Ix1 for a D: Dimension, so that we don't need to flatten anything. It's still a one-liner though and it doesn't offer any "axis" feature, like Numpy. I think we need 2 functions here, because they won't return the same type.
n-d data with n-d weight, returns a number
axis mode: n-d data with n-d weight, returns (n-1)-d array.
I think we need 2 functions here, because they won't return the same type.
n-d data with n-d weight, returns a number
axis mode: n-d data with n-d weight, returns (n-1)-d array.
What do you guys had in mind?
I think it makes perfect sense to have two functions. @nilgoyette
It is also consistent with the rest of the API: we have mean and mean_axis, var and var_axis, etc. 👍
I was thinking of picking up the histogram merge method.
I am relatively new to rust and ndarray. With this exercise, I want to pick up ndarray, rust and also start contributing to ndarray-* libraries.
What do you guys think? Or are there more high level good first issue in other ndarray-* libraries?
Thanks very much for sharing the good work. Would it be possible to add univariate, bivariate and multivariate kernel density estimation functions? Thanks.
Activity
jturner314 commentedon Sep 16, 2018
I think it makes sense for
ndarray-statsto provide*_skipnanvariants (or whatever you want to call them) of those methods. However, it would make sense to addstd_axistondarraysincendarrayalready hasvar_axis.For methods that are already in
ndarray, we could duplicate these methods as a trait inndarray-statsfor people who want to write generic code (where the implementations just call the instance methods). I'm ambivalent on this.Okay, that sounds good. I've given you push access. Alternatively, if you'd like to have your repo be the main one instead of this one, that would be fine with me.
LukeMathWalker commentedon Nov 8, 2018
Once #9 gets merged I think we are in a good position to officially release version 0.1.0 on crates.io - what do you think? @jturner314
jturner314 commentedon Nov 11, 2018
I agree.
By the way, I recently came across Julia's
StatsBase.jllibrary. It's a good source of ideas in addition to NumPy/SciPy.LukeMathWalker commentedon Nov 18, 2018
Added a bunch of tests to #9 and merged 🎉 It feels like ages since I started to work on it 😅 Your contribution was extremely helpful to get it in the shape it is right now, thanks a lot @jturner314!
What do we need to do in order to release on crates.io?
I am going to open a small PR to add crate-level documentation - a couple of lines, nothing major.
jturner314 commentedon Nov 18, 2018
Yay! 🎉 That was a big job; great work.
Ideally, we'd eliminate the
[patch.crates-io]section from theCargo.tomlbefore we can release on crates.io. (This might even be required, I'm not sure.) #11 removed the patch fornoisy_float, but a new version ofndarraywill need to be released for us to remove its patch. It would be nice to merge a couple morendarrayPRs before release; I'll take a look.It would also be good to merge #12 and #13 before releasing.
LukeMathWalker commentedon Nov 19, 2018
Merged #12 and #13 - looking around it seems we can publish with
[patch.crates-io]section inCargo.toml, but I agree it is much nicer to point tondarray0.12.1 as a dependency instead of a revision onmaster.Let's wait for that release and then we are good to go.
jturner314 commentedon Nov 21, 2018
ndarray-stats0.1.0 is now on crates.io. 🎉 Thanks for all your hard work @LukeMathWalker!LukeMathWalker commentedon Nov 21, 2018
💯 💯 I think it's safe to say it would have never got there without your help 😛
I'll drop a post on r/rust as well 👍
LukeMathWalker commentedon Nov 24, 2018
I have drafted a tentative roadmap with the features I'd like to add in the next release - please edit it with your comments and suggestions @jturner314
jturner314 commentedon Nov 27, 2018
The roadmap looks good to me. I'm not familiar with the applications of higher order central moments (I'd usually use a histogram instead), but I don't mind adding them if people find them useful.
By the way, I invited you as an owner for the
ndarray-statscrate, but I just realized that crates.io may not have sent the invitation if you haven't logged in before. Please let me know if you need me to re-send it.LukeMathWalker commentedon Nov 29, 2018
Somehow I didn't receive an email notification, but the invite was on my dashboard - accepted it!
The main objective in that area is getting kurtosis and skewness, and given the kind of computation required to achieve that it makes sense to also roll out higher order central moments I'd say :)
phungleson commentedon Mar 9, 2019
Hey mate,
argmin / argmaxlooks like simple enough to look into, do you have any suggestions of where to start?12 remaining items
jturner314 commentedon Apr 13, 2019
Great job on 0.2.0 everyone!
A couple of ideas from StatsBase.jl:
We could also add statistical models (e.g. linear regression), but that might be best put in a separate crate.
phungleson commentedon Apr 15, 2019
Well done! cheers!
munckymagik commentedon Apr 17, 2019
Unless any of you have made a start on these, I'd be interested in having a go at either, or contributing. I'll try to spend some time in the next couple of days looking at what is involved with the Deviation functions.
❓ Does anyone have any implementation suggestions other than just trying to port from StatsBase.jl?
If anyone wants to collaborate on the code then let me know.
munckymagik commentedon Apr 17, 2019
Ok I made a start: #41
Any advice for choosing traits bounds for the
Aelement types? Is it ok to useCopyor do we need to support any types that would beClone?LukeMathWalker commentedon Apr 18, 2019
I'd say to use
clone@munckymagikmunckymagik commentedon Apr 18, 2019
@LukeMathWalker thanks. What led you to that decision? Is there a particular data type you've seen used in
ndarrays that would need this? If so I'm thinking I might use it in the test fixtures to make sure all methods have the same bounds.LukeMathWalker commentedon Apr 18, 2019
I see it as a tradeoff between convenience and generality - I am not personally aware of any "popular" numerical type that is not
Copy, but the cost of weakening it toCloneis so low that I see it as safe future-proofing @munckymagiknilgoyette commentedon Sep 13, 2019
I wanted to code a simple
weighted_meanfor myself then contribute itbut I realize that it's too simple. This code is only useful for 1D arrays, or flattened matrices/images, etc. I can change the
Ix1for aD: Dimension, so that we don't need to flatten anything. It's still a one-liner though and it doesn't offer any "axis" feature, like Numpy. I think we need 2 functions here, because they won't return the same type.What do you guys had in mind?
LukeMathWalker commentedon Sep 14, 2019
I think it makes perfect sense to have two functions. @nilgoyette
It is also consistent with the rest of the API: we have
meanandmean_axis,varandvar_axis, etc. 👍aeroaks commentedon Nov 18, 2019
I was thinking of picking up the histogram
mergemethod.I am relatively new to rust and
ndarray. With this exercise, I want to pick up ndarray, rust and also start contributing tondarray-*libraries.What do you guys think? Or are there more high level
good first issuein otherndarray-*libraries?munckymagik commentedon Nov 20, 2019
@aeroaks I'd say go for it 💯
You could raise a draft PR if you get something working and want some early feedback.
RolfStierle commentedon Apr 5, 2020
I would like to implement something like scipy.stats.binned_statistic_dd based on ndarray_stats::histogram::Histogram, allowing to caluclate running means, variances, sums, max/min value in each bin.
Would that be of interest?
LukeMathWalker commentedon Apr 5, 2020
It does! @RolfStierle
lebensterben commentedon Apr 15, 2020
According to https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram_bin_edges.html#numpy.histogram_bin_edges
Some of bins building strategies are not implemented by
rust-ndarraynow:doanescottstonehumphreylee commentedon Sep 21, 2023
Thanks very much for sharing the good work. Would it be possible to add univariate, bivariate and multivariate kernel density estimation functions? Thanks.