Skip to content

Commit

Permalink
Added best_available jacobian option to allow for sets with only so…
Browse files Browse the repository at this point in the history
…me analytic (#1251)

* Create alternative best available jacobian class

* Add docs for new jac class

* Tidy code and add tests

* Add best_available hessian

* Add best_available_hessian part 2

* Fix error in tables tests

* Revert to using and as it allows for short circuiting

* Fix default hessian test

* Fix regression tests

* Remove super init in best hessian

* Use correct jacobian for mantid tests

* Use correct jacobian for mantid tests

* Fix issues identified in review

* Fix erroneous test names

* Update default jacobian in test
  • Loading branch information
AndrewLister-STFC committed May 14, 2024
1 parent f4ea424 commit 3ea789e
Show file tree
Hide file tree
Showing 28 changed files with 572 additions and 3,422 deletions.
10 changes: 6 additions & 4 deletions docs/source/users/options/fitting_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@ Current Jacobian methods are:
* ``scipy`` - uses :ref:`SciPy's finite difference Jacobian approximations <scipy-jac>`.
* ``default`` - uses the default derivative approximation implemented in the minimizer.
* ``numdifftools`` - uses the python package :ref:`numdifftools <numdifftools-jac>`.
* ``best_available`` - uses the analytic jacobian if it is available, otherwise uses a Scipy jacobian.

Default is ``analytic``
Default is ``best_available``

.. code-block:: rst
[FITTING]
jac_method: analytic
jac_method: best_available
.. warning::

Expand All @@ -145,13 +146,14 @@ Current Hessian methods are:
* ``analytic`` - uses the analytic Hessian extracted from the fitting problem.
* ``scipy`` - uses :ref:`SciPy's finite difference approximations <scipy-hes>`.
* ``numdifftools`` - uses the python package :ref:`numdifftools <numdifftools-hes>`.
* ``best_available`` - uses the analytic hessian if it is available, otherwise uses a Scipy hessian.

Default is ``analytic``
Default is ``best_available``

.. code-block:: rst
[FITTING]
hes_method: analytic
hes_method: best_available
.. warning::

Expand Down
20 changes: 20 additions & 0 deletions docs/source/users/options/hessian_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Hessian Options

The Hessian section allows you to control which methods for computing Hessians the software uses.

.. _analytic-hes:

Analytic (:code:`analytic`)
---------------------------

Expand Down Expand Up @@ -83,3 +85,21 @@ Default is ``central``.
[HESSIAN]
numdifftools: central
Best Available (:code:`best_available`)
---------------------------------------

A flexible option which uses :ref:`analytic-hes` where available and
:ref:`scipy-jac` with ``method=2-point`` when the analytic would fail.
This may be useful when testing large problem sets with multiple sources.

The only option is:

* ``default`` - use analytic hessian if available, otherwise use scipy 2-point.

Default is ``default``

.. code-block:: rst
[HESSIAN]
best_available: default
21 changes: 21 additions & 0 deletions docs/source/users/options/jacobian_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ Jacobian Options

The Jacobian section allows you to control which methods for computing Jacobians the software uses.

.. _analytic-jac:

Analytic (:code:`analytic`)
---------------------------

Analytic Jacobians can only be used for specific :ref:`problem_def`.
If an analytic jacobian is not available, the benchmark will be skipped.
Currently the supported formats are CUTEst, Mantid, and NIST.
The only option is:

Expand Down Expand Up @@ -91,3 +94,21 @@ Default is ``central``.
[JACOBIAN]
numdifftools: central
Best Available (:code:`best_available`)
---------------------------------------

A flexible option which uses :ref:`analytic-jac` where available and
:ref:`scipy-jac` with ``method=2-point`` when the analytic would fail.
This may be useful when testing large problem sets with multiple sources.

The only option is:

* ``default`` - use analytic jacobian if available, otherwise use scipy 2-point.

Default is ``default``

.. code-block:: rst
[JACOBIAN]
best_available: default

0 comments on commit 3ea789e

Please sign in to comment.