def fit(self, X):
        """Compute the Robust Shared Response Model

        Parameters
        ----------

        X : list of 2D arrays, element i has shape=[voxels_i, timepoints]
            Each element in the list contains the fMRI data of one subject.
        """
        logger.info('Starting RSRM')

        # Check that the regularizer value is positive
        if 0.0 >= self.lam:
            raise ValueError("Gamma parameter should be positive.")

        # Check the number of subjects
        if len(X) <= 1:
            raise ValueError("There are not enough subjects in the input "
                             "data to train the model.")

        # Check for input data sizes
        if X[0].shape[1] < self.features:
            raise ValueError(
                "There are not enough timepoints to train the model with "
                "{0:d} features.".format(self.features))

        # Check if all subjects have same number of TRs for alignment
        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 alignment timepoints "
                                 "between subjects.")

        # Create a new random state
        self.random_state_ = np.random.RandomState(self.rand_seed)

        # Run RSRM
        self.w_, self.r_, self.s_ = self._rsrm(X)

        return self
def fit ( self , X ) : logger . info ( 'Starting RSRM' ) if 0.0 >= self . lam : raise ValueError ( "Gamma parameter should be positive." ) if len ( X ) <= 1 : raise ValueError ( "There are not enough subjects in the input " "data to train the model." ) if X [ 0 ] . shape [ 1 ] < self . features : raise ValueError ( "There are not enough timepoints to train the model with " "{0:d} features." . format ( self . features ) ) 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 alignment timepoints " "between subjects." ) self . random_state_ = np . random . RandomState ( self . rand_seed ) self . w_ , self . r_ , self . s_ = self . _rsrm ( X ) return self
Compute the Robust Shared Response Model

        Parameters
        ----------

        X : list of 2D arrays, element i has shape=[voxels_i, timepoints]
            Each element in the list contains the fMRI data of one subject.