コード例 #1
0
ファイル: rv.py プロジェクト: phucson/MonteTheano
def lpdf(rv, sample, **kwargs):
    """
    Return the probability (density) that random variable `rv`, returned by
    a call to one of the sampling routines of this class takes value `sample`
    """
    if not is_rv(rv):
        raise TypeError('rv not recognized as a random variable', rv)

    if is_raw_rv(rv):
        dist_name = rstreams.rv_dist_name(rv)
        pdf = rstreams.pdfs[dist_name]
        return pdf(rv.owner, sample, kwargs)
    else:
        #TODO: infer from the ancestors of v what distribution it
        #      has.
        raise NotImplementedError(rv)
コード例 #2
0
ファイル: distributions.py プロジェクト: yamins81/MonteTheano
def normal_get_sigma(v):
    # look in uniform_sampler to see the positions of these things
    if v.owner and rv_dist_name(v) == "normal":
        return v.owner.inputs[3]
    raise TypeError
コード例 #3
0
ファイル: distributions.py プロジェクト: yamins81/MonteTheano
def uniform_get_high(v):
    # look in uniform_sampler to see the positions of these things
    if v.owner and rv_dist_name(v) == "uniform":
        return v.owner.inputs[3]
    raise TypeError
コード例 #4
0
ファイル: distributions.py プロジェクト: yamins81/MonteTheano
def qlognormal_get_round(v):
    # look in uniform_sampler to see the positions of these things
    if v.owner and rv_dist_name(v) == "quantized_lognormal":
        return v.owner.inputs[4]
    raise TypeError
コード例 #5
0
ファイル: distributions.py プロジェクト: gwtaylor/MonteTheano
def normal_get_sigma(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == "normal":
        return v.owner.inputs[3]
    raise ValueError("v is not a normal draw", v)
コード例 #6
0
ファイル: distributions.py プロジェクト: gwtaylor/MonteTheano
def uniform_get_high(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == "uniform":
        return v.owner.inputs[3]
    raise ValueError("v is not a uniform draw", v)
コード例 #7
0
ファイル: distributions.py プロジェクト: gwtaylor/MonteTheano
def quantized_lognormal_get_round(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == "quantized_lognormal":
        return v.owner.inputs[4]
    raise ValueError("v is not a quantized_lognormal draw", v)
コード例 #8
0
ファイル: distributions.py プロジェクト: helson73/MonteTheano
def quantized_lognormal_get_sigma(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == 'quantized_lognormal':
        return v.owner.inputs[3]
    raise ValueError('v is not a quantized_lognormal draw', v)
コード例 #9
0
ファイル: distributions.py プロジェクト: helson73/MonteTheano
def lognormal_get_mu(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == 'lognormal':
        return v.owner.inputs[2]
    raise ValueError('v is not a lognormal draw', v)
コード例 #10
0
ファイル: distributions.py プロジェクト: helson73/MonteTheano
def uniform_get_low(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == 'uniform':
        return v.owner.inputs[2]
    raise ValueError('v is not a uniform draw', v)
コード例 #11
0
def quantized_lognormal_get_round(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == 'quantized_lognormal':
        return v.owner.inputs[4]
    raise ValueError('v is not a quantized_lognormal draw', v)
コード例 #12
0
def lognormal_get_sigma(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == 'lognormal':
        return v.owner.inputs[3]
    raise ValueError('v is not a lognormal draw', v)
コード例 #13
0
def uniform_get_high(v):
    # look in uniform_sampler to see the positions of these things
    if rv_dist_name(v) == 'uniform':
        return v.owner.inputs[3]
    raise ValueError('v is not a uniform draw', v)