def _initial_guess(self, countsmat):
        """Generate an initial guess for \theta.
        """

        if self.theta_ is not None:
            return self.theta_

        if self.guess == 'log':
            transmat, pi = _transmat_mle_prinz(countsmat)
            K = np.real(scipy.linalg.logm(transmat)) / self.lag_time

        elif self.guess == 'pseudo':
            transmat, pi = _transmat_mle_prinz(countsmat)
            K = (transmat - np.eye(self.n_states_)) / self.lag_time

        elif isinstance(self.guess, np.ndarray):
            pi = _solve_ratemat_eigensystem(self.guess)[1][:, 0]
            K = self.guess

        S = np.multiply(np.sqrt(np.outer(pi, 1/pi)), K)
        sflat = np.maximum(S[np.triu_indices_from(countsmat, k=1)], 0)
        theta0 = np.concatenate((sflat, np.log(pi)))
        return theta0
def _initial_guess ( self , countsmat ) : if self . theta_ is not None : return self . theta_ if self . guess == 'log' : transmat , pi = _transmat_mle_prinz ( countsmat ) K = np . real ( scipy . linalg . logm ( transmat ) ) / self . lag_time elif self . guess == 'pseudo' : transmat , pi = _transmat_mle_prinz ( countsmat ) K = ( transmat - np . eye ( self . n_states_ ) ) / self . lag_time elif isinstance ( self . guess , np . ndarray ) : pi = _solve_ratemat_eigensystem ( self . guess ) [ 1 ] [ : , 0 ] K = self . guess S = np . multiply ( np . sqrt ( np . outer ( pi , 1 / pi ) ) , K ) sflat = np . maximum ( S [ np . triu_indices_from ( countsmat , k = 1 ) ] , 0 ) theta0 = np . concatenate ( ( sflat , np . log ( pi ) ) ) return theta0
Generate an initial guess for \theta.