Model
- class scipy.odr.Model(fcn, fjacb=None, fjacd=None, extra_args=None, estimate=None, implicit=0, meta=
The Model class stores information about the function you wish to fit.
It stores the function itself, at the least, and optionally stores functions which compute the Jacobians used during fitting. Also, one can provide a function that will provide reasonable starting values for the fit parameters possibly given the set of data.
fcn(beta, x) –> y
Jacobian of fcn wrt the fit parameters beta.
fjacb(beta, x) –> @f_i(x,B)/@B_j
Jacobian of fcn wrt the (possibly multidimensional) input variable.
fjacd(beta, x) –> @f_i(x,B)/@x_j
If specified, extra_args should be a tuple of extra arguments to pass to fcn, fjacb, and fjacd. Each will be called by apply(fcn, (beta, x) + extra_args)
Provides estimates of the fit parameters from the data
estimate(data) –> estbeta
If TRUE, specifies that the model is implicit; i.e fcn(beta, x) ~= 0 and there is no y data to fit against
freeform dictionary of metadata for the model
| Update the metadata dictionary with the keywords and data provided here. |
Note that the fcn, fjacb, and fjacd operate on NumPy arrays and return a NumPy array. The estimate object takes an instance of the Data class.
Here are the rules for the shapes of the argument and return arrays of the callback functions:
if the input data is single-dimensional, then x is rank-1
array; i.e., x = array([1, 2, 3, ...]); x.shape = (n,)
If the input data is multi-dimensional, then x is a rank-2 array;
i.e., x = array([[1, 2, ...], [2, 4, ...]]); x.shape = (m, n).
In all cases, it has the same shape as the input data array passed to
odr. m is the dimensionality of the input data,
n is the number of observations.
if the response variable is single-dimensional, then y is a
rank-1 array, i.e., y = .
If the response variable is multi-dimensional, then is a rank-2
array, i.e., where is the dimensionality of the response variable.
y = array([[2, 4, ...], [3, 6, ...]]); y.shape =
(q, n)rank-1 array of length p where p is the number of parameters;
i.e. beta = array([B_1, B_2, ..., B_p])
if the response variable is multi-dimensional, then the
return array’s shape is (q, p, n) such that fjacb(beta,x)[l,k,i] =
d f_l(beta,x)/d B_k evaluated at the ith data point. If q == 1, then
the return array is only rank-2 and with shape (p, n).
as with fjacb, only the return array’s shape is (q, m, n)
such that fjacd(beta,x)[l,j,i] = d f_l(beta,x)/d X_j at the ith data
point. If q == 1, then the return array’s shape is (m, n). If
m == 1, the shape is (q, n). If m == q == 1, the shape is (n,).