[ 
https://issues.apache.org/jira/browse/MATH-1656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740493#comment-17740493
 ] 

François Laferrière commented on MATH-1656:
-------------------------------------------

Hello,

please find a patch with a provisional version of Gradient-like optimizer. The 
abstract class GradientLikeOptimizer contains the common code for the 3 
methods: gradient descent, Newton-Raphson and BFGS. In fact only the 
direction(...) method that compute the search direction for the next iteration 
differs.

*Tests*

A group of junit tests covers >95% of the new code. The principle of the test 
is to generate a set of gnuplot data/command file. A DiffTest utility class is 
the ancestor of the classes containing the junit @test. The idea is to compare 
the files produced by the test with a reference stored in git. If a difference 
occurs during junit test execution, an assertion raised an exception 
(indicating the first line that differs) and the test fails.


The test results are stored in resource sub-tree with a path corresponding to 
the test method qualified name. For instance the result and reference of test 
testRosenbrockMax of test class 
org.apache.commons.math4.optim.NewtonRaphsonOptimizerTest is in directory 
{code:java}
commons-math/commons-math-legacy/src/test/resources/org/apache/commons/math4/optim/NewtonRaphsonOptimizerTest/testRosenbrockMax{code}
. This directory contains two sub-directories : ref for the test references and 
res for test results.
It is possible to visualize the results using gnuplot: for instance:
{code:java}
cd commons-math/commons-math-legacy
gnuplot -persist 
src/test/resources/org/apache/commons/math4/optim/NewtonRaphsonOptimizerTest/testRosenbrock/res/gnuplot.plt{code}
 

[^MATH-1658-GradientDescent-Newton-BFGS.patch]

 

> Classical multivariate optimizers (gradient descent, Raphson-Newton, BFGS) 
> are missing
> --------------------------------------------------------------------------------------
>
>                 Key: MATH-1656
>                 URL: https://issues.apache.org/jira/browse/MATH-1656
>             Project: Commons Math
>          Issue Type: Wish
>          Components: legacy
>    Affects Versions: 4.0-beta1
>            Reporter: François Laferrière
>            Priority: Major
>              Labels: features
>         Attachments: MATH-1658-GradientDescent-Newton-BFGS.patch
>
>
> Some classical multivariate such as
>  * gradient descent,
>  * Raphson-Newton,
>  * BFGS
> are missing.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to