class_docstr: Probabilistic Shared Response Model (SRM)
  
  Given multi-subject data, factorize it as a shared response S among all
  subjects and an orthogonal transform W per subject:
  
  .. math:: X_i \approx W_i S, \forall i=1 \dots N
  
  Parameters
  ----------
  
  n_iter : int, default: 10
      Number of iterations to run the algorithm.
  
  features : int, default: 50
      Number of features to compute.
  
  rand_seed : int, default: 0
      Seed for initializing the random number generator.
  
  
  Attributes
  ----------
  
  w_ : list of array, element i has shape=[voxels_i, features]
      The orthogonal transforms (mappings) for each subject.
  
  s_ : array, shape=[features, samples]
      The shared response.
  
  sigma_s_ : array, shape=[features, features]
      The covariance of the shared response Normal distribution.
  
  mu_ : list of array, element i has shape=[voxels_i]
      The voxel means over the samples for each subject.
  
  rho2_ : array, shape=[subjects]
      The estimated noise variance :math:`\rho_i^2` for each subject
  
  
  Note
  ----
  
     The number of voxels may be different between subjects. However, the
     number of samples must be the same across subjects.
  
     The probabilistic Shared Response Model is approximated using the
     Expectation Maximization (EM) algorithm proposed in [Chen2015]_. The
     implementation follows the optimizations published in [Anderson2016]_.
  
     This is a single node version.
  
     The run-time complexity is :math:`O(I (V T K + V K^2 + K^3))` and the
     memory complexity is :math:`O(V T)` with I - the number of iterations,
     V - the sum of voxels from all subjects, T - the number of samples, and
     K - the number of features (typically, :math:`V \gg T \gg K`).
class_docstr_tok: ["Probabilistic","Shared","Response","Model","(","SRM",")","Given","multi-subject","data",",","factorize","it","as","a","shared","response","S","among","all","subjects","and","an","orthogonal","transform","W","per","subject",":","..","math",":",":","X_i","\\approx","W_i","S",",","\\forall","i=1","\\dots","N","Parameters","--","--","--","--","--","n_iter",":","int",",","default",":","10","Number","of","iterations","to","run","the","algorithm",".","features",":","int",",","default",":","50","Number","of","features","to","compute",".","rand_seed",":","int",",","default",":","0","Seed","for","initializing","the","random","number","generator",".","Attributes","--","--","--","--","--","w_",":","list","of","array",",","element","i","has","shape=","[","voxels_i",",","features","]","The","orthogonal","transforms","(","mappings",")","for","each","subject",".","s_",":","array",",","shape=","[","features",",","samples","]","The","shared","response",".","sigma_s_",":","array",",","shape=","[","features",",","features","]","The","covariance","of","the","shared","response","Normal","distribution",".","mu_",":","list","of","array",",","element","i","has","shape=","[","voxels_i","]","The","voxel","means","over","the","samples","for","each","subject",".","rho2_",":","array",",","shape=","[","subjects","]","The","estimated","noise","variance",":","math",":","`","\\rho_i^2","`","for","each","subject","Note","--","--","The","number","of","voxels","may","be","different","between","subjects",".","However",",","the","number","of","samples","must","be","the","same","across","subjects",".","The","probabilistic","Shared","Response","Model","is","approximated","using","the","Expectation","Maximization","(","EM",")","algorithm","proposed","in","[","Chen2015","]","_",".","The","implementation","follows","the","optimizations","published","in","[","Anderson2016","]","_",".","This","is","a","single","node","version",".","The","run-time","complexity","is",":","math",":","`","O","(","I","(","V","T","K","+","V","K^2","+","K^3",")",")","`","and","the","memory","complexity","is",":","math",":","`","O","(","V","T",")","`","with","I","-","the","number","of","iterations",",","V","-","the","sum","of","voxels","from","all","subjects",",","T","-","the","number","of","samples",",","and","K","-","the","number","of","features","(","typically",",",":","math",":","`","V","\\gg","T","\\gg","K","`",")","."]
docstr: Compute the probabilistic Shared Response Model
  
  Parameters
  ----------
  X :  list of 2D arrays, element i has shape=[voxels_i, samples]
      Each element in the list contains the fMRI data of one subject.
  
  y : not used
docstr_tok: ["Compute","the","probabilistic","Shared","Response","Model","Parameters","--","--","--","--","--","X",":","list","of","2D","arrays",",","element","i","has","shape=","[","voxels_i",",","samples","]","Each","element","in","the","list","contains","the","fMRI","data","of","one","subject",".","y",":","not","used"]
code: def fit(self, X, y=None):
      """Compute the probabilistic Shared Response Model
  
      Parameters
      ----------
      X :  list of 2D arrays, element i has shape=[voxels_i, samples]
          Each element in the list contains the fMRI data of one subject.
  
      y : not used
      """
      logger.info("Starting Probabilistic SRM")
  
      # Check the number of subjects
      if len(X) <= 1:
          raise ValueError(
              "There are not enough subjects "
              "({0:d}) to train the model.".format(len(X))
          )
  
      # Check for input data sizes
      if X[0].shape[1] < self.features:
          raise ValueError(
              "There are not enough samples to train the model with "
              "{0:d} features.".format(self.features)
          )
  
      # Check if all subjects have same number of TRs
      number_trs = X[0].shape[1]
      number_subjects = len(X)
      for subject in range(number_subjects):
          assert_all_finite(X[subject])
          if X[subject].shape[1] != number_trs:
              raise ValueError(
                  "Different number of samples between subjects" "."
              )
  
      # Run SRM
      self.sigma_s_, self.w_, self.mu_, self.rho2_, self.s_ = self._srm(
          X
      )
  
      return self
  
imports: import logging
  import numpy
  import scipy
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.utils import assert_all_finite
  from sklearn.utils.validation import NotFittedError
label_desc: Use image node_id 2 for calling the SRM obj's underlying member method code with example usage: obj.fit(X, y) and returns: self