'Retrieve initial probabilities'

def initial_probabilities(self, params, regime_transition=None):

    params = np.array(params, ndmin=1)
    if (self._initialization == 'steady-state'):
        if (regime_transition is None):
            regime_transition = self.regime_transition_matrix(params)
        if (regime_transition.ndim == 3):
            regime_transition = regime_transition[..., 0]
        m = regime_transition.shape[0]
        A = np.c_[((np.eye(m) - regime_transition).T, np.ones(m))].T
        try:
            probabilities = np.linalg.pinv(A)[:, (-1)]
        except np.linalg.LinAlgError:
            raise RuntimeError('Steady-state    probabilities    could    not    be    constructed.')
    elif (self._initialization == 'known'):
        probabilities = self._initial_probabilities
    else:
        raise RuntimeError('Invalid    initialization    method    selected.')
    return probabilities
