[ 
https://issues.apache.org/jira/browse/MATH-817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Luc Maisonobe reopened MATH-817:
--------------------------------


As I was doing the release for 3.2, findbugs identified some problems.

There are integer divisions which are assumed to be floating number divisions 
in the estimate method near line 338.
These divisions are used to compute min and max indices for a bin and are in 
fact converted back to integer. So I guess the intermediate double could be 
completely removed.

When one wants to compute (int) floor(p/q) and p and q are both positive 
integers, then p/q already is the appropriate result.
When one wants to compute (int) ceil(p/q)  and p and q are both positive 
integers, then (p + q - 1)/q could be used.

So I would like to change the two computations to:
{code}
// minimum index from sorted data for this bin
final int minIndex = FastMath.max(0, ((binNumber - 1) * numRows) / totalBins);

// maximum index from sorted data for this bin
final int maxIndex = (binNumber * numRows + numComponents - 1) / numComponents 
- 1;
{code}

Does this change seems reasonable?
                
> Multivariate Normal Mixture Model Fitting by Expectation Maximization
> ---------------------------------------------------------------------
>
>                 Key: MATH-817
>                 URL: https://issues.apache.org/jira/browse/MATH-817
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>             Fix For: 3.2
>
>         Attachments: math_817.patch, 
> MultivariateNormalMixtureExpectationMaximizationFitter.java, 
> MultivariateNormalMixtureExpectationMaximizationFitterTest.java, 
> MultivariateNormalMixtureExpectationMaximizationTest.java.patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for fitting Multivariate Normal Mixture Models using 
> Expectation Maximization.
> > Hello,
> >
> > I have implemented some classes for multivariate Normal distributions, 
> > multivariate normal mixture models, and an expectation maximization fitting 
> > class for the mixture model.  I would like to submit it to Apache Commons 
> > Math.  I still have some touching up to do so that they fit the style 
> > guidelines and implement the correct interfaces.  Before I do so, I thought 
> > I would at least ask if the developers of the project are interested in me 
> > submitting them.
> >
> > Thanks,
> > Jared Becksfort
> Dear Jared,
> Yes, that would be very nice to have such an addition! Remember to also 
> include unit tests (refer to the current ones for examples). The best would 
> be to split a submission up into multiple minor ones, each covering a natural 
> submission (e.g. multivariate Normal distribution in one submission), and 
> create an issue as described at 
> http://commons.apache.org/math/issue-tracking.html .
> If you run into any problems, please do not hesitate to ask on this mailing 
> list.
> Cheers, Mikkel.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to