コード例 #1
0
 def __init__(self, hypos):
     Suite.__init__(self)
     for hypo in hypos:
         if(hypo == 'No_Cancer'):
             self.Set(hypo, .99)
         else:
             self.Set(hypo, .01)
コード例 #2
0
 def __init__(self, inferred_goal, hypotheses, actions, \
              prob_non_compliance=0.1, prob_viol_detection=0.5, \
              prob_sanctioning=0.2, prob_random_punishment=0.01, \
              name=''):
     Suite.__init__(self, hypotheses, name)
     self.initial_hypotheses = hypotheses  # Keep the initial hypotheses to allow later reinitilization
     self.inferred_goal = inferred_goal
     self.actions = actions
     self.nodes = {node for action in actions for node in action.path}
     self.prob_non_compliance = prob_non_compliance
     self.prob_viol_detection = prob_viol_detection
     self.prob_sanctioning = prob_sanctioning
     self.prob_random_punishment = prob_random_punishment
     self.SetGoal(inferred_goal)
コード例 #3
0
    def __init__(self, prior_type='uniform'):
        Suite.__init__(self)
        rangemin, rangemax = 0, 101
        if prior_type == 'uniform':
            priors = map(lambda x: (x, 1), range(rangemin, rangemax))
        elif prior_type == 'triangle':
            rangemid = ceil((rangemin + rangemax) / 2)
            priors = map(
                lambda x: (x, x) if x < rangemid else (x, rangemax - x),
                range(rangemin, rangemax))

        for val, prob in priors:
            self.Set(val, prob)
        self.Normalize()
コード例 #4
0
 def __init__(self,
              inferred_goal,
              hypotheses,
              actions,
              prob_non_compliance=0.1,
              name=''):
     Suite.__init__(self, hypotheses, name)
     self.inferred_goal = inferred_goal
     self.actions = actions
     self.prob_non_compliance = prob_non_compliance
     if planned(inferred_goal, actions):
         self.plans = flattened_plan_tree(inferred_goal)
     else:
         print "Error: Failed to find any plans for %s given actions %s" % (
             inferred_goal, actions)
コード例 #5
0
 def __init__(self, hypos):
     Suite.__init__(self)
コード例 #6
0
 def __init__ (self, hypos, alpha = 1.0):
     Suite.__init__(self)
     for hypo in hypos:
         self.Set(hypo, hypo ** (-alpha))
     self.Normalize()
コード例 #7
0
ファイル: stoq.py プロジェクト: itoufo/stoq-simulation
 def __init__(self):
     Suite.__init__(self, xrange(0, 101))
     # for x in xrange(1, 101):
     #     self.Set(x, 1)
     # self.Normalize()
     self.real_val = thinkbayes.Beta().Random()