scipy.odr.Data#

class scipy.odr.Data(x, y=None, we=None, wd=None, fix=None, meta=None)[source]#

The data to fit.

Parameters:
xarray_like

Observed data for the independent variable of the regression

yarray_like, optional

If array-like, observed data for the dependent variable of the regression. A scalar input implies that the model to be used on the data is implicit.

wearray_like, optional

If we is a scalar, then that value is used for all data points (and all dimensions of the response variable). If we is a rank-1 array of length q (the dimensionality of the response variable), then this vector is the diagonal of the covariant weighting matrix for all data points. If we is a rank-1 array of length n (the number of data points), then the i’th element is the weight for the i’th response variable observation (single-dimensional only). If we is a rank-2 array of shape (q, q), then this is the full covariant weighting matrix broadcast to each observation. If we is a rank-2 array of shape (q, n), then we[:,i] is the diagonal of the covariant weighting matrix for the i’th observation. If we is a rank-3 array of shape (q, q, n), then we[:,:,i] is the full specification of the covariant weighting matrix for each observation. If the fit is implicit, then only a positive scalar value is used.

wdarray_like, optional

If wd is a scalar, then that value is used for all data points (and all dimensions of the input variable). If wd = 0, then the covariant weighting matrix for each observation is set to the identity matrix (so each dimension of each observation has the same weight). If wd is a rank-1 array of length m (the dimensionality of the input variable), then this vector is the diagonal of the covariant weighting matrix for all data points. If wd is a rank-1 array of length n (the number of data points), then the i’th element is the weight for the ith input variable observation (single-dimensional only). If wd is a rank-2 array of shape (m, m), then this is the full covariant weighting matrix broadcast to each observation. If wd is a rank-2 array of shape (m, n), then wd[:,i] is the diagonal of the covariant weighting matrix for the ith observation. If wd is a rank-3 array of shape (m, m, n), then wd[:,:,i] is the full specification of the covariant weighting matrix for each observation.

fixarray_like of ints, optional

The fix argument is the same as ifixx in the class ODR. It is an array of integers with the same shape as data.x that determines which input observations are treated as fixed. One can use a sequence of length m (the dimensionality of the input observations) to fix some dimensions for all observations. A value of 0 fixes the observation, a value > 0 makes it free.

metadict, optional

Free-form dictionary for metadata.

Notes

Each argument is attached to the member of the instance of the same name. The structures of x and y are described in the Model class docstring. If y is an integer, then the Data instance can only be used to fit with implicit models where the dimensionality of the response is equal to the specified value of y.

The we argument weights the effect a deviation in the response variable has on the fit. The wd argument weights the effect a deviation in the input variable has on the fit. To handle multidimensional inputs and responses easily, the structure of these arguments has the n’th dimensional axis first. These arguments heavily use the structured arguments feature of ODRPACK to conveniently and flexibly support all options. See the ODRPACK User’s Guide for a full explanation of how these weights are used in the algorithm. Basically, a higher value of the weight for a particular data point makes a deviation at that point more detrimental to the fit.

Methods

set_meta(**kwds)

Update the metadata dictionary with the keywords and data provided by keywords.