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)
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
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
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
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)
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)
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)
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)
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)
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)
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)
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)
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)