algorithms.statistics.models.nlsmodel¶
Module: algorithms.statistics.models.nlsmodel
¶
Inheritance diagram for nipy.algorithms.statistics.models.nlsmodel
:

Non-linear least squares model
NLSModel
¶
-
class
nipy.algorithms.statistics.models.nlsmodel.
NLSModel
(Y, design, f, grad, theta, niter=10)¶ Bases:
nipy.algorithms.statistics.models.model.Model
,object
Class representing a simple nonlinear least squares model.
-
__init__
(Y, design, f, grad, theta, niter=10)¶ Initialize non-linear model instance
- Parameters
- Yndarray
the data in the NLS model
- designndarray
the design matrix, X
- fcallable
the map between the (linear parameters (in the design matrix) and the nonlinear parameters (theta)) and the predicted data. f accepts the design matrix and the parameters (theta) as input, and returns the predicted data at that design.
- gradcallable
the gradient of f, this should be a function of an nxp design matrix X and qx1 vector theta that returns an nxq matrix df_i/dtheta_j where:
\[f_i(theta) = f(X[i], theta)\]is the nonlinear response function for the i-th instance in the model.
- thetaarray
parameters
- niterint
number of iterations
-
SSE
()¶ Sum of squares error.
- Returns
- sse: float
sum of squared residuals
-
fit
()¶ Fit a model to data.
-
getZ
()¶ Set Z into self
- Returns
- None
-
getomega
()¶ Set omega into self
- Returns
- None
-
initialize
()¶ Initialize (possibly re-initialize) a Model instance.
For instance, the design matrix of a linear model may change and some things must be recomputed.
-
predict
(design=None)¶ Get predicted values for design or
self.design
- Parameters
- designNone or array, optional
design at which to predict data. If None (the default) then use the initial
self.design
- Returns
- y_predictedarray
predicted data at given (or initial) design
-