Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _pdf(self, x, dist, cache):
"""Probability density function."""
return evaluation.evaluate_density(
dist, numpy.sin(x), cache=cache)*numpy.cos(x)
def _pdf(self, x, dist, cache):
"""Probability density function."""
output = evaluation.evaluate_density(dist, numpy.arccos(x), cache=cache)
output /= numpy.where(numpy.isin(x, [-1, 1]), numpy.inf, numpy.sqrt(1-x*x))
return output
def _pdf(self, x, dist, cache):
return evaluation.evaluate_density(
dist, numpy.cos(x), cache=cache)*numpy.sin(x)
def _pdf(self, x, dist, cache):
"""Probability density function."""
return evaluation.evaluate_density(
dist, numpy.sinh(x), cache=cache)*numpy.cosh(1+x*x)
def _pdf(self, x, dist, cache):
"""Probability density function."""
return evaluation.evaluate_density(
dist, numpy.arctanh(x), cache=cache)/numpy.sqrt(1-x*x)
assert numpy.all(left > 0), "imaginary result"
x_ = numpy.where(xloc <= 0, -numpy.inf,
numpy.log(xloc + 1.*(xloc<=0))/numpy.log(left+1.*(left == 1)))
num_ = numpy.log(left+1.*(left == 1))*xloc
num_ = num_ + 1.*(num_==0)
out = evaluation.evaluate_density(right, x_, cache=cache)/num_
return out
x_ = numpy.sign(xloc)*numpy.abs(xloc)**(1./right -1)
xloc = numpy.sign(xloc)*numpy.abs(xloc)**(1./right)
pairs = numpy.sign(xloc**right) == 1
out = evaluation.evaluate_density(left, xloc, cache=cache)
if numpy.any(pairs):
out = out + pairs*evaluation.evaluate_density(left, -xloc, cache=cache)
out = numpy.sign(right)*out * x_ / right
out[numpy.isnan(out)] = numpy.inf
return out
def _pdf(self, xloc, dist, cache):
"""Probability density function."""
return evaluation.evaluate_density(
dist, 10**xloc, cache=cache)*10**xloc*numpy.log(10)
def _pdf(self, x, dist, cache):
return evaluation.evaluate_density(
dist, numpy.tan(x), cache=cache)*(1+numpy.tan(x)**2)
[ 0. 0. inf 0.]
"""
left = evaluation.get_forward_cache(left, cache)
right = evaluation.get_forward_cache(right, cache)
if isinstance(left, Dist):
if isinstance(right, Dist):
raise evaluation.DependencyError(
"under-defined distribution {} or {}".format(left, right))
elif not isinstance(right, Dist):
return numpy.inf
else:
left, right = right, left
xloc = (xloc.T-numpy.asfarray(right).T).T
output = evaluation.evaluate_density(left, xloc, cache=cache)
assert output.shape == xloc.shape
return output