def __init__(self, grammar, hypotheses, H=None, C=None, L=None, R=None, **kwargs): GrammarHypothesis.__init__(self, grammar, hypotheses, **kwargs) if H is None: self.init_H() else: self.H = H if H is None: self.init_C() else: self.C = C self.L = L if L else {} self.R = R if R else {}
def run(): """Run demo""" '''Generate number game hypotheses''' #hypotheses = save_hypotheses(prior_sampler) hypotheses = load_hypotheses() print_top_hypotheses(hypotheses) '''What grammar probabilities will best model our human data?''' grammar_h0 = GrammarHypothesis(grammar, hypotheses, proposal_step=.1, proposal_n=1) '''print distribution over power rule: [prior, likelihood, posterior]''' vals, posteriors = grammar_h0.rule_distribution(data, 'ipowf_', np.arange(0.1, 5., 0.1)) print_dist(vals, posteriors) #visualize_dist(vals, posteriors, 'union_') '''grammar hypothesis inference'''
def __init__(self, value=None): self.concept2hypotheses = concept2hypotheses GrammarHypothesis.__init__(self, grammar, [], value=value)