Ejemplo n.º 1
0
    def __init__(self, N, B,
                 mu=0.0, sigma=1.0,
                 mu_self=None, sigma_self=None,
                 **kwargs):
        super(_FixedWeightsMixin, self).__init__(N, B)
        self._mu = expand_scalar(mu, (N, N, B))
        self._sigma = expand_cov(mu, (N, N, B, B))

        if (mu_self is not None) and (sigma_self is not None):
            self._mu[np.arange(N), np.arange(N), :] = expand_scalar(mu_self, (N, B))
            self._sigma[np.arange(N), np.arange(N), :] = expand_cov(sigma_self, (N, B, B))
Ejemplo n.º 2
0
    def __init__(self, N, B,
                 mu_0=0.0, sigma_0=1.0, kappa_0=1.0, nu_0=3.0,
                 is_diagonal_weight_special=True,
                 **kwargs):
        super(_IndependentGaussianMixin, self).__init__(N, B)

        mu_0 = expand_scalar(mu_0, (B,))
        sigma_0 = expand_cov(sigma_0, (B,B))
        self._gaussian = Gaussian(mu_0=mu_0, sigma_0=sigma_0, kappa_0=kappa_0, nu_0=max(nu_0, B+2.))

        self.is_diagonal_weight_special = is_diagonal_weight_special
        if is_diagonal_weight_special:
            self._self_gaussian = \
                Gaussian(mu_0=mu_0, sigma_0=sigma_0, kappa_0=kappa_0, nu_0=nu_0)
Ejemplo n.º 3
0
    def __init__(self,
                 T,
                 N,
                 B,
                 mu=0.0,
                 sigma=0.001,
                 mu_self=None,
                 sigma_self=None,
                 **kwargs):
        super(_FixedWeightsMixin, self).__init__(T, N, B)
        self._mu = expand_scalar(mu, (N, T, N, B))
        self._sigma = expand_cov(sigma, (N, T, N, B, B))

        # initialize sigma
        self._sigma[0, :, 0, :, :] = 0.001
        self._sigma[1, :, 1, :, :] = 0.001
        self._sigma[1, :, 0, :, :] = 0.001
        self._sigma[0, :, 1, :, :] = 0.001

        if (mu_self is not None) and (sigma_self is not None):
            self._mu[np.arange(N), :,
                     np.arange(N), :] = expand_scalar(mu_self, (N, T, B))
            self._sigma[np.arange(N), :,
                        np.arange(N), :] = expand_cov(sigma_self, (N, T, B, B))
Ejemplo n.º 4
0
 def S_b(self, value):
     assert np.isscalar(value)
     self._S_b = expand_cov(value, (1, 1))
Ejemplo n.º 5
0
 def S_w(self, value):
     N, B = self.N, self.B
     self._S_w = expand_cov(value, (N, B, B))
Ejemplo n.º 6
0
 def S_b(self, value):
     assert np.isscalar(value)
     self._S_b = expand_cov(value, (1, 1))
Ejemplo n.º 7
0
 def S_w(self, value):
     N, B = self.N, self.B
     self._S_w = expand_cov(value, (N, B, B))