bundles / scipy latest / scipy / odr / _odrpack / Model
class
scipy.odr._odrpack:Model
source: /scipy/odr/_odrpack.py :461
Signature
class Model ( fcn , fjacb = None , fjacd = None , extra_args = None , estimate = None , implicit = 0 , meta = None ) Members
Summary
The Model class stores information about the function you wish to fit.
Extended Summary
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.
Parameters
fcn: functionfcn(beta, x) --> y
fjacb: functionJacobian of fcn wrt the fit parameters beta.
fjacb(beta, x) --> @f_i(x,B)/@B_j
fjacd: functionJacobian of fcn wrt the (possibly multidimensional) input variable.
fjacd(beta, x) --> @f_i(x,B)/@x_j
extra_args: tuple, optionalIf specified,
extra_argsshould be a tuple of extra arguments to pass tofcn,fjacb, andfjacd. Each will be called byapply(fcn, (beta, x) + extra_args)estimate: array_like of rank-1Provides estimates of the fit parameters from the data
estimate(data) --> estbeta
implicit: booleanIf TRUE, specifies that the model is implicit; i.e
fcn(beta, x)~= 0 and there is no y data to fit againstmeta: dict, optionalfreeform dictionary of metadata for the model
Notes
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:
xif the input data is single-dimensional, then
xis rank-1 array; i.e.,x = array([1, 2, 3, ...]); x.shape = (n,)If the input data is multi-dimensional, thenxis 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.mis the dimensionality of the input data,nis the number of observations.yif the response variable is single-dimensional, then
yis a rank-1 array, i.e.,y = array([2, 4, ...]); y.shape = (n,). If the response variable is multi-dimensional, thenyis a rank-2 array, i.e.,y = array([[2, 4, ...], [3, 6, ...]]); y.shape = (q, n)whereqis the dimensionality of the response variable.rank-1 array of length
pwherepis the number of parameters; i.e.beta = array([B_1, B_2, ..., B_p])fjacbif the response variable is multi-dimensional, then the return array's shape is
(q, p, n)such thatfjacb(beta,x)[l,k,i] = d f_l(beta,x)/d B_kevaluated at the ith data point. Ifq == 1, then the return array is only rank-2 and with shape(p, n).fjacdas with fjacb, only the return array's shape is
(q, m, n)such thatfjacd(beta,x)[l,j,i] = d f_l(beta,x)/d X_jat the ith data point. Ifq == 1, then the return array's shape is(m, n). Ifm == 1, the shape is (q, n). Ifm == q == 1, the shape is(n,).
Aliases
-
scipy.odr.Model