Skip to content

Commit 495968f

Browse files
committed
update readme
1 parent 787ea69 commit 495968f

1 file changed

Lines changed: 13 additions & 31 deletions

File tree

README.md

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
1-
# odrpack
1+
# odrpack (-python)
22

33
[![Test-Linux](https://github.com/HugoMVale/odrpack-python/actions/workflows/test-linux.yml/badge.svg)](https://github.com/HugoMVale/odrpack-python/actions)
44
[![codecov](https://codecov.io/gh/HugoMVale/odrpack-python/graph/badge.svg?token=B9sFyJiweC)](https://codecov.io/gh/HugoMVale/odrpack-python)
55
[![Latest Commit](https://img.shields.io/github/last-commit/HugoMVale/odrpack-python)](https://img.shields.io/github/last-commit/HugoMVale/odrpack-python)
66

77
## Description
88

9-
`odrpack` is a package for weighted orthogonal distance regression (ODR), also known as [errors-in-variables regression].
10-
It is designed primarily for instances when both the explanatory and response variables have significant errors.
11-
The package implements a highly efficient algorithm for minimizing the sum of the squares of the weighted orthogonal
12-
distances between each data point and the curve described by the model equation, subject to parameter bounds. The nonlinear
13-
model can be either explicit or implicit. Additionally, `odrpack` can be used to solve the ordinary least squares problem where all of
14-
the errors are attributed to the observations of the dependent variable.
9+
This Python package provides bindings for the well-known weighted orthogonal distance regression
10+
(ODR) solver [odrpack95]. This design ensures that users benefit from the performance and reliability
11+
of the original Fortran implementation, while working within the modern Python ecosystem.
12+
13+
ODR, also known as [errors-in-variables regression], is designed primarily for instances when both
14+
the explanatory and response variables have significant errors.
1515

1616
<p align="center">
1717
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/81/Total_least_squares.svg/220px-Total_least_squares.svg.png" width="200" alt="Deming regression; special case of ODR.">
1818
</p>
1919

2020
[errors-in-variables regression]: https://en.wikipedia.org/wiki/Errors-in-variables_models
21-
22-
## Python Bindings for Fortran Implementation
23-
24-
The `odrpack` Python package provides convient bindings for the efficient ODR solver available
25-
in the Fortran [odrpack95] repository. This design ensures that users benefit from the performance
26-
and reliability of the original Fortran implementation, while working within the modern Python
27-
ecosystem.
28-
2921
[odrpack95]: https://github.com/HugoMVale/odrpack95
3022

3123

@@ -55,23 +47,13 @@ def f(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
5547
return beta[0] * np.exp(beta[1]*x)
5648

5749

58-
def fjacb(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
59-
"Model jacobian w.r.t. the model parameters."
60-
jac = np.zeros((beta.size, x.size))
61-
jac[0, :] = np.exp(beta[1]*x)
62-
jac[1, :] = beta[0]*x*np.exp(beta[1]*x)
63-
return jac
64-
65-
66-
def fjacd(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
67-
"Model jacobian w.r.t. the error in the explanatory variable."
68-
return beta[0] * beta[1] * np.exp(beta[1]*x)
69-
70-
71-
sol = odr(f, beta0, y, x, lower=lower, upper=upper,
72-
fjacb=fjacb, fjacd=fjacd,
73-
job=20, iprint=1001)
50+
sol = odr(f, beta0, y, x, lower=lower, upper=upper, iprint=1001)
7451

7552
print("\n beta:", sol.beta)
7653
print("\n delta:", sol.delta)
54+
```
55+
56+
```sh
57+
beta: [1.63337057 0.9 ]
58+
delta: [-0.36885787 -0.31272733 0.02928942 0.11031791]
7759
```

0 commit comments

Comments
 (0)