當前位置: 首頁>>代碼示例>>Python>>正文


Python LOTHypothesis.LOTHypothesis類代碼示例

本文整理匯總了Python中LOTlib.Hypotheses.LOTHypothesis.LOTHypothesis的典型用法代碼示例。如果您正苦於以下問題:Python LOTHypothesis類的具體用法?Python LOTHypothesis怎麽用?Python LOTHypothesis使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了LOTHypothesis類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

    def __init__(self, constant_sd=1.0, fit_only_once=True, **kwargs):
        """
        :param constant_sd: The SD of our constants in the prior
        :param fit_only_once: Do we fit multiple times or just take the first?
        """
        LOTHypothesis.__init__(self, grammar, display='lambda x,'+','.join(CONSTANT_NAMES)+": %s", **kwargs)

        self.constant_sd=constant_sd # also the prior SD
        self.parameters = self.sample_constants()
        self.fit_only_once = fit_only_once
開發者ID:joshrule,項目名稱:LOTlib,代碼行數:10,代碼來源:Model.py

示例2: __call__

 def __call__(self, *vals):
     """
         Must overwrite call in order to include the constants
     """
     vals = list(vals)
     vals.extend(self.CONSTANT_VALUES)
     return LOTHypothesis.__call__(self, *vals)
開發者ID:ebigelow,項目名稱:LOTlib,代碼行數:7,代碼來源:Hypothesis.py

示例3: __call__

 def __call__(self, *vals):
     """
         Must overwrite call in order to include the constants
     """
     vals = list(vals)
     vals.extend(self.parameters)
     return LOTHypothesis.__call__(self, *vals)
開發者ID:joshrule,項目名稱:LOTlib,代碼行數:7,代碼來源:Model.py

示例4: __call__

    def __call__(self, *args, **kwargs):
        # we have to mod this to insert the spaces since they aren't part of cons above
        ret = LOTHypothesis.__call__(self, *args, **kwargs)

        out = dict()
        for k, v in ret.items():
            out[" ".join(k)] = v
        return out
開發者ID:piantado,項目名稱:LOTlib,代碼行數:8,代碼來源:Model.py

示例5: prior_sample

def prior_sample(h0, data, N):
	"""
		Just use the grammar and returntype of h0 to sample from the prior
		NOTE: Only implemented for LOTHypothesis
	"""
	assert isinstance(h0, LOTHypothesis)
	
	# extract from the grammar
	G = h0.grammar 
	rt = h0.value.returntype
	
	for i in xrange(N):
		if LOTlib.SIG_INTERRUPTED: break
	
		h = LOTHypothesis(G, start=rt)
		h.compute_posterior(data)
		
		yield h
開發者ID:gamahead,項目名稱:LOTlib,代碼行數:18,代碼來源:PriorSample.py

示例6: __call__

    def __call__(self, *args, **kwargs):
        if self.value_set is None:
            value_set = LOTHypothesis.__call__(self)
            # Restrict our concept to being within our domain; also handle 'None' call values
            if isinstance(value_set, set):
                value_set = [x for x in value_set if x <= self.domain]
            else:
                value_set = []
            self.value_set = value_set

        return self.value_set
開發者ID:moverlan,項目名稱:LOTlib,代碼行數:11,代碼來源:Hypothesis.py

示例7: __call__

    def __call__(self, *args, **kwargs):
        # Sometimes self.value has too many nodes
        try:
            value_set = LOTHypothesis.__call__(self)
        except TooBigException:
            value_set = set()

        if isinstance(value_set, set):
            # Restrict our concept to being within our domain
            value_set = [x for x in value_set if (1 <= x <= self.domain)]
        else:
            # Sometimes self() returns None
            value_set = set()

        return value_set
開發者ID:joshrule,項目名稱:LOTlib,代碼行數:15,代碼來源:Model.py

示例8: __init__

 def __init__(self, grammar, alpha=0.9, domain=100, **kwargs):
     LOTHypothesis.__init__(self, grammar, args=[], **kwargs)
     self.alpha = alpha
     self.domain = domain
開發者ID:moverlan,項目名稱:LOTlib,代碼行數:4,代碼來源:Hypothesis.py

示例9: __init__

 def __init__(self, *args, **kwargs ):
     LOTHypothesis.__init__(self, grammar, display='lambda x,y: %s', **kwargs)
     super(CRHypothesis, self).__init__(*args, **kwargs)
開發者ID:piantado,項目名稱:LOTlib,代碼行數:3,代碼來源:MixtureProposer.py

示例10: __init__

 def __init__(self, ALPHA=0.9, **kwargs):
     LOTHypothesis.__init__(self, grammar, **kwargs)
     self.ALPHA = ALPHA
開發者ID:ebigelow,項目名稱:LOTlib,代碼行數:3,代碼來源:Hypothesis.py

示例11: __init__

 def __init__(self, grammar=grammar, **kwargs):
     LOTHypothesis.__init__(self, grammar, display='lambda C : %s', maxnodes=200, **kwargs)
     # self.outlier = -100 # for MultinomialLikelihoodLog
     self.alphabet_size = len(TERMINALS)
開發者ID:piantado,項目名稱:LOTlib,代碼行數:4,代碼來源:Model.py

示例12: __init__

 def __init__(self, value=None, alpha=0.99, baserate=0.5):
     LOTHypothesis.__init__(self, grammar, value=value, display='lambda S, x: %s', alpha=alpha, baserate=baserate)
開發者ID:joshrule,項目名稱:LOTlib,代碼行數:2,代碼來源:Hypothesis.py

示例13: __init__

 def __init__(self, **kwargs):
     LOTHypothesis.__init__(self, grammar, **kwargs)
開發者ID:wrongu,項目名稱:LOTlib,代碼行數:2,代碼來源:Model.py

示例14: __init__

 def __init__(self, **kwargs ):
     LOTHypothesis.__init__(self, grammar, args=['x', 'y'], **kwargs)
開發者ID:wrongu,項目名稱:LOTlib,代碼行數:2,代碼來源:Simple.py

示例15: compute_prior

 def compute_prior(self):
     # Add together the LOT prior and the constant prior, here just a gaussian
     return LOTHypothesis.compute_prior(self) +\
            sum(map(lambda x: normlogpdf(x,0.0,self.constant_sd), self.parameters))
開發者ID:joshrule,項目名稱:LOTlib,代碼行數:4,代碼來源:Model.py


注:本文中的LOTlib.Hypotheses.LOTHypothesis.LOTHypothesis類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。