class_docstr: Class representing a simple nonlinear least squares model.
docstr: Initialize non-linear model instance
  
  Parameters
  ----------
  Y : ndarray
      the data in the NLS model
  design : ndarray
      the design matrix, X
  f : callable
      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.
  grad : callable
      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:
  
      .. math::
  
          f_i(theta) = f(X[i], theta)
  
      is the nonlinear response function for the i-th instance in
      the model.
  theta : array
      parameters
  niter : int
      number of iterations
docstr_tok: ["Initialize","non-linear","model","instance","Parameters","--","--","--","--","--","Y",":","ndarray","the","data","in","the","NLS","model","design",":","ndarray","the","design","matrix",",","X","f",":","callable","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",".","grad",":","callable","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",":","..","math",":",":","f_i","(","theta",")","=","f","(","X","[","i","]",",","theta",")","is","the","nonlinear","response","function","for","the","i-th","instance","in","the","model",".","theta",":","array","parameters","niter",":","int","number","of","iterations"]
code: def __init__(self, Y, design, f, grad, theta, niter=10):
      """Initialize non-linear model instance
  
      Parameters
      ----------
      Y : ndarray
          the data in the NLS model
      design : ndarray
          the design matrix, X
      f : callable
          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.
      grad : callable
          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:
  
          .. math::
  
              f_i(theta) = f(X[i], theta)
  
          is the nonlinear response function for the i-th instance in
          the model.
      theta : array
          parameters
      niter : int
          number of iterations
      """
      Model.__init__(self)
      self.Y = Y
      self.design = design
      self.f = f
      self.grad = grad
      self.theta = theta
      self.niter = niter
      if self.design is not None and self.Y is not None:
          if self.Y.shape[0] != self.design.shape[0]:
              raise ValueError("Y should be same shape as design")
  
file_path: nipy/nipy/algorithms/statistics/models/nlsmodel.py
imports: import numpy
  import numpy.linalg
  from .model import Model
label_desc: Use image node_id 1 to create a new NLSModel object from inherited base classes: Model with example: obj = NLSModel(Y, design, f, grad, theta, niter)