robustmodels 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.5
2
+ Name: robustmodels
3
+ Version: 0.1.0
4
+ Summary: Robust statistics for Python: univariate location and scale, multivariate location and scatter.
5
+ Project-URL: Homepage, https://github.com/omarbecerrasierra/robustmodels
6
+ Project-URL: Documentation, https://omarbecerrasierra.github.io/robustmodels/
7
+ Project-URL: Repository, https://github.com/omarbecerrasierra/robustmodels
8
+ Project-URL: Issues, https://github.com/omarbecerrasierra/robustmodels/issues
9
+ Project-URL: Changelog, https://github.com/omarbecerrasierra/robustmodels/blob/main/CHANGELOG.md
10
+ Author: omarbecerrasierra
11
+ License-Expression: BSD-3-Clause
12
+ License-File: LICENSE
13
+ Keywords: MCD,Qn,Sn,covariance,medcouple,outliers,robust statistics
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Scientific/Engineering
25
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
26
+ Requires-Python: >=3.10
27
+ Requires-Dist: numpy>=1.24
28
+ Requires-Dist: scikit-learn>=1.6
29
+ Requires-Dist: scipy>=1.10
30
+ Description-Content-Type: text/markdown
31
+
32
+ # robustmodels
33
+
34
+ [![PyPI](https://img.shields.io/pypi/v/robustmodels)](https://pypi.org/project/robustmodels/)
35
+ [![Docs](https://github.com/omarbecerrasierra/robustmodels/actions/workflows/docs.yml/badge.svg)](https://omarbecerrasierra.github.io/robustmodels/)
36
+ [![CI](https://github.com/omarbecerrasierra/robustmodels/actions/workflows/ci.yml/badge.svg)](https://github.com/omarbecerrasierra/robustmodels/actions/workflows/ci.yml)
37
+
38
+ Robust location, scale and covariance estimators for Python. Early development:
39
+ the API may change before version 1.0.
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ pip install robustmodels
45
+ ```
46
+
47
+ Requires Python 3.10+, NumPy, SciPy and scikit-learn.
48
+
49
+ ## Use
50
+
51
+ ```python
52
+ from robustmodels import location, scale
53
+
54
+ x = [1, 2, 2, 3, 4, 100]
55
+ location.hodges_lehmann(x)
56
+ scale.mad(x)
57
+ scale.qn(x)
58
+ ```
59
+
60
+ Covariance estimators follow the scikit-learn interface:
61
+
62
+ ```python
63
+ import numpy as np
64
+ from robustmodels.covariance import MCD
65
+
66
+ X = np.random.default_rng(0).normal(size=(100, 3))
67
+ X[:10] += 8
68
+
69
+ model = MCD(random_state=0).fit(X)
70
+ model.location_
71
+ model.covariance_
72
+ model.mahalanobis(X) # squared distances
73
+ model.support_ # observations kept after reweighting
74
+ ```
75
+
76
+ ## Estimators
77
+
78
+ | Module | Contents |
79
+ | --- | --- |
80
+ | `robustmodels.location` | `hodges_lehmann`, `m_location`, `tau_location`, `trimmed_mean`, `winsorized_mean` |
81
+ | `robustmodels.scale` | `mad`, `qn`, `sn`, `pn`, `tau_scale`, `m_scale`; skewness and tail weight: `medcouple`, `lmc`, `rmc` |
82
+ | `robustmodels.covariance` | `MCD`, `MRCD`, `MVE`, `OGK`, `SEstimator`, `MMEstimator`; correction factors: `h_alpha_n`, `mcd_consistency`, `mcd_small_sample` |
83
+
84
+ The [documentation](https://omarbecerrasierra.github.io/robustmodels/) explains how
85
+ to choose and use each estimator and documents every function and class. The same
86
+ information is in the docstrings: `help(robustmodels.scale.qn)`.
87
+
88
+ Univariate functions accept finite, one-dimensional samples. Empty samples return
89
+ `NaN`. A single observation has zero scale. Covariance estimators accept matrices
90
+ with observations in rows. MRCD supports more variables than observations and
91
+ uses an identity regularization target. MVE requires `alpha < 1`.
92
+ MRCD needs an explicit positive `rho` when a starting subset has zero scatter.
93
+
94
+ Qn, Sn and Pn include finite-sample corrections by default. Pass
95
+ `finite_correction=False` to disable them. Pn uses the factors from
96
+ [Tarr (2014), Appendix B.3](https://www.researchgate.net/publication/267927753_Quantile_Based_Estimation_of_Scale_and_Dependence).
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ uv sync --locked
102
+ uv run pytest
103
+ uv run ruff check .
104
+ uv run ruff format --check .
105
+ ```
106
+
107
+ Build and check the distributions:
108
+
109
+ ```bash
110
+ uv build
111
+ uvx twine check --strict dist/*
112
+ ```
113
+
114
+ Run the docstring examples and build the documentation:
115
+
116
+ ```bash
117
+ uv run pytest --doctest-modules --pyargs robustmodels
118
+ uv run --group docs sphinx-build -W -b html docs docs/_build/html
119
+ ```
120
+
121
+ CI runs the tests against the installed wheel on Python 3.10 to 3.14.
122
+ The Python 3.10 job uses the minimum supported NumPy, SciPy and scikit-learn versions.
123
+
124
+ The examples in `docs/` and in the docstrings run as tests. The tests cover estimator definitions, statistical properties, edge cases,
125
+ agreement with R's robustbase and rrcov, and
126
+ [scikit-learn compatibility](https://scikit-learn.org/stable/developers/develop.html).
127
+
128
+ Code lives in `src/robustmodels`:
129
+
130
+ | File | Contents | Internal dependencies |
131
+ | --- | --- | --- |
132
+ | `location.py` | Location estimators | `scale.py`, `_validation.py` |
133
+ | `scale.py` | Scale, skewness, correction factors and pairwise selection | `_validation.py` |
134
+ | `covariance.py` | Covariance estimators and their fitting steps | `scale.py`, `_validation.py` |
135
+ | `_validation.py` | Input and parameter checks | None |
136
+
137
+ Each method and its steps stay together. Auditing an estimator requires its file
138
+ and at most two supporting files. `__init__.py` exposes the three public modules.
139
+
140
+ ### Release
141
+
142
+ 1. Set `version` in `pyproject.toml`, run `uv lock`, and replace "unreleased"
143
+ in [CHANGELOG.md](https://github.com/omarbecerrasierra/robustmodels/blob/main/CHANGELOG.md)
144
+ with the date.
145
+ 2. Merge into `main`, then tag and push: `git tag v0.1.0 && git push origin v0.1.0`.
146
+ 3. CI tests, builds and, after approval of the `pypi` environment, publishes to
147
+ PyPI through trusted publishing. The tag must match the package version.
148
+
149
+ ## License
150
+
151
+ BSD 3-Clause; see [LICENSE](https://github.com/omarbecerrasierra/robustmodels/blob/main/LICENSE).
@@ -0,0 +1,9 @@
1
+ robustmodels/__init__.py,sha256=cqpCEa30Oy89wDLizO8NzDSxS9xB89_V1_jA3Awi78s,307
2
+ robustmodels/_validation.py,sha256=RxRmqJAjL98aEYb7TIHwtfsaWBVaeFxqZUNDk1WCbF8,1587
3
+ robustmodels/covariance.py,sha256=ZCELU5xSOZlpF51JOzfVGIeczx1UCBF-EF3QNQcAvwg,45329
4
+ robustmodels/location.py,sha256=gPUaL3JXz7gx1hnDjOsuLN2w0FPCSPBX69w1AEo6hZo,7347
5
+ robustmodels/scale.py,sha256=za7wO3wNCmUXh1QcIP5DP_Klqd-woDlCx_ypCuZ2WOE,23403
6
+ robustmodels-0.1.0.dist-info/METADATA,sha256=G9ZJ3SDiyLatqi8MD-MqkGwn4bBw3uZxVR5QGMsv6hQ,5920
7
+ robustmodels-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
8
+ robustmodels-0.1.0.dist-info/licenses/LICENSE,sha256=iTu5bMi0hBi093HcexOLpwMoSVYw6ubUgarnq6e2yk4,1504
9
+ robustmodels-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, omarbecerrasierra
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.