Ejemplo n.º 1
0
 def log_likelihood(self, x, u):
     loglik = []
     for _x in x:
         _loglik = np.column_stack([
             multivariate_normal_logpdf(_x, self.mean(k), self.cov[k])
             for k in range(self.nb_states)
         ])
         loglik.append(_loglik)
     return loglik
Ejemplo n.º 2
0
 def log_likelihood(self, x, u):
     loglik = []
     for _x, _u in zip(x, u):
         _loglik = np.column_stack([
             multivariate_normal_logpdf(
                 _x[1:, :], self.mean(k, _x[:-1, :], _u[:-1, :self.dm_act]),
                 self.cov[k]) for k in range(self.nb_states)
         ])
         loglik.append(_loglik)
     return loglik
Ejemplo n.º 3
0
    def log_likelihood(self, x, u):
        loglik = []
        for _x, _u in zip(x, u):
            T = _x.shape[0]
            _loglik = np.zeros((T - 1, self.nb_states))
            for k in range(self.nb_states):
                _mu = self.mean(k, _x[:-1, :], _u[:-1, :self.dm_act])
                j = int(self.rot_lds[k, 1])
                i = int(self.rot_lds[k, 0])
                T_inv = self.T_inv[j, ...]
                T = self.T[j, ...]

                _mu = np.einsum('kh,...h->...k', T, _mu)
                _x_t = np.einsum('kh,...h->...k', T, _x[1:, :])
                #_x_t = _x[1:, :]
                _loglik[:, k] = multivariate_normal_logpdf(
                    _x_t, _mu, self.cov[i, ...])

            loglik.append(_loglik)
        return loglik