15.12.2012 Views

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SciPy Reference Guide, Release 0.8.dev<br />

Methods<br />

fix – fix is the same as ifixx in the class ODR. It is an array of integers<br />

with the same shape as data.x that determines which input observations are treated as fixed.<br />

One can use a sequence of length m (the dimensionality of the input observations) to fix some<br />

dimensions for all observations. A value of 0 fixes the observation, a value > 0 makes it free.<br />

meta – optional, freeform dictionary for metadata<br />

set_meta(**kwds) Update the metadata dictionary with the keywords and data provided<br />

set_meta(**kwds)<br />

Update the metadata dictionary with the keywords and data provided by keywords.<br />

class Model(fcn, fjacb=None, fjacd=None, extra_args=None, estimate=None, implicit=0, meta=None)<br />

The Model class stores information about the function you wish to fit.<br />

It stores the function itself, at the least, and optionally stores functions which compute the Jacobians used<br />

during fitting. Also, one can provide a function that will provide reasonable starting values for the fit parameters<br />

possibly given the set of data.<br />

The initialization method stores these into members of the same name.<br />

fcn – fit function: fcn(beta, x) –> y<br />

fjacb – Jacobian of fcn wrt the fit parameters beta:<br />

fjacb(beta, x) –> @f_i(x,B)/@B_j<br />

fjacd – Jacobian of fcn wrt the (possibly multidimensional) input variable:<br />

fjacd(beta, x) –> @f_i(x,B)/@x_j<br />

extra_args – if specified, extra_args should be a tuple of extra<br />

arguments to pass to fcn, fjacb, and fjacd. Each will be called like the following: apply(fcn,<br />

(beta, x) + extra_args)<br />

estimate – provide estimates of the fit parameters from the data:<br />

estimate(data) –> estbeta<br />

implicit – boolean variable which, if TRUE, specifies that the model<br />

is implicit; i.e fcn(beta, x) ~= 0 and there is no y data to fit against.<br />

meta – an optional, freeform dictionary of metadata for the model<br />

Note that the fcn, fjacb, and fjacd operate on NumPy arrays and return a NumPy array. estimate takes an instance<br />

of the Data class.<br />

Here are the rules for the shapes of the argument and return arrays:<br />

x – if the input data is single-dimensional, then x is rank-1<br />

array; i.e. x = array([1, 2, 3, ...]); x.shape = (n,) If the input data is multi-dimensional, then x<br />

is a rank-2 array; i.e. x = array([[1, 2, ...], [2, 4, ...]]); x.shape = (m, n) In all cases, it has the<br />

same shape as the input data array passed to odr(). m is the dimensionality of the input data,<br />

n is the number of observations.<br />

y – if the response variable is single-dimensional, then y is a rank-1<br />

array; i.e. y = array([2, 4, ...]); y.shape = (n,) If the response variable is multi-dimensional,<br />

then y is a rank-2 array; i.e. y = array([[2, 4, ...], [3, 6, ...]]); y.shape = (q, n) where q is the<br />

dimensionality of the response variable.<br />

beta – rank-1 array of length p where p is the number of parameters;<br />

i.e. beta = array([B_1, B_2, ..., B_p])<br />

292 Chapter 3. Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!