Skip to content

Commit

Permalink
docs: add demo covariance matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Nov 30, 2021
1 parent 32e0b34 commit f062401
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/usage/step3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,37 @@
"As can be seen, the values of the optimized parameters in the result are again comparable to the original values that are contained in the model ({attr}`.SympyModel.parameters`):"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Covariance matrix"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Each of the {mod}`.optimizer`s offer more specific information about the fit result. This information can be accessed with {attr}`.FitResult.specifics`. A common example would be to get the `~iminuit.Minuit.covariance` matrix:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"covariance_matrix = fit_result.specifics.covariance\n",
"covariance_matrix"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### AIC and BIC"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
3 changes: 3 additions & 0 deletions src/tensorwaves/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ class FitResult: # pylint: disable=too-many-instance-attributes
- `iminuit.Minuit`
- `scipy.optimize.OptimizeResult`
This way, you can for instance get the `~iminuit.Minuit.covariance` matrix.
See also :ref:`/usage/step3:Covariance matrix`.
"""

@parameter_errors.validator # pyright: reportOptionalMemberAccess=false
Expand Down

0 comments on commit f062401

Please sign in to comment.