Upstream example coverage
Disposition of every notebook and script in Numerics-Python-Examples with respect to this port. Every upstream topic is now covered. “Ported” examples reproduce the upstream results (exactly where seeded and deterministic). “Recast” examples cover the same statistical content through this package’s public API, where the upstream code drove the C# classes directly in ways this API deliberately does not expose (notably custom prior lists and Python-callback likelihoods), or where the material moved onto a page of this site that organizes it differently.
| Upstream | Topic | Status | Notes |
|---|---|---|---|
00_getting_started |
Loading the library, first distribution | Ported | pythonnet/DLL plumbing replaced by a plain package install |
01_distributions |
Distribution tour, sampling, Latin hypercube | Ported | all 10 families and the seeded draws reproduce exactly |
02_distribution_fitting |
MOM / MLE / L-moment fitting | Ported | fitted parameters reproduce exactly |
03_mcmc_basics |
RWMH fundamentals | Recast | recast onto mcmc_sample(), which fits a named family under constraint-based priors; the hand-written likelihood and hand-picked priors this notebook uses are reachable through mcmc_posterior() (example 14) |
04_mcmc_bayesian_inference |
Bayesian flood frequency | Ported | same priors, seed, and serial chains as upstream; acceptance streams bit-exact vs C#, posterior tables reproduce at displayed precision (documented ulp drift in the MAP optimizer) |
05_mcmc_adaptive |
Adaptive sampler comparison | Recast | PyMC benchmark sections dropped |
06_mcmc_diagnostics |
R-hat, ESS, autocorrelation | Recast | R-hat and ESS come back with the fit rather than as verbs of their own, so there is no way to score a chain the package did not produce; autocorrelation() does take any series |
07_integration_and_root_finding |
Numerical integration, root finding | Recast | both namespaces ported in v0.9.0; quadrature() covers ten deterministic rules plus three seeded Monte Carlo families, root_find() four methods; example 18 runs them over its own functions rather than this notebook’s |
08_optimization |
Local and global optimizers | Recast | all fourteen optimizers are public through optim_minimize()/optim_maximize() as of v0.10.0, constrained optimization included; example 13 fits a rating-curve likelihood and example 19 covers the global, constrained, and network methods, neither reproducing this notebook’s specific test functions |
09_statistics |
Statistical tests, transforms, outliers | Ported | MGBT, Box-Cox/Yeo-Johnson, plotting positions, and bootstrap here; the thirteen hypothesis_test() statics and the paired-data curves in example 28; Jenks breaks as ml_jenks_breaks() in example 29 |
10_time_series |
TimeSeries container operations | Ported | the container landed in v0.13.0; file I/O and the USGS download stay out, everything else is public through time_series() and the ts_*() verbs |
11_machine_learning |
K-Means, random forest, KNN, GMM | Ported | the whole Numerics.MachineLearning namespace landed in v0.12.0 as the eight ml_*() verbs |
12_linear_models |
GLM regression | Ported | ml_glm(), all five families selected by link |
examples/bayesian_regression.py |
DEMCzs linear regression | Recast | recast onto arimax_analysis with a linear trend |
examples/flood_frequency_analysis.py |
Distribution ranking, design flows | Ported | fits and return-period tables reproduce exactly; ranking by log-likelihood and AIC rather than the KS test, which does not penalize GEV’s extra parameter |
examples/reliability_analysis.py |
Monte Carlo reliability | Ported | uses the LnNormal family in place of C# LogNormal.Base = e; results reproduce exactly |
Beyond the upstream examples
These examples cover ground the upstream notebooks never reach, most of it RMC-BestFit and the rest the callback surface, so they have no upstream counterpart and no upstream outputs to reproduce against. Each still ends in an executable check, and each pair asserts the same literals in R and Python, which is what pins the cross-language identity.
| Example | Covers |
|---|---|
| 12. Model evaluation | goodness_of_fit(), gof_test() (KS/AD), gof_rmse(), aic()/aic_weights(), and classification_metrics(), ranking four candidate distributions against the same record example 21 uses |
| 13. A custom objective | optim_minimize()/optim_maximize() over a hand-written likelihood the port does not otherwise know how to fit; global ("de") versus local ("bfgs") optimization, and the sign convention of optim_maximize()’s reported value |
| 14. A custom posterior | mcmc_posterior() over a log-likelihood and priors you write, reaching all eight samplers – Gibbs included, which needs a proposal function and so had been unreachable from either package |
| 15. A custom bootstrap | bootstrap_custom() over the four upstream delegates and all five interval methods, putting an interval on a statistic no verb computes; drawing inside resample from the handle the replicate passes in |
| 16. Ranking fifteen candidate families | fit_distributions() on its own terms: what the fifteen candidates are, why AIC, BIC and RMSE can each name a different winner, and reading the converged column |
| 17. A pivotal bootstrap | bootstrap_custom(run_type = "pivotal"), the covariance-aware run type: the fit_with_covariance function it adds, both interval blocks it reports, the six replicate counts in pivotal_diagnostics, and standardizing in link space |
| 23. Censored flood frequency | historical and paleoflood interval observations, perception thresholds, Hirsch-Stedinger plotting positions, Multiple Grubbs-Beck low outliers |
| 24. Nonstationary frequency analysis | trends on a distribution parameter, stationary versus nonstationary model comparison by AIC, BIC, and DIC |
| 25. Estimation methods | fit_mle, fit_map, fit_bayesian, and fit_gmm on the same censored record; AIC/BIC/DIC, profile versus credible intervals, R-hat/ESS, and estimation diagnostics |
| 26. Copulas and joint frequency | bivariate copulas fitted by pseudo-likelihood, Kendall’s tau, and inference from margins; tail dependence; and-joint exceedance of a coincident event; the multivariate normal rectangle probability; cross-check against bivariate_analysis |
| 27. Composite distributions | two-component mixtures through model_mixture and fit_mle rebuilt as dist_mixture; kernel density with an explicit bandwidth and bounded_by_data; dist_truncated renormalization onto a physical range |
| 28. Hypothesis tests and paired data | hypothesis_test() and the analysis_data_hypothesis_test()/analysis_data_statistics() DataFrame facades on a flood record; correlation()’s matrix form; the Paired Data curve subsystem – curve_interpolate(), curve_area(), curve_simplify()’s three algorithms, and uncertain_curve_sample() |