[
https://issues.apache.org/jira/browse/MATH-287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745812#action_12745812
]
Matthew Rowles edited comment on MATH-287 at 8/20/09 10:52 PM:
---------------------------------------------------------------
I've added weighted evaluate methods for Mean, Product, Sum and Variance. I've
also added a test method to AbstractUnivariateStatistic.
When I run svn diff to generate a patch file, there are a lot of "changes" that
I haven't done (lots of - a line followed by + the same line), and as a result,
the file is about 27k. I don't know what I did wrong...
In my first pass at this problem, the test method tests that the weights array
isn't null, is the same length as the values array, and checks each value to
ensure they aren't negative. This last check could get a bit time consuming -
weighted variance needs a weighted mean needs a weighted sum - all checking the
same weights array... The check itself is necessary; I can't see any way around
it other than making up a Weights class that knows that it is correct.
Additionally, the new evaluate methods essentially duplicate that of the
existing methods, with only the bits that are affected by the weighting being
changed. I had an idea that you could have a call to evaluate(values, begin,
length) be sent off to evaluate(values, null, begin, length) and have
appropriate null checks being done to decide whether or not to do a
weighted/unweighted analysis, but I thought that may not be appropriate.
Feedback more than welcome...
was (Author: masher):
I've added weighted options for Mean, Product, Sum and Variance. I've also
added a test method to AbstractUnivariateStatistic.
When I run svn diff to generate a patch file, there are a lot of "changes" that
I haven't done (lots of - a line followed by + the same line), and as a result,
the file is about 27k. I don't know what I did wrong...
In my first pass at this problem, the test method tests that the weights array
isn't null, is the same length as the values array, and checks each value to
ensure they aren't negative. This last check could get a bit time consuming -
weighted variance needs a weighted mean needs a weighted sum - all checking the
same weights array... The check itself is necessary; I can't see any way around
it other than making up a Weights class that knows that it is correct.
Additionally, the new evaluate methods essentially duplicate that of the
existing methods, with only the bits that are affected by the weighting being
changed. I had an idea that you could have a call to evaluate(values, begin,
length) be sent off to evaluate(values, null, begin, length) and have
appropriate null checks being done to decide whether or not to do a
weighted/unweighted analysis, but I thought that may not be appropriate.
Feedback more than welcome...
> Add support for weighted descriptive statistics
> -----------------------------------------------
>
> Key: MATH-287
> URL: https://issues.apache.org/jira/browse/MATH-287
> Project: Commons Math
> Issue Type: New Feature
> Affects Versions: 2.0
> Reporter: Matthew Rowles
> Priority: Minor
> Attachments: weighted.patch
>
>
> Add support for weighted descriptive statistics, such as weighted variance.
> An example method call would be Variance.evaluate(double[] values, double[]
> weights, int begin, int length)
> - Suggested by [email protected] on the mailing list.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.