mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 12:03:42 +02:00
least_squares docstring updated
This commit is contained in:
parent
2a594dfb4b
commit
bc819828bc
1 changed files with 8 additions and 3 deletions
|
@ -57,7 +57,7 @@ class Fit_result(Sequence):
|
||||||
|
|
||||||
|
|
||||||
def least_squares(x, y, func, priors=None, silent=False, **kwargs):
|
def least_squares(x, y, func, priors=None, silent=False, **kwargs):
|
||||||
"""Performs a non-linear fit to y = func(x).
|
r'''Performs a non-linear fit to y = func(x).
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
|
@ -68,14 +68,19 @@ def least_squares(x, y, func, priors=None, silent=False, **kwargs):
|
||||||
func : object
|
func : object
|
||||||
fit function, has to be of the form
|
fit function, has to be of the form
|
||||||
|
|
||||||
|
```python
|
||||||
def func(a, x):
|
def func(a, x):
|
||||||
return a[0] + a[1] * x + a[2] * anp.sinh(x)
|
y = a[0] + a[1] * x + a[2] * anp.sinh(x)
|
||||||
|
return y
|
||||||
|
```
|
||||||
|
|
||||||
For multiple x values func can be of the form
|
For multiple x values func can be of the form
|
||||||
|
|
||||||
|
```python
|
||||||
def func(a, x):
|
def func(a, x):
|
||||||
(x1, x2) = x
|
(x1, x2) = x
|
||||||
return a[0] * x1 ** 2 + a[1] * x2
|
return a[0] * x1 ** 2 + a[1] * x2
|
||||||
|
```
|
||||||
|
|
||||||
It is important that all numpy functions refer to autograd.numpy, otherwise the differentiation
|
It is important that all numpy functions refer to autograd.numpy, otherwise the differentiation
|
||||||
will not work
|
will not work
|
||||||
|
@ -104,7 +109,7 @@ def least_squares(x, y, func, priors=None, silent=False, **kwargs):
|
||||||
corrected by effects caused by correlated input data.
|
corrected by effects caused by correlated input data.
|
||||||
This can take a while as the full correlation matrix
|
This can take a while as the full correlation matrix
|
||||||
has to be calculated (default False).
|
has to be calculated (default False).
|
||||||
"""
|
'''
|
||||||
if priors is not None:
|
if priors is not None:
|
||||||
return _prior_fit(x, y, func, priors, silent=silent, **kwargs)
|
return _prior_fit(x, y, func, priors, silent=silent, **kwargs)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue