commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Becksfort, Jared" <Jared.Becksf...@STJUDE.ORG>
Subject RE: [math] Unit Tests for Multivariate Distribution Sampling
Date Fri, 27 Jul 2012 17:07:31 GMT
Gilles,

I agree that the API naming should be consistent, so if the rest of library is not using Greek
letters, I will change the name of the method "getSigma."  I prefer to name it "getCovarianceMatrix"
rather than "getCovariances."  I changed all of the methods and members referring to sigma
to use "covarianceMatrix" instead.

I modified "getVariances" to return the square roots of the diagonal elements and renamed
the method "getStandardDeviations" (note the plural).

Along the same lines, I renamed "getMu" to "getMeans."

I chose the plural because it is returning an array of elements, not a single element.  This
may also stave off ambiguity for people who refer to the grand mean of a sample set as the
"mean."  If anyone has better suggestions please let us know.

Thanks,
Jared

-----Original Message-----
From: Gilles Sadowski [mailto:gilles@harfang.homelinux.org]
Sent: Wednesday, July 25, 2012 11:18 AM
To: dev@commons.apache.org
Subject: Re: [math] Unit Tests for Multivariate Distribution Sampling

On Wed, Jul 25, 2012 at 09:00:44AM -0500, Becksfort, Jared wrote:
> I have another question, this time about the API.  The covariance matrix of a multivariate
normal distribution is called sigma in a number of R libraries, but I am not sure it is called
that everywhere.  I named the parameters and get methods for the covariance matrix things
like "getSigma" but mentioned covariance matrix in the comments.  Do the developers here have
a preference between getSigma and getCovarianceMatrix?  I can change the parameters accordingly.

Referring to
  http://en.wikipedia.org/wiki/Multivariate_normal_distribution
you are right that the matrix is represented by the capital "Sigma" Greek letter.

However, in other places in the CM's code, similar data are retrieved with a method called
"getCovariances()".[1] IMO, it's clearer that the method name refers to the concept (covariance)
rather than the notation (Greek letter).

Hence, I propose to just change the method name:
  getSigma -> getCovariances
(and the name of the instance variable, to reduce possible confusion when reading the code).

And instead of providing
  double[] getVariances()
(elements on the diagonal of the matrix), I'd provided, as a convenience,
  double[] getStandardDeviation()
(square-root of the elements on the diagonal).


Regards,
Gilles

[1] org.apache.commons.math3.optimization.general.AbstractLeastSquaresOptimizer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org



Email Disclaimer:  www.stjude.org/emaildisclaimer
Consultation Disclaimer:  www.stjude.org/consultationdisclaimer


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message