commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: [Math] "LUDecomposition" in "AbstractLeastSquaresOptimizer"
Date Fri, 09 Sep 2011 14:31:32 GMT

> >
> > On Thu, Sep 08, 2011 at 10:27:00AM -0500, Greg Sterijevski wrote:
> >> Could you be contaminating the cross product matrix when you do your
> >> accumulation? I noticed one of the utility classes has methods for doing
> >> safe accumulations. I know that this was part of the problem when I was
> >> trying to estimate the Wampler data with the MillerRegression. Just a
> >> thought...
> > To make sure, I've tried replacing the "sum" calculation in "getCovariances"
> > with one using "linearCombination for "MathUtils" but it still fails, so it
> > seems that the (default) threshold is too small, and I need to be able to
> > change it.
> Could be the best thing to do here is to make the
> DecompositionSolver pluggable

That's what I tried to do a couple of hours ago ;-)
I.e. I thought that we could have

public double[][] getCovariances(DecompositionSolver solver) {
  // ...

But that won't work with the current design because the solver is an inner
class of the various "...Decomposition" classes. And not a static one
because it needs to access the results of the decomposition stored in the
enclosing class. [Or did I miss something?]

> (maybe just for the LMOptimizer, but
> with hooks in the base class)?

A more flexible "getCovariances" should not be restricted to a single
optimizer. In fact, currently, I extend "AbstractLeastSquaresOptimizer"
directly, just to retrieve the covariance matrix; the optimum is not
computed by a subclass of it. [In the unit test which started this thread,
the optimum is known (thus: no optimization at all); the next step will be
to compute an optimum with an optimizer that does not use derivatives (e.g.
"SimplexOptimizer") but the covariance matrix must still be computed at the
solution found by that optimizer.]

>  That way you could provide an LU
> solver with whatever threshold you want or choose among the others. 
> Do you know if the jTj matrix you end up trying to invert is
> analytically singular (like the one in the testNonInvertible test
> case for LMOptimizer)?

No, I don't know. But if it is, then there must be a bug somewhere, I think.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message