|
| 1 | +<img src="assets/nns_hex_sticker.png" width="150" alt="NNS hex sticker" style="border: none; outline: none; margin: 0; padding: 0; display: block;"> |
| 2 | + |
| 3 | +[](https://pypi.org/project/ovvo-nns/) |
| 4 | +[](https://www.python.org/) |
| 5 | +[](https://github.com/OVVO-Financial/NNS-python/blob/main/LICENSE) |
| 6 | + |
| 7 | +# NNS Python |
| 8 | + |
| 9 | +`ovvo-nns` brings **Nonlinear Nonparametric Statistics** to Python as the `nns` |
| 10 | +import package. It is a parity-focused port of the R `NNS` 13.0+ package, |
| 11 | +designed for real-world data that violate symmetry, linearity, or distributional |
| 12 | +assumptions. |
| 13 | + |
| 14 | +NNS is built around partial moments — the lower and upper components of variance — |
| 15 | +and uses them across nonlinear dependence, correlation, causation, regression, |
| 16 | +classification, forecasting, stochastic dominance, stochastic superiority, Monte |
| 17 | +Carlo simulation, and numerical differentiation workflows. |
| 18 | + |
| 19 | +!!! note "Origin" |
| 20 | + NNS was created by Fred Viole as the companion R package to Viole, F. and |
| 21 | + Nawrocki, D. (2013), *Nonlinear Nonparametric Statistics: Using Partial |
| 22 | + Moments*. **Book (2nd Edition):** <https://ovvo-financial.github.io/NNS/book/>. |
| 23 | + For a direct quantitative finance implementation of NNS, see |
| 24 | + [OVVO Labs](https://www.ovvolabs.com). |
| 25 | + |
| 26 | +## Package at a glance |
| 27 | + |
| 28 | +| Item | Value | |
| 29 | +|---|---| |
| 30 | +| Distribution package | `ovvo-nns` | |
| 31 | +| Import package | `nns` | |
| 32 | +| Python | `>=3.11` | |
| 33 | +| Required runtime dependencies | NumPy, SciPy | |
| 34 | +| R required at runtime | No | |
| 35 | +| Native acceleration | Private, optional `nns._nnscore` kernels where available | |
| 36 | +| Public API status | Stable, parity-focused | |
| 37 | +| License | GPL-3.0-only | |
| 38 | + |
| 39 | +The public package is Python-native and does not call R at runtime. Some core |
| 40 | +kernels can use the private `_nnscore` extension when it is present, while public |
| 41 | +functions keep Python implementations and explicit fallback behavior. |
| 42 | + |
| 43 | +## Get started |
| 44 | + |
| 45 | +<div class="grid cards" markdown> |
| 46 | + |
| 47 | +- :material-download: **[Install](install.md)** |
| 48 | + |
| 49 | + `pip install ovvo-nns`, then `import nns`. |
| 50 | + |
| 51 | +- :material-rocket-launch: **[Quick start](quick_start.md)** |
| 52 | + |
| 53 | + Partial moments, dependence, regression, and forecasting in a few lines. |
| 54 | + |
| 55 | +- :material-book-open-variant: **[API reference](api_reference.md)** |
| 56 | + |
| 57 | + Function-by-function index with R `NNS` name crosswalks. |
| 58 | + |
| 59 | +- :material-check-decagram: **[API status](api_status.md)** |
| 60 | + |
| 61 | + Implemented, partial, guarded, and known-gap paths. |
| 62 | + |
| 63 | +</div> |
| 64 | + |
| 65 | +## Main API areas |
| 66 | + |
| 67 | +| Area | Representative functions | |
| 68 | +|---|---| |
| 69 | +| Partial moments | `lpm`, `upm`, `lpm_ratio`, `upm_ratio`, `pm_matrix` | |
| 70 | +| Classical moment helpers | `mean_pm`, `var_pm`, `skew_pm`, `kurt_pm`, `nns_moments` | |
| 71 | +| Dependence, correlation, copula | `nns_dep`, `nns_cor`, `nns_copula` | |
| 72 | +| Causation | `nns_causation`, `causal_matrix` | |
| 73 | +| Regression and classification | `nns_reg`, `nns_m_reg`, `nns_stack`, `nns_boost` | |
| 74 | +| Forecasting | `nns_seas`, `nns_arma`, `nns_arma_optim`, `nns_var` | |
| 75 | +| Distribution tools | `nns_cdf`, `nns_anova`, `nns_norm` | |
| 76 | +| Stochastic dominance | `fsd`, `ssd`, `tsd`, `nns_sd_cluster`, `sd_efficient_set` | |
| 77 | +| Stochastic superiority and simulation | `nns_ss`, `nns_mc`, `nns_meboot` | |
| 78 | +| Differentiation | `nns_diff`, `dy_dx`, `dy_d` | |
| 79 | +| Categorical helpers | `encode_factor_codes`, `factor_2_dummy`, `factor_2_dummy_fr`, `prepare_factor_predictors` | |
| 80 | + |
| 81 | +See [API status](api_status.md) for implemented, partial, guarded, and known-gap |
| 82 | +paths. |
| 83 | + |
| 84 | +## Design boundaries |
| 85 | + |
| 86 | +NNS Python prioritizes stable public behavior from installed R NNS 13.0+, not |
| 87 | +private helper parity. The package returns NumPy arrays and plain dictionaries |
| 88 | +rather than R `data.table` objects, uses explicit Python errors for several |
| 89 | +unsafe R coercions, and generally ignores plotting side effects. |
| 90 | + |
| 91 | +See [behavior conventions](conventions.md) for detailed compatibility notes and |
| 92 | +[parity with R NNS](parity.md) for the parity target and automation. |
| 93 | + |
| 94 | +## Links |
| 95 | + |
| 96 | +- [View on PyPI](https://pypi.org/project/ovvo-nns/) |
| 97 | +- [Browse source code](https://github.com/OVVO-Financial/NNS-python) |
| 98 | +- [Report a bug](https://github.com/OVVO-Financial/NNS-python/issues) |
| 99 | + |
| 100 | +## License |
| 101 | + |
| 102 | +[GPL-3.0-only](https://www.gnu.org/licenses/gpl-3.0.en.html) |
| 103 | + |
| 104 | +## Citation |
| 105 | + |
| 106 | +NNS is the companion to Viole, F. and Nawrocki, D. (2013), |
| 107 | +*Nonlinear Nonparametric Statistics: Using Partial Moments* (ISBN: 1490523995). |
| 108 | +2nd edition: <https://ovvo-financial.github.io/NNS/book/>. |
| 109 | + |
| 110 | +## Developers |
| 111 | + |
| 112 | +- **Fred Viole** — author and maintainer |
| 113 | +- **Roberto Spadim** — contributor |
| 114 | +- **Rasheed Khoshnaw** — contributor |
| 115 | + |
| 116 | +## Attribution |
| 117 | + |
| 118 | +Upstream R package and reference implementation: |
| 119 | +[OVVO-Financial/NNS](https://github.com/OVVO-Financial/NNS). |
0 commit comments