Utilities
{{ task_disclaimer }}
utils ¶
Classes¶
Context ¶
Acts like a dictionary but allows for object-like attribute access while maintaining a history of key provenance for debugging and traceability.
Source code in calibrie/utils.py
Functions¶
color_from_filename ¶
Generate deterministic RGBA color from filename hash.
Source code in calibrie/utils.py
logb ¶
cubic_exp_fwd ¶
cubic polynomial that goes through (0,0) and has same first and second derivative as the log (in given base) at the threshold. In other words, a spline that is log-like near the threshold.
Args: - x: input - threshold: the value at which the function should be log-like - base: the base of the logarithm - scale: a parameter to squeeze (<1) or stretch (>1) the function
Source code in calibrie/utils.py
cubic_exp_inv ¶
inverse of cubic_exp_fwd (on [0,threshold])
Source code in calibrie/utils.py
spline_biexponential ¶
bi-logarithm function with smooth transition to cubic polynomial between [-threshold, threshold]
Args: - x: input - threshold: when the function should transition between log and spline - base: the base of the logarithm - compression: a parameter to squeeze (<1) or stretch (>1) the function in the spline region
Source code in calibrie/utils.py
inverse_spline_biexponential ¶
inverse of log_poly_log
Source code in calibrie/utils.py
logb_jax ¶
cubic_exp_fwd_jax ¶
cubic polynomial that goes through (0,0) and has same first and second derivative as the log function at the threshold it appears monotonically increasing for x in [0, threshold] although I haven't technically proven it
Source code in calibrie/utils.py
cubic_exp_inv_jax ¶
inverse of cubic_exp_fwd (on [0,T])
Source code in calibrie/utils.py
spline_biexponential_jax ¶
biexponential function with smooth transition to cubic polynomial between [-threshold, threshold]
Source code in calibrie/utils.py
inverse_spline_biexponential_jax ¶
inverse of spline_biexponential
Source code in calibrie/utils.py
regression ¶
returns the stacked_poly params to best express y as a function of x