class_docstr: Deformable point cloud registration.
  
  Attributes
  ----------
  X: numpy array
      NxD array of target points.
  
  Y: numpy array
      MxD array of source points.
  
  TY: numpy array
      MxD array of transformed source points.
  
  sigma2: float (positive)
      Initial variance of the Gaussian mixture model.
  
  N: int
      Number of target points.
  
  M: int
      Number of source points.
  
  D: int
      Dimensionality of source and target points
  
  iteration: int
      The current iteration throughout registration.
  
  max_iterations: int
      Registration will terminate once the algorithm has taken this
      many iterations.
  
  tolerance: float (positive)
      Registration will terminate once the difference between
      consecutive objective function values falls within this tolerance.
  
  w: float (between 0 and 1)
      Contribution of the uniform distribution to account for outliers.
      Valid values span 0 (inclusive) and 1 (exclusive).
  
  q: float
      The objective function value that represents the misalignment between
      source and target point clouds.
  
  diff: float (positive)
      The absolute difference between the current and previous objective
      function values.
  
  P: numpy array
      MxN array of probabilities.
      P[m, n] represents the probability that the m-th source point
      corresponds to the n-th target point.
  
  Pt1: numpy array
      Nx1 column array. Multiplication result between the transpose of P
      and a column vector of all 1s.
  
  P1: numpy array
      Mx1 column array.
      Multiplication result between P and a column vector of all 1s.
  
  Np: float (positive)
      The sum of all elements in P.
  
  alpha: float (positive)
      Represents the trade-off between the goodness of maximum likelihoo
      fit and regularization.
  
  beta: float(positive)
      Width of the Gaussian kernel.
  
  low_rank: bool
      Whether to use low rank approximation.
  
  num_eig: int
      Number of eigenvectors to use in lowrank calculation.
class_docstr_tok: ["Deformable","point","cloud","registration",".","Attributes","--","--","--","--","--","X",":","numpy","array","NxD","array","of","target","points",".","Y",":","numpy","array","MxD","array","of","source","points",".","TY",":","numpy","array","MxD","array","of","transformed","source","points",".","sigma2",":","float","(","positive",")","Initial","variance","of","the","Gaussian","mixture","model",".","N",":","int","Number","of","target","points",".","M",":","int","Number","of","source","points",".","D",":","int","Dimensionality","of","source","and","target","points","iteration",":","int","The","current","iteration","throughout","registration",".","max_iterations",":","int","Registration","will","terminate","once","the","algorithm","has","taken","this","many","iterations",".","tolerance",":","float","(","positive",")","Registration","will","terminate","once","the","difference","between","consecutive","objective","function","values","falls","within","this","tolerance",".","w",":","float","(","between","0","and","1",")","Contribution","of","the","uniform","distribution","to","account","for","outliers",".","Valid","values","span","0","(","inclusive",")","and","1","(","exclusive",")",".","q",":","float","The","objective","function","value","that","represents","the","misalignment","between","source","and","target","point","clouds",".","diff",":","float","(","positive",")","The","absolute","difference","between","the","current","and","previous","objective","function","values",".","P",":","numpy","array","MxN","array","of","probabilities",".","P","[","m",",","n","]","represents","the","probability","that","the","m-th","source","point","corresponds","to","the","n-th","target","point",".","Pt1",":","numpy","array","Nx1","column","array",".","Multiplication","result","between","the","transpose","of","P","and","a","column","vector","of","all","1s",".","P1",":","numpy","array","Mx1","column","array",".","Multiplication","result","between","P","and","a","column","vector","of","all","1s",".","Np",":","float","(","positive",")","The","sum","of","all","elements","in","P.","alpha",":","float","(","positive",")","Represents","the","trade-off","between","the","goodness","of","maximum","likelihoo","fit","and","regularization",".","beta",":","float","(","positive",")","Width","of","the","Gaussian","kernel",".","low_rank",":","bool","Whether","to","use","low","rank","approximation",".","num_eig",":","int","Number","of","eigenvectors","to","use","in","lowrank","calculation","."]
docstr: Update the variance of the mixture model.
  
  This is using the new estimate of the deformable transformation.
  See the update rule for sigma2 in
  Eq. 23 of of https://arxiv.org/pdf/0905.2635.pdf.
docstr_tok: ["Update","the","variance","of","the","mixture","model",".","This","is","using","the","new","estimate","of","the","deformable","transformation",".","See","the","update","rule","for","sigma2","in","Eq",".","23","of","of","https",":","\/\/arxiv.org\/pdf\/0905.2635.pdf","."]
code: def update_variance(self):
      """Update the variance of the mixture model.
  
      This is using the new estimate of the deformable transformation.
      See the update rule for sigma2 in
      Eq. 23 of of https://arxiv.org/pdf/0905.2635.pdf.
  
      """
      qprev = self.sigma2
  
      # The original CPD paper does not explicitly calculate the objective
      # functional. This functional will include terms from both the negative
      # log-likelihood and the Gaussian kernel used for regularization.
      self.q = np.inf
  
      xPx = np.dot(
          np.transpose(self.Pt1),
          np.sum(np.multiply(self.X, self.X), axis=1),
      )
      yPy = np.dot(
          np.transpose(self.P1),
          np.sum(np.multiply(self.TY, self.TY), axis=1),
      )
      trPXY = np.sum(np.multiply(self.TY, self.PX))
  
      self.sigma2 = (xPx - 2 * trPXY + yPy) / (self.Np * self.D)
  
      if self.sigma2 <= 0:
          self.sigma2 = self.tolerance / 10
  
      # Here we use the difference between the current and previous
      # estimate of the variance as a proxy to test for convergence.
      self.diff = np.abs(self.sigma2 - qprev)
  
file_path: dipy/dipy/align/cpd.py
imports: import numpy
  import numbers
  from warnings import warn
label_desc: Use image node_id 5 for calling the DeformableRegistration obj's underlying member method code with example usage: obj.update_variance() without return types