Skip to content

Comments

Add mean to std.algorithm#3679

Closed
JackStouffer wants to merge 1 commit intodlang:masterfrom
JackStouffer:mean
Closed

Add mean to std.algorithm#3679
JackStouffer wants to merge 1 commit intodlang:masterfrom
JackStouffer:mean

Conversation

@JackStouffer
Copy link
Contributor

Split from #3592

I will propose the same question I had in the other PR

I also want to add various other statistical methods to Phobos, such as standard deviation, which fit in std.algorithm, and things such as rolling mean, which don't fit into std.algorithm. I was thinking that something like a rolling mean would best fit in std.numeric, but, would it be best if all of the statistical methods were in the same module, or is it ok to have them separate?

Also fixes issue 14034

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this function is not used directly in your tests I suppose it should be private and named meanImpl

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad

@9il
Copy link
Member

9il commented Oct 2, 2015

Hi @JackStouffer!
I would like to see more PRs like that :-)
Few notes:

  1. This and any other statistical PRs should depend on [new concept under development] Python's fsum and others #2991
  2. We need to discuss module names first. A submodule for std.numeric is more suitable, thought. We should save std.algorithm.iteration as general purpose module without serious math payload.
  3. Please ping @John-Colvin and @9il (me) when you create math PRs.

@JackStouffer
Copy link
Contributor Author

This and any other statistical PRs should depend on #2991

Ok, I'm not quite sure how to make a branch off of a PR though.

We need to discuss module names first. A submodule for std.numeric is more suitable, though

std.numeric.stats perhaps? If that's the case, then your geometricMean function should be moved there as well.

We should save std.algorithm.iteration as general purpose module without serious math payload.

I agree. Following this, I believe the sum functions in std.algorithm.iteration should be deprecated aliases and move the actual functions in std.numeric then. That way all of the math code is in one place.

@9il
Copy link
Member

9il commented Oct 2, 2015

Ok, I'm not quite sure how to make a branch off of a PR though.

You can fork my phobos repo and switch to the corresponding branch. Please read last comments starting with #2991 (comment) . Summation API can be changed during October. You are welcome for API review.

std.numeric.stats perhaps? If that's the case, then your geometricMean function should be moved there as well.

std.numeric.stats sounds good. For first release it may be small DUB package and std.experimental.numeric.stats.

@DmitryOlshansky
Copy link
Member

Glad to see this is converging on nice package names and goes in the right direction ;)

@JackStouffer
Copy link
Contributor Author

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.

4 participants