Exemplo n.º 1
0
    def __init__(self, *args, initialize=True, **kwargs):

        super().__init__(*args, dims=self.compute_dims(*args), **kwargs)

        # Natural parameters and moments. Note that the size of the
        # array self.u or self.phi doesn't actually need to equal
        # self.dims+self.plates, it will be broadcasted automatically
        # (although this might be extremely rare: it would mean that
        # there are identical posterior distributions over
        # plates). Anyway, for this reason (and some others), we need
        # to explicityly have the dimensionalities dims and plates? Do
        # we need dims? Yes, because you need to be able to check what
        # plates are missing.
        #self.phi = [np.array([]) for i in range(len(self.dims))]
        #self.u = [np.array([]) for i in range(len(self.dims))]
        #self.phi = [np.array(0.0) for i in range(len(self.dims))]
        #self.u = [np.array(0.0) for i in range(len(self.dims))]
        axes = len(self.plates) * (1, )
        self.phi = [utils.nans(axes + dim) for dim in self.dims]
        self.u = [utils.nans(axes + dim) for dim in self.dims]
        #        self.u = [np.array(0.0) for i in range(len(self.dims))]

        # Terms for the lower bound (G for latent and F for observed)
        self.g = 0
        self.f = 0

        # Not observed
        self.observed = False

        # By default, ignore all plates
        self.mask = False

        if initialize:
            self.initialize_from_prior()
Exemplo n.º 2
0
    def __init__(self, *args, initialize=True, **kwargs):

        super().__init__(*args, initialize=initialize, **kwargs)

        if not initialize:
            axes = len(self.plates) * (1, )
            self.phi = [utils.nans(axes + dim) for dim in self.dims]

        # Terms for the lower bound (G for latent and F for observed)
        self.g = np.array(0)
        self.f = np.array(0)
Exemplo n.º 3
0
    def __init__(self, *args, initialize=True, **kwargs):

        # Terms for the lower bound (G for latent and F for observed)
        self.g = np.array(np.nan)
        self.f = np.array(np.nan)

        super().__init__(*args, initialize=initialize, **kwargs)

        if not initialize:
            axes = len(self.plates) * (1,)
            self.phi = [utils.nans(axes + dim) for dim in self.dims]
Exemplo n.º 4
0
    def __init__(self, *args, initialize=True, **kwargs):

        super().__init__(*args, dims=self.compute_dims(*args), **kwargs)

        # Initialize moment array
        axes = len(self.plates) * (1, )
        self.u = [utils.nans(axes + dim) for dim in self.dims]

        # Not observed
        self.observed = False

        if initialize:
            self.initialize_from_prior()
Exemplo n.º 5
0
    def __init__(self, *args, initialize=True, **kwargs):

        super().__init__(*args, dims=self.compute_dims(*args), **kwargs)

        # Initialize moment array
        axes = len(self.plates) * (1,)
        self.u = [utils.nans(axes + dim) for dim in self.dims]

        # Not observed
        self.observed = False

        if initialize:
            self.initialize_from_prior()
Exemplo n.º 6
0
    def __init__(self, *args, initialize=True, **kwargs):

        super().__init__(*args,
                         dims=self.compute_dims(*args),
                         **kwargs)

        # Natural parameters and moments. Note that the size of the
        # array self.u or self.phi doesn't actually need to equal
        # self.dims+self.plates, it will be broadcasted automatically
        # (although this might be extremely rare: it would mean that
        # there are identical posterior distributions over
        # plates). Anyway, for this reason (and some others), we need
        # to explicityly have the dimensionalities dims and plates? Do
        # we need dims? Yes, because you need to be able to check what
        # plates are missing.
        #self.phi = [np.array([]) for i in range(len(self.dims))]
        #self.u = [np.array([]) for i in range(len(self.dims))]
        #self.phi = [np.array(0.0) for i in range(len(self.dims))]
        #self.u = [np.array(0.0) for i in range(len(self.dims))]
        axes = len(self.plates)*(1,)
        self.phi = [utils.nans(axes+dim) for dim in self.dims]
        self.u = [utils.nans(axes+dim) for dim in self.dims]
#        self.u = [np.array(0.0) for i in range(len(self.dims))]

        # Terms for the lower bound (G for latent and F for observed)
        self.g = 0
        self.f = 0

        # Not observed
        self.observed = False

        # By default, ignore all plates
        self.mask = False

        if initialize:
            self.initialize_from_prior()