You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jared Becksfort (JIRA)" <ji...@apache.org> on 2012/07/10 22:34:34 UTC

[jira] [Created] (MATH-815) Multivariate Normal Distribution

Jared Becksfort created MATH-815:
------------------------------------

             Summary: Multivariate Normal Distribution
                 Key: MATH-815
                 URL: https://issues.apache.org/jira/browse/MATH-815
             Project: Commons Math
          Issue Type: New Feature
            Reporter: Jared Becksfort
            Priority: Minor


I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.

> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: mvn3.zip

Latest changes.  If these are all correct, I will start to work on the submission for the other issues (816, 817).
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, mvn3.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411667#comment-13411667 ] 

Gilles commented on MATH-815:
-----------------------------

Better to ask questions about legal stuff on the "dev" ML rather than here.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13413946#comment-13413946 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

Feel free to assign tickets 815, 816, and 817 to me.  I am getting close to finished with them.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13432831#comment-13432831 ] 

Gilles commented on MATH-815:
-----------------------------

I don't see any new patch...

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: acm_mvn_0807.zip, MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java, mvn2.tgz, mvn3.zip, mvn4.zip, mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431102#comment-13431102 ] 

Gilles commented on MATH-815:
-----------------------------

Hi Jared.

Referring to your previous comment:

bq. I also am attaching MultivariateNormalDistribution.java with a bug fix and some renamed functions.

Since I'd rather not redo all the changes which I made to the previous version of the files, I propose to commit the "main" code.
Then, please, update your working copy of the repository and provide a patch with your proposed changes and the unit tests. OK?

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13418788#comment-13418788 ] 

Gilles commented on MATH-815:
-----------------------------

bq. they should compute it before creating the object?

Yes.

Ways to do that are probably available in the "o.a.c.m.stat" package.
If the functionality you need is missing (i.e. there is no equivalent to "computeMu"), we may discuss on how to add it there.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421040#comment-13421040 ] 

Gilles commented on MATH-815:
-----------------------------


* Usage of "System.err" instead of raising an exception.
* I prefer "MathArrays.copyOf" instead of "System.arraycopy"
* Why do you store "inverseSigma" as "double[][]" and "sigma" as "RealMatrix"?
* In the method "getSigma" you return a "clone", which will perform a shallow copy.
* Method {{density}} should probably be written as:
{code}
public double density(final double[] vals)
        throws DimensionMismatchException {
    if (vals.length != numColumns) {
        throw new DimensionMismatchException(vals.length, numColumns);
    }

    final double kernel = getKernel(vals, mu, inverseSigma);
    final double denom = FastMath.pow(2 * Math.PI, numColumns / 2) *
                         FastMath.sqrt(sigmaDeterminant)) *
                         FastMath.exp(kernel);
    final double prob = 1d / denom;
    return prob;
}
{code}
* All calls to "Math" methods should be replaced by the equivalent call to "FastMath".
* Whenever possible, variables must be declared and assigned in the same statement (cf. lines 222 and 229 in "MultivariateNormalDistribution.java").
* "private" methods must also be commented.
* Computation in lines 116-119 ("MultivariateNormalDistribution.java") is probably more efficient if written as:
{code}
for (int row = 0; row < numColumns; row++) {
    final double factor = FastMath.sqrt(sigmaEigenvalues[row]);
    for (int col = 0; col < numColumns; col++) {
        tmpMatrix.multiplyEntry(factor);
    }
}
{code}

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: MultivariateNormalDistributionTest.java

Gilles,

Your version of the test is much cleaner.

I am attaching a patch for the multivariate normal test.  It samples 500,000 values to a tolerance of 1e-2. It takes very little time to run.  I replaced the separate tolerances for mean and sigma with a single tolerance because 1e-2 was that value that worked for both of them, so I figured we only needed one variable.

Jared
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425408#comment-13425408 ] 

Gilles commented on MATH-815:
-----------------------------

I wonder whether it is necessary that the determinant and inverse matrix are part of the public API (i.e. having accessors for them).

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, mvn.tgz, mvn2.tgz, mvn3.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422158#comment-13422158 ] 

Gilles commented on MATH-815:
-----------------------------

bq. For the Exceptions, [...] they are in the NormalDistributionTest also. 

I don't think so; they were removed 4 days ago (revision 1364028). ;)
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421040#comment-13421040 ] 

Gilles edited comment on MATH-815 at 7/23/12 11:57 PM:
-------------------------------------------------------

* Usage of "System.err" instead of raising an exception.
* I prefer "MathArrays.copyOf" instead of "System.arraycopy"
* Why do you store "inverseSigma" as "double[][]" and "sigma" as "RealMatrix"?
* In the method "getSigma" you return a "clone", which will perform a shallow copy.
* Method {{density}} should probably be written as:
{code}
public double density(final double[] vals)
        throws DimensionMismatchException {
    if (vals.length != numColumns) {
        throw new DimensionMismatchException(vals.length, numColumns);
    }

    final double kernel = getKernel(vals, mu, inverseSigma);
    final double denom = FastMath.pow(2 * Math.PI, numColumns / 2) *
                         FastMath.sqrt(sigmaDeterminant)) *
                         FastMath.exp(kernel);
    final double prob = 1d / denom;
    return prob;
}
{code}
* All calls to "Math" methods should be replaced by the equivalent call to "FastMath".
* Whenever possible, variables must be declared and assigned in the same statement (cf. lines 222 and 229 in "MultivariateNormalDistribution.java").
* "private" methods must also be commented.
* Computation in lines 116-119 ("MultivariateNormalDistribution.java") is probably more efficient if written as:
{code}
for (int row = 0; row < numColumns; row++) {
    final double factor = FastMath.sqrt(sigmaEigenvalues[row]);
    for (int col = 0; col < numColumns; col++) {
        tmpMatrix.multiplyEntry(row, col, factor);
    }
}
{code}

                
      was (Author: erans):
    
* Usage of "System.err" instead of raising an exception.
* I prefer "MathArrays.copyOf" instead of "System.arraycopy"
* Why do you store "inverseSigma" as "double[][]" and "sigma" as "RealMatrix"?
* In the method "getSigma" you return a "clone", which will perform a shallow copy.
* Method {{density}} should probably be written as:
{code}
public double density(final double[] vals)
        throws DimensionMismatchException {
    if (vals.length != numColumns) {
        throw new DimensionMismatchException(vals.length, numColumns);
    }

    final double kernel = getKernel(vals, mu, inverseSigma);
    final double denom = FastMath.pow(2 * Math.PI, numColumns / 2) *
                         FastMath.sqrt(sigmaDeterminant)) *
                         FastMath.exp(kernel);
    final double prob = 1d / denom;
    return prob;
}
{code}
* All calls to "Math" methods should be replaced by the equivalent call to "FastMath".
* Whenever possible, variables must be declared and assigned in the same statement (cf. lines 222 and 229 in "MultivariateNormalDistribution.java").
* "private" methods must also be commented.
* Computation in lines 116-119 ("MultivariateNormalDistribution.java") is probably more efficient if written as:
{code}
for (int row = 0; row < numColumns; row++) {
    final double factor = FastMath.sqrt(sigmaEigenvalues[row]);
    for (int col = 0; col < numColumns; col++) {
        tmpMatrix.multiplyEntry(factor);
    }
}
{code}

                  
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431186#comment-13431186 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

I agree that it should not override it, but it complained when I didn't.  Looks like I needed to revert the abstract class in my working copy.  Feel free to remove it from my latest submission.

It will not be simple to add a method that computes the probability in the box. The reason for this, in my opinion, is that there is no closed form for the cumulative distribution.  Computing the probability in the n-dimensional box will require either numerically estimating the cumulative distribution or the integral of the density function.

This can surely be done, and it will be good to add it at some point, but I would prefer to wait until I get some more time.  That is the main reason I did not include the cumulative distribution function in the interface: it will be difficult to compute it for a lot of multivariate distributions, and I didn't want to discourage submitters of other distributions.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431440#comment-13431440 ] 

Gilles commented on MATH-815:
-----------------------------

Jared,

The code has been updated in revision 1370984.

I had to further simplify the unit test class (as per my previous remarks about "locality" of test values).

I noticed that, in "testSampling", the number of samples was unnecessarily large given the allowed tolerances (I suspect that the bug you discovered might have been the cause for having such large tolerances): I reduced it to 30 and the test still pass! However, it is probably better to decrease the tolerances and increase (reasonably) the number of samples.
I'll let you play with the values; then please submit an updated patch for this unit test. Thanks.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: MultivariateNormalDistributionTest.java

Forgot to update this one.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistributionTest.java, mvn.tgz, mvn2.tgz, mvn3.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421328#comment-13421328 ] 

Gilles commented on MATH-815:
-----------------------------

In the test classes:
* Please remove all the "throws Exception" clauses. There are no checked exceptions in CM.
* The "testSampling" method should probably be _defined_ in the (abstract) parent class, i.e. once for all implementations. I think that we should probably adapt the corresponding code in "RealDistributionAbstractTest". Maybe that it is not easy; if so, the issue should definitely be raised on the "dev" ML.

About the API of {{MultivariateNormalDistribution}}:
* {{getColumnDimension}} should probably be simply {{getDimensions}}. And it should actually be defined in the base class (which stores a "numDimensions" instance variable).
* To be consistent with class {{NormalDistribution}}, {{getMu}} should become {{getMean}}.
* Unless I'm mistaken, there seems to be a contradiction: the covariance matrix is called "sigma" (instance variable and accessor method) whereas it should rather be "covariance".
* For consistency, the {{getVariances}} method should be replaced with a {{getStandardDeviation}} method.

In {{AbstractMultivariateRealDistribution}}:
* The usage of {{RandomData}} is deprecated (cf. MATH-823). Please store an instance of {{RandomGenerator}} (to be initialized in the constructor).
* The "sample()" method should be "abstract" (instead of returning a useless array).
* "numDimensions" should be "private" and "final" (and initialized by the constructor).

If anything is not clear, do not hesitate to ask on the "dev" ML.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13427272#comment-13427272 ] 

Gilles commented on MATH-815:
-----------------------------

Hi Jared.

I've made some changes:
* formatting and missing Javadoc,
* removing unnecessary instance variables,
** DEFAULT_ABSOLUTE_ACCURACY
** covarianceMatrixEigenDecomposition
** covarianceMatrixEigenvalues
** covarianceMatrixEigenvectors
* reordering of the exception arguments,
* consistency checks (all rows of the covariance matrix must have the same length).

The "main" code is ready for inclusion.

However, the "test" part is very hard to read, primarily because of the "non-locality": e.g. a test for a trivial accessor like "getMeans" retrieves its data not from a local variable but from data defined at the top of the file and provided through a call to an abstract method!

In the absence of test code _defined_ in the abstract class, having such a hierarchy is worse than useless.
Indeed, the point of having an abstract method like "makeDistribution" is to design tests that are _independent_ of the distribution instance, whereas in your test cases, you refer to the actual values used to construct the instance returned by "makeDistribution". This is plainly the opposite of abstractness.

Please make a single, simple, self-contained "MultivariateNormalDistributionTest", i.e. not extending an "MultivariateRealDistributionAbstractTest" that serves no purpose in this case.
Note: When testing trivial functionality (like accessors), it is better to use "simple" numbers (like 12.345 or 1.111111 etc.) and keep the number of dimensions low (e.g. if "getMeans" returns the correct array in 2 dimensions, it will likely do so in 10 or 100).
Also be careful with the tolerances: "getMeans" should retrieve the _same_ values that were passed to the constructor. Therefore, why do you use a large tolerance like 1e-6? In that test, it should rather be something like 1e-16.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433430#comment-13433430 ] 

Gilles commented on MATH-815:
-----------------------------

bq. I attached a java file last week for the multivariate normal distribution test [...]

W.r.t the version in "trunk", that file was already outdated (it still contained all the methods to indirectly access the test data) .

The patch is fine. Thanks.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: acm_mvn_0807.zip, MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java.patch, mvn2.tgz, mvn3.zip, mvn4.zip, mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422279#comment-13422279 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

OK, I will update my working copy to get the more current version of the test classes.  I asked the API question on the Dev list.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479924#comment-13479924 ] 

Gilles commented on MATH-815:
-----------------------------

Added method "getDimension()" to the "MultivariateRealDistribution" interface (revision 
1400017).
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>             Fix For: 3.1
>
>         Attachments: acm_mvn_0807.zip, MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java.patch, mvn2.tgz, mvn3.zip, mvn4.zip, mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13424920#comment-13424920 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

I will incorporate the latest round of feedback from this issue list and the mailing list and resubmit, probably tomorrow.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431170#comment-13431170 ] 

Gilles commented on MATH-815:
-----------------------------

{{MultivariateNormalDistribution}} should not override the (trivial) "probability(double[])" method.

Would it be difficult to add a method
{code}
public double probability(double[] lower, double[] upper);
{code}
that would compute the probability to be in the n-dimensional box defined by the given intervals?

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: mvn.tgz

Gilles,

Thanks for the feedback. Please see the attached files and let me know if more changes need to be made.

Thanks,
Jared
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13418576#comment-13418576 ] 

Gilles commented on MATH-815:
-----------------------------

Personally, I prefer to look at plain Java files, rather than a big "diff" file, especially when those files are new and, indeed, subject to be modified according to comments given here or on the "dev" ML.

Thanks a lot for your contribution, but there are some issues:
* We aim towards having "immutable" objects:
** When constructing an instance, and when returning instance variables, defensive copies must be made.
** No setters: all parameters must be passed through the constructor, and assigned (or copied) to "final" instance variables.
** If possible, all instance variables must be "final".
* Inside methods, any constant primitive or object reference (i.e. arrays too) should be declared "final".
* Many comments are missing.
* Some variables names are in C-style (e.g. "mean_vector" should become "meanVector")
* "@param" comments should start on the same line.
* The utility "print2DArray" should not be included.
* The classes in the "o.a.c.m.distribution" package should not do more than represent the given distribution: Computing means and standard deviations of data should not be performed in that class.
* Numbers (".5" should be written "0.5").
* Missing "newline" character at the end of the files (i.e. there should be one empty line at the end of the source file.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422126#comment-13422126 ] 

Gilles edited comment on MATH-815 at 7/25/12 9:41 AM:
------------------------------------------------------

bq. I used "sigma" because that is the argument name in a lot of R routines.

This (API) is an important issue to raise on the "dev" list.

                
      was (Author: erans):
    bq. I used "sigma" because that is the argument name in a lot of R routines.

This (API) is an important issue to ask on the "dev" list.

                  
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: MultivariateNormalDistributionTest.java.patch

Gilles,

I attached a java file last week for the multivariate normal distribution test instead of a patch file. Now I am attaching a patch file.

Jared
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: acm_mvn_0807.zip, MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java.patch, mvn2.tgz, mvn3.zip, mvn4.zip, mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425652#comment-13425652 ] 

Gilles commented on MATH-815:
-----------------------------

bq. It may not be.

Then it is better not to include them until there is an identified need.
The rationale is that it is easy to add methods later, while removing or changing them in any ways is not (due to the backwards-compatibility constraint).

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, mvn.tgz, mvn2.tgz, mvn3.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431127#comment-13431127 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

That is OK with me, but the getKernel function has a bug.  If you are OK having it in the repository for a day or so, then we can do that.  If you would rather not have a bug there, you can attach your version of MultivariateNormalDistribution.java and I can modify it and resubmit.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: mvn4.zip

Removed two public functions from MultivariateNormalDistributions.java.  I am reattaching all the files so you don't have to sort through the latest changes. They go in the distributions src/main and src/test packages.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13428354#comment-13428354 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

Gilles,

I will review the unit test code over the weekend and resubmit a single test class that does not extend an abstract multivariate distribution test.

Jared
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421997#comment-13421997 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

Hi, Gilles:

I sent one question to the dev list.  For the Exceptions, I can easily remove them, but they are in the NormalDistributionTest also.  I used "sigma" because that is the argument name in a lot of R routines.  I can easily change this too.  All the other items should be fine for me to change.  I should be able to get to them soon.

Jared
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13413947#comment-13413947 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

This will include sampling.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: MultivariateNormalDistribution.java.patch

Bug fix patch for MultivariateNormalDistribution.java. Also removed unused imports.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422126#comment-13422126 ] 

Gilles commented on MATH-815:
-----------------------------

bq. I used "sigma" because that is the argument name in a lot of R routines.

This (API) is an important issue to ask on the "dev" list.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411599#comment-13411599 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

Great, I am happy to help.  My employer has given me permission to contribute the code.  I am not an expert in the Apache license.  I read http://www.apache.org/licenses/icla.txt.  It seems that our company is still allowed to retain copyright, and we give the ASF non-exclusive copyright as well.  Is this correct?  My company is also requiring that I place our name somewhere near the top of the comments.  Does this work for you? 
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: acm_mvn_0807.zip

Gilles,

I am attaching a simpler MultivariateNormalDistributionTest.java.  I also am attaching MultivariateNormalDistribution.java with a bug fix and some renamed functions.  The getKernel function was not accurate, so I have replaced it with a cleaner, repaired function called getExponentTerm and modified the density function to accommodate it.  I know you made some modifications to the file, but I was not able to incorporate them because they are not yet versioned.

I appreciate the attention you have given to this issue. If there is more to change, please let me know. Otherwise, I will modify the other code I plan to submit according to your suggestions on this issue.

Jared
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "devl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411407#comment-13411407 ] 

devl commented on MATH-815:
---------------------------

This is a really welcome addition and would certainly open commons math to the MCMC community. Sampling would be really excellent as well is possible.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13431130#comment-13431130 ] 

Gilles commented on MATH-815:
-----------------------------

{{AbstractMultivariateRealDistribution}}, {{MultivariateNormalDistribution}} and {{MultivariateRealDistribution}} committed in revision 1370782.

                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13418590#comment-13418590 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

OK, I will fix these and resubmit, probably tomorrow.  Most of them seem simple. I can submit an archive file instead of a patch.

For the item about not computing means and standard deviations: people (such as myself) may want to provide the raw data array. In that case, the means and covariance matrices have to be computed.  Are you saying users shouldn't do this, meaning that they should compute it before creating the object? Or that I should try to use existing classes to compute the mean and covariance within these new classes?
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: patch

This is the first of 3 planned patches. The other patches will be for issues 816 and 817.  I am only submitting this one right now in case I have to make code style or comment changes.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13430652#comment-13430652 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

Also, some of the tolerances are still high because they have to do with the results returned by sampling.  I am currently sampling around 5 million times to get the sample means and covariance matrix.  The tolerances provided are about as close as I can get to the true values unless we want to sample more.  It currently takes 5 to 10 seconds for the unit tests to run.  I am not sure if that is typical, short, or long for tests in this project.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, acm_mvn_0807.zip, mvn.tgz, mvn2.tgz, mvn3.zip, mvn4.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421040#comment-13421040 ] 

Gilles edited comment on MATH-815 at 7/24/12 12:02 AM:
-------------------------------------------------------

* Usage of "System.err" instead of raising an exception.
* I prefer "MathArrays.copyOf" instead of "System.arraycopy"
* Why do you store "inverseSigma" as "double[][]" and "sigma" as "RealMatrix"?
* In the method "getSigma" you return a "clone", which will perform a shallow copy.
* Method {{density}} should probably be written as:
{code}
public double density(final double[] vals)
        throws DimensionMismatchException {
    if (vals.length != numColumns) {
        throw new DimensionMismatchException(vals.length, numColumns);
    }

    final double kernel = getKernel(vals, mu, inverseSigma);
    final double denom = FastMath.pow(2 * Math.PI, numColumns / 2) *
                         FastMath.sqrt(sigmaDeterminant)) *
                         FastMath.exp(kernel);
    final double prob = 1d / denom;
    return prob;
}
{code}
* All calls to "Math" methods should be replaced by the equivalent call to "FastMath".
* Whenever possible, variables must be declared and assigned in the same statement (cf. lines 222 and 229 in "MultivariateNormalDistribution.java").
* "private" methods must also be documented.
* Computation in lines 116-119 ("MultivariateNormalDistribution.java") is probably more efficient if written as:
{code}
for (int row = 0; row < numColumns; row++) {
    final double factor = FastMath.sqrt(sigmaEigenvalues[row]);
    for (int col = 0; col < numColumns; col++) {
        tmpMatrix.multiplyEntry(row, col, factor);
    }
}
{code}

                
      was (Author: erans):
    * Usage of "System.err" instead of raising an exception.
* I prefer "MathArrays.copyOf" instead of "System.arraycopy"
* Why do you store "inverseSigma" as "double[][]" and "sigma" as "RealMatrix"?
* In the method "getSigma" you return a "clone", which will perform a shallow copy.
* Method {{density}} should probably be written as:
{code}
public double density(final double[] vals)
        throws DimensionMismatchException {
    if (vals.length != numColumns) {
        throw new DimensionMismatchException(vals.length, numColumns);
    }

    final double kernel = getKernel(vals, mu, inverseSigma);
    final double denom = FastMath.pow(2 * Math.PI, numColumns / 2) *
                         FastMath.sqrt(sigmaDeterminant)) *
                         FastMath.exp(kernel);
    final double prob = 1d / denom;
    return prob;
}
{code}
* All calls to "Math" methods should be replaced by the equivalent call to "FastMath".
* Whenever possible, variables must be declared and assigned in the same statement (cf. lines 222 and 229 in "MultivariateNormalDistribution.java").
* "private" methods must also be commented.
* Computation in lines 116-119 ("MultivariateNormalDistribution.java") is probably more efficient if written as:
{code}
for (int row = 0; row < numColumns; row++) {
    final double factor = FastMath.sqrt(sigmaEigenvalues[row]);
    for (int col = 0; col < numColumns; col++) {
        tmpMatrix.multiplyEntry(row, col, factor);
    }
}
{code}

                  
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: mvn2.tgz

Gilles,

Thanks for responding. Hopefully this time I have done everything. I wasn't sure where I missed the private comments, but I think I did everything else.  

I changed the kernel function to longer require the parameters which were also class members.

I added a seed to the random sampling test and was able to decrease the tolerance required for testing the values.

Once this issue is finalized, I will make similar code changes to the other issues.

Jared
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, mvn2.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425454#comment-13425454 ] 

Jared Becksfort commented on MATH-815:
--------------------------------------

It may not be.  We are computing them, so I figured if somebody wanted to use them for something they could. I don't have strong feelings either way.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, mvn.tgz, mvn2.tgz, mvn3.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (MATH-815) Multivariate Normal Distribution

Posted by "Jared Becksfort (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Becksfort updated MATH-815:
---------------------------------

    Attachment: MultivariateNormalDistribution.java

Needed to add a comment to MultivariateNormalDistribution.java
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: MultivariateNormalDistribution.java, MultivariateNormalDistributionTest.java, mvn.tgz, mvn2.tgz, mvn3.zip, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (MATH-815) Multivariate Normal Distribution

Posted by "Gilles (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles resolved MATH-815.
-------------------------

       Resolution: Fixed
    Fix Version/s: 3.1

Patch committed in revision 1372556.
                
> Multivariate Normal Distribution
> --------------------------------
>
>                 Key: MATH-815
>                 URL: https://issues.apache.org/jira/browse/MATH-815
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>             Fix For: 3.1
>
>         Attachments: acm_mvn_0807.zip, MultivariateNormalDistribution.java, MultivariateNormalDistribution.java.patch, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java, MultivariateNormalDistributionTest.java.patch, mvn2.tgz, mvn3.zip, mvn4.zip, mvn.tgz, patch
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow sampling initially.
> > 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira