org.apache.commons.math3.optimization.general

Class AbstractLeastSquaresOptimizerTestValidation

• java.lang.Object
• org.apache.commons.math3.optimization.general.AbstractLeastSquaresOptimizerTestValidation

• public class AbstractLeastSquaresOptimizerTestValidation
extends Object
This class demonstrates the main functionality of the AbstractLeastSquaresOptimizer, common to the optimizer implementations in package org.apache.commons.math3.optimization.general.
Not enabled by default, as the class name does not end with "Test".
Invoke by running

mvn test -Dtest=AbstractLeastSquaresOptimizerTestValidation

or by running

mvn test -Dtest=AbstractLeastSquaresOptimizerTestValidation -DargLine="-DmcRuns=1234 -server"

• Constructor Summary

Constructors
Constructor and Description
AbstractLeastSquaresOptimizerTestValidation()
• Method Summary

Methods
Modifier and Type Method and Description
void testParametersErrorMonteCarloObservations()
Using a Monte-Carlo procedure, this test checks the error estimations as provided by the square-root of the diagonal elements of the covariance matrix.
void testParametersErrorMonteCarloParameters()
In this test, the set of observations is fixed.
• Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• Constructor Detail

• AbstractLeastSquaresOptimizerTestValidation

public AbstractLeastSquaresOptimizerTestValidation()
• Method Detail

• testParametersErrorMonteCarloObservations

public void testParametersErrorMonteCarloObservations()
Using a Monte-Carlo procedure, this test checks the error estimations as provided by the square-root of the diagonal elements of the covariance matrix.
The test generates sets of observations, each sampled from a Gaussian distribution.
The optimization problem solved is defined in class StraightLineProblem.
The output (on stdout) will be a table summarizing the distribution of parameters generated by the Monte-Carlo process and by the direct estimation provided by the diagonal elements of the covariance matrix.
• testParametersErrorMonteCarloParameters

public void testParametersErrorMonteCarloParameters()
In this test, the set of observations is fixed. Using a Monte-Carlo procedure, it generates sets of parameters, and determine the parameter change that will result in the normalized chi-square becoming larger by one than the value from the best fit solution.
The optimization problem solved is defined in class StraightLineProblem.
The output (on stdout) will be a list of lines containing:
• slope of the straight line,
• intercept of the straight line,
• chi-square of the solution defined by the above two values.
The output is separated into two blocks (with a blank line between them); the first block will contain all parameter sets for which chi2 < chi2_b + 1 and the second block, all sets for which chi2 >= chi2_b + 1 where chi2_b is the lowest chi-square (corresponding to the best solution).