Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
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)
Exemplo n.º 10
0
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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)