Exemplo n.º 1
0
    def updateParams(self,
                     z,
                     As,
                     sigmas,
                     C,
                     R,
                     mu0,
                     sigma0,
                     u=None,
                     ys=None,
                     computeMarginal=True):

        self.parameterCheck(z, As, sigmas, C, R, mu0, sigma0, u=u, ys=ys)

        n1Trans, n2Trans, n3Trans = zip(*[
            Regression.standardToNat(A, sigma) for A, sigma in zip(As, sigmas)
        ])
        n1Emiss, n2Emiss, n3Emiss = Regression.standardToNat(C, R)
        n1Init, n2Init = Normal.standardToNat(mu0, sigma0)

        self.updateNatParams(z,
                             n1Trans,
                             n2Trans,
                             n3Trans,
                             n1Emiss,
                             n2Emiss,
                             n3Emiss,
                             n1Init,
                             n2Init,
                             u=u,
                             ys=ys,
                             computeMarginal=computeMarginal)
Exemplo n.º 2
0
    def updateParams( self, initialDist, transDist, mus, sigmas, ys=None, computeMarginal=True ):

        self.parameterCheck( initialDist, transDist, mus, sigmas, ys )

        nInit, = Categorical.standardToNat( initialDist )
        nTrans, = Transition.standardToNat( transDist )
        n1Emiss, n2Emiss = zip( *[ Normal.standardToNat( mu, sigma ) for mu, sigma in zip( mus, sigmas ) ] )

        self.updateNatParams( nInit, nTrans, n1Emiss, n2Emiss, ys=ys )
Exemplo n.º 3
0
    def updateParams( self, initialDist, transDist, mu0, sigma0, u, As, sigmas, xs=None, computeMarginal=True ):

        self.parameterCheck( initialDist, transDist, mu0, sigma0, u, As, sigmas, xs=xs )

        nInit, = Categorical.standardToNat( initialDist )
        nTrans, = Transition.standardToNat( transDist )
        nat1_0, nat2_0 = Normal.standardToNat( mu0, sigma0 )
        nat1Trans, nat2Trans, nat3Trans = zip( *[ Regression.standardToNat( A, sigma ) for A, sigma in zip( As, sigmas ) ] )

        self.updateNatParams( nInit, nTrans, nat1_0, nat2_0, nat1Trans, nat2Trans, nat3Trans, u=u, xs=xs )
Exemplo n.º 4
0
    def updateParams(self,
                     A,
                     sigma,
                     C,
                     R,
                     mu0,
                     sigma0,
                     u=None,
                     ys=None,
                     computeMarginal=True):

        self.parameterCheck(A, sigma, C, R, mu0, sigma0, u=u, ys=ys)

        n1Init, n2Init = Normal.standardToNat(mu0, sigma0)
        n1Emiss, n2Emiss, n3Emiss = Regression.standardToNat(C, R)
        n1Trans, n2Trans, n3Trans = Regression.standardToNat(A, sigma)

        self.updateNatParams(n1Trans,
                             n2Trans,
                             n3Trans,
                             n1Emiss,
                             n2Emiss,
                             n3Emiss,
                             n1Init,
                             n2Init,
                             u=u,
                             ys=ys,
                             computeMarginal=computeMarginal)

        self.fromNatural = False
        self._A = A
        self._sigma = sigma
        self._C = C
        self._R = R
        self._mu0 = mu0
        self._sigma0 = sigma0
Exemplo n.º 5
0
 def standardToNat( cls, A, sigma, C, R, mu0, sigma0 ):
     n1, n2, n3 = Regression.standardToNat( A, sigma )
     n4, n5, n6 = Regression.standardToNat( C, R )
     n7, n8 = Normal.standardToNat( mu0, sigma0 )
     return n1, n2, n3, n4, n5, n6, n7, n8