Module vickrey.functions
Functions used to approximate real data.
Functions
def comp_hyp(a, b, c, p, off)
-
Expand source code
def comp_hyp(a, b, c, p, off): """Piecewise defined approximating function.""" bs = _poly_coeffs(a, b, c, p) def inner_func(x): return ( jnp.piecewise( x, [x < p[0], x > p[1]], [ _left_hyp(a), _right_hyp(c), lambda x: jnp.polyval(jnp.flip(bs), x), ], ) + off ) return inner_func
Piecewise defined approximating function.
def gennorm(x, beta, mu, sigma)
-
Expand source code
def gennorm(x, beta, mu, sigma): """JAX implementation of an unscaled generalized normal pdf.""" def pdf_unscaled(x, b): return jnp.exp(-(jnp.abs(x) ** b)) y = (x - mu) / sigma return pdf_unscaled(y, beta) / sigma
JAX implementation of an unscaled generalized normal pdf.
def skewgennorm_fake(x, a, beta, mu, sigma)
-
Expand source code
def skewgennorm_fake(x, a, beta, mu, sigma): """Function with the properties of generalized and skewed normal pdf.""" y = (x - mu) / sigma gen = gennorm(y, beta, 0, 1) log = logistic(a * y) return 2 * gen * log / sigma
Function with the properties of generalized and skewed normal pdf.
def skewnorm(x, a, mu, sigma)
-
Expand source code
def skewnorm(x, a, mu, sigma): """Faster function similar to an unscaled skewed norm pdf.""" def pdf_unscaled(x): return 2 * jnp.exp(-(x**2)) * logistic(a * x) y = (x - mu) / sigma return pdf_unscaled(y) / sigma
Faster function similar to an unscaled skewed norm pdf.