Overview
Nautilus.Distributions provides 12 probability distribution
families. It replaces scipy.stats for Chelis programs.
Distribution families
Section titled “Distribution families”| Distribution | CDF | Inverse CDF | Sample | |
|---|---|---|---|---|
| Normal | normal_pdf | normal_cdf | normal_inv_cdf | normal_sample |
| LogNormal | lognormal_pdf | lognormal_cdf | lognormal_inv_cdf | lognormal_sample |
| Uniform | uniform_pdf | uniform_cdf | uniform_inv_cdf | uniform_sample |
| Exponential | exponential_pdf | exponential_cdf | exponential_inv_cdf | exponential_sample |
| Gamma | gamma_pdf | gamma_cdf | gamma_inv_cdf | |
| Chi-squared | chi_squared_pdf | chi_squared_cdf | chi_squared_inv_cdf | |
| Student-t | student_t_pdf | student_t_cdf | ||
| Poisson | poisson_pmf | poisson_cdf | ||
| Binomial | binomial_pmf | binomial_cdf | ||
| Beta | beta_pdf | beta_cdf | ||
| F | f_pdf | f_cdf | ||
| Weibull | weibull_pdf | weibull_cdf | weibull_inv_cdf |
Parameter conventions
Section titled “Parameter conventions”Functions follow scipy's parameter naming:
- Normal:
(x, mean, std)not(x, mu, sigma) - Gamma:
(x, shape, scale)not(x, shape, rate) - Exponential:
(x, rate) - Chi-squared:
(x, df)where df is degrees of freedom - Student-t:
(x, df) - Poisson:
(k, lambda)where k is the count - Binomial:
(k, n, p)where n is trials and p is probability - Beta:
(x, a, b)where a, b are shape parameters - F:
(x, df1, df2) - Weibull:
(x, shape, scale)
Sampling and the Random effect
Section titled “Sampling and the Random effect”The four _sample functions carry the ! { Random } effect:
def normal_sample[n](template: tensor[n, f32], mean: f32, std: f32) -> tensor[n, f32] ! { Random }The template tensor determines the output shape. The actual values
in the template are ignored; only its shape is used. Sampling uses
Box-Muller (Normal), inverse CDF (Exponential, LogNormal), or direct
scaling (Uniform).
Imports
Section titled “Imports”import Nautilus.Distributions (normal_pdf, normal_cdf, normal_inv_cdf)import Nautilus.Distributions (gamma_cdf, student_t_cdf, chi_squared_cdf)import Nautilus.Distributions (poisson_cdf, binomial_cdf, beta_cdf)Common usage
Section titled “Common usage”The most frequently used functions are normal_cdf and normal_inv_cdf,
which appear in Black-Scholes pricing, Value-at-Risk computation, and
hypothesis testing. gamma_cdf and student_t_cdf underpin chi-squared
and t-test p-values through the Nautilus.Testing module.