Ejemplo n.º 1
0
 def p_object_given_feature(self,feature, priors):
     probability_object_is_feature_given_object = self.table_to_function()
     try:
         object_given_features=dist.bayesEvidence(priors, probability_object_is_feature_given_object, feature)
     except:
         print "feature: ",feature, " not found, will return prior"
         object_given_features = priors
     return object_given_features
Ejemplo n.º 2
0
    def getNextValues(self, state, inp):
        """
        @param state: Distribution over states of the subject machine,
        represented as a C{dist.Dist} object
        @param inp: A pair C{(o, i)} of the observation (output) and input 
        of the subject machine on this time step.
        """
        (o, i) = inp
        if self.model.sensorDisplayFun:
            self.model.sensorDisplayFun(o)

        sGo = dist.bayesEvidence(state, self.model.observationDistribution, o)

        if self.verbose:
            print "after obs", o, sGo

        dSPrime = dist.totalProbability(sGo, self.model.transitionDistribution(i))
        if self.verbose:
            print "after trans", i, dSPrime
        if self.model.beliefDisplayFun:
            self.model.beliefDisplayFun(dSPrime)

        return (dSPrime, dSPrime)
Ejemplo n.º 3
0
    def getNextValues(self, state, inp):
        """
        @param state: Distribution over states of the subject machine,
        represented as a C{dist.Dist} object
        @param inp: A pair C{(o, i)} of the observation (output) and input 
        of the subject machine on this time step.
        """
        (o, i) = inp
        if self.model.sensorDisplayFun:
            self.model.sensorDisplayFun(o)

        sGo = dist.bayesEvidence(state, self.model.observationDistribution, o)

        if self.verbose: 
            print 'after obs', o, sGo

        dSPrime = dist.totalProbability(sGo, 
                                        self.model.transitionDistribution(i))
        if self.verbose:
            print 'after trans', i, dSPrime
        if self.model.beliefDisplayFun:
            self.model.beliefDisplayFun(dSPrime)
            
        return (dSPrime, dSPrime)