model-diagnostics 1.1.0__tar.gz → 1.2.0__tar.gz

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.
Files changed (46) hide show
  1. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/PKG-INFO +10 -7
  2. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/README.md +6 -3
  3. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/docs/development.md +25 -2
  4. model_diagnostics-1.2.0/docs/examples/regression_on_workers_compensation.ipynb +1551 -0
  5. model_diagnostics-1.2.0/docs/gen_ref_pages.py +64 -0
  6. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/docs/index.md +6 -3
  7. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/mkdocs.yml +19 -5
  8. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/pyproject.toml +92 -73
  9. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/__about__.py +1 -1
  10. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/__init__.py +0 -6
  11. model_diagnostics-1.2.0/src/model_diagnostics/_utils/array.py +354 -0
  12. model_diagnostics-1.2.0/src/model_diagnostics/_utils/binning.py +220 -0
  13. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/_utils/isotonic.py +1 -1
  14. model_diagnostics-1.2.0/src/model_diagnostics/_utils/partial_dependence.py +99 -0
  15. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/_utils/plot_helper.py +5 -3
  16. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/_utils/tests/test_array.py +47 -1
  17. model_diagnostics-1.2.0/src/model_diagnostics/_utils/tests/test_partial_dependence.py +177 -0
  18. model_diagnostics-1.2.0/src/model_diagnostics/calibration/__init__.py +11 -0
  19. model_diagnostics-1.2.0/src/model_diagnostics/calibration/identification.py +828 -0
  20. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/calibration/plots.py +443 -21
  21. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/calibration/tests/test_identification.py +459 -24
  22. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/calibration/tests/test_plots.py +211 -24
  23. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/scoring/plots.py +4 -2
  24. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/scoring/scoring.py +20 -17
  25. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/scoring/tests/test_scoring.py +141 -141
  26. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/tests/test_config.py +1 -1
  27. model_diagnostics-1.1.0/docs/examples/regression_on_workers_compensation.ipynb +0 -1321
  28. model_diagnostics-1.1.0/docs/gen_ref_pages.py +0 -38
  29. model_diagnostics-1.1.0/src/model_diagnostics/_utils/_array.py +0 -165
  30. model_diagnostics-1.1.0/src/model_diagnostics/calibration/__init__.py +0 -9
  31. model_diagnostics-1.1.0/src/model_diagnostics/calibration/identification.py +0 -534
  32. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/.codecov.yml +0 -0
  33. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/.gitignore +0 -0
  34. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/LICENSE +0 -0
  35. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/dev_tools/print_package_versions.py +0 -0
  36. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/docs/examples/classification.ipynb +0 -0
  37. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/docs/examples/quantile_regression.ipynb +0 -0
  38. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/docs/javascripts/mathjax.js +0 -0
  39. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/_config.py +0 -0
  40. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/_utils/__init__.py +0 -0
  41. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/_utils/test_helper.py +0 -0
  42. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/_utils/tests/test_isotonic.py +0 -0
  43. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/calibration/tests/__init__.py +0 -0
  44. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/scoring/__init__.py +0 -0
  45. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/scoring/tests/__init__.py +0 -0
  46. {model_diagnostics-1.1.0 → model_diagnostics-1.2.0}/src/model_diagnostics/scoring/tests/test_plots.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: model-diagnostics
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Tools for diagnostics and assessment of (machine learning) models
5
5
  Project-URL: Homepage, https://lorentzenchr.github.io/model-diagnostics/
6
6
  Project-URL: Source, https://github.com/lorentzenchr/model-diagnostics
@@ -29,7 +29,7 @@ License: MIT License
29
29
  SOFTWARE.
30
30
  License-File: LICENSE
31
31
  Keywords: calibration,machine learning,model diagnostics
32
- Classifier: Development Status :: 1 - Planning
32
+ Classifier: Development Status :: 5 - Production/Stable
33
33
  Classifier: Framework :: Hatch
34
34
  Classifier: License :: OSI Approved :: MIT License
35
35
  Classifier: Operating System :: OS Independent
@@ -39,7 +39,7 @@ Requires-Python: >=3.9
39
39
  Requires-Dist: matplotlib>=3.6.1
40
40
  Requires-Dist: numpy>=1.22
41
41
  Requires-Dist: packaging>=23.1
42
- Requires-Dist: polars>=0.17.15
42
+ Requires-Dist: polars>=1.0.0
43
43
  Requires-Dist: scikit-learn>=1.2.0
44
44
  Requires-Dist: scipy>=1.10
45
45
  Description-Content-Type: text/markdown
@@ -51,17 +51,18 @@ Description-Content-Type: text/markdown
51
51
  | CI/CD |[![CI - Test](https://github.com/lorentzenchr/model-diagnostics/actions/workflows/test.yml/badge.svg)](https://github.com/lorentzenchr/model-diagnostics/actions/workflows/test.yml) [![Coverage](https://codecov.io/github/lorentzenchr/model-diagnostics/coverage.svg?branch=main)](https://codecov.io/gh/lorentzenchr/model-diagnostics)
52
52
  | Docs | [![Docs](https://github.com/lorentzenchr/model-diagnostics/actions/workflows/docs.yml/badge.svg)](https://github.com/lorentzenchr/model-diagnostics/actions/workflows/docs.yml)
53
53
  | Package | [![PyPI - Version](https://img.shields.io/pypi/v/model-diagnostics.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.org/project/model-diagnostics/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/model-diagnostics.svg?color=blue&label=Downloads&logo=pypi&logoColor=gold)](https://pypi.org/project/model-diagnostics/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/model-diagnostics.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/model-diagnostics/) |
54
- | Meta | [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/charliermarsh/ruff) [![code style - black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/)
54
+ | Meta | [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/)
55
55
 
56
56
  **Tools for diagnostics and assessment of (machine learning) models**
57
57
 
58
58
  Highlights:
59
59
 
60
60
  - All common point predictions covered: mean, median, quantiles, expectiles.
61
- - Assess model calibration with [identification functions](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.identification_function) (generalized residuals) and [compute_bias](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.compute_bias).
61
+ - Assess model calibration with [identification functions](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.identification_function) (generalized residuals), [compute_bias](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.compute_bias) and [compute_marginal](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.compute_marginal).
62
62
  - Assess calibration and bias graphically
63
63
  - [reliability diagrams](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/plots/#model_diagnostics.calibration.plots.plot_reliability_diagram) for auto-calibration
64
64
  - [bias plots](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/plots/#model_diagnostics.calibration.plots.plot_bias) for conditional calibration
65
+ - [marginal plots](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/plots/#model_diagnostics.calibration.plots.plot_marginal) for average `y_obs`, `y_pred` and partial dependence for one feature
65
66
  - Assess the predictive performance of models
66
67
  - strictly consistent, homogeneous [scoring functions](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/scoring/scoring/)
67
68
  - [score decomposition](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/scoring/scoring/#model_diagnostics.scoring.scoring.decompose) into miscalibration, discrimination and uncertainty
@@ -75,7 +76,9 @@ This package relies on the giant shoulders of, among others, [polars](https://po
75
76
 
76
77
  **Installation**
77
78
 
78
- `pip install model-diagnostics`
79
+ ```
80
+ pip install model-diagnostics
81
+ ```
79
82
 
80
83
  **Contributions**
81
84
 
@@ -5,17 +5,18 @@
5
5
  | CI/CD |[![CI - Test](https://github.com/lorentzenchr/model-diagnostics/actions/workflows/test.yml/badge.svg)](https://github.com/lorentzenchr/model-diagnostics/actions/workflows/test.yml) [![Coverage](https://codecov.io/github/lorentzenchr/model-diagnostics/coverage.svg?branch=main)](https://codecov.io/gh/lorentzenchr/model-diagnostics)
6
6
  | Docs | [![Docs](https://github.com/lorentzenchr/model-diagnostics/actions/workflows/docs.yml/badge.svg)](https://github.com/lorentzenchr/model-diagnostics/actions/workflows/docs.yml)
7
7
  | Package | [![PyPI - Version](https://img.shields.io/pypi/v/model-diagnostics.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.org/project/model-diagnostics/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/model-diagnostics.svg?color=blue&label=Downloads&logo=pypi&logoColor=gold)](https://pypi.org/project/model-diagnostics/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/model-diagnostics.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/model-diagnostics/) |
8
- | Meta | [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/charliermarsh/ruff) [![code style - black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/)
8
+ | Meta | [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/)
9
9
 
10
10
  **Tools for diagnostics and assessment of (machine learning) models**
11
11
 
12
12
  Highlights:
13
13
 
14
14
  - All common point predictions covered: mean, median, quantiles, expectiles.
15
- - Assess model calibration with [identification functions](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.identification_function) (generalized residuals) and [compute_bias](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.compute_bias).
15
+ - Assess model calibration with [identification functions](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.identification_function) (generalized residuals), [compute_bias](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.compute_bias) and [compute_marginal](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/identification/#model_diagnostics.calibration.identification.compute_marginal).
16
16
  - Assess calibration and bias graphically
17
17
  - [reliability diagrams](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/plots/#model_diagnostics.calibration.plots.plot_reliability_diagram) for auto-calibration
18
18
  - [bias plots](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/plots/#model_diagnostics.calibration.plots.plot_bias) for conditional calibration
19
+ - [marginal plots](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/calibration/plots/#model_diagnostics.calibration.plots.plot_marginal) for average `y_obs`, `y_pred` and partial dependence for one feature
19
20
  - Assess the predictive performance of models
20
21
  - strictly consistent, homogeneous [scoring functions](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/scoring/scoring/)
21
22
  - [score decomposition](https://lorentzenchr.github.io/model-diagnostics/reference/model_diagnostics/scoring/scoring/#model_diagnostics.scoring.scoring.decompose) into miscalibration, discrimination and uncertainty
@@ -29,7 +30,9 @@ This package relies on the giant shoulders of, among others, [polars](https://po
29
30
 
30
31
  **Installation**
31
32
 
32
- `pip install model-diagnostics`
33
+ ```
34
+ pip install model-diagnostics
35
+ ```
33
36
 
34
37
  **Contributions**
35
38
 
@@ -17,13 +17,36 @@ Apart from the default environment are `docs`, `jupyter`, `lint` and `test`
17
17
 
18
18
  - `hatch run cov` or `hatch run pytest` to run tests
19
19
  - `hatch -e test run pytest` to run test matrix for multiple versions of python and packages
20
- - `hatch run lint:fmt` to apply `black` and `isort`
21
- - `hatch run lint:all` to check linting, typing, style and security
20
+ - `hatch run format:check` to check formatting, linting, typing
21
+ - `hatch run format:fix` to apply `ruff format` and `ruff check --fix`
22
22
  - `hatch run docs:serve` to run a local server under [localhost:8000](localhost:8000)
23
23
  for the website supporting live updates, i.e. you can change the docs and see
24
24
  updates immediately. Press Control+C to stop.
25
25
  - `hatch run jupyter:lab` to start a jupyter lab server
26
26
 
27
+ Some more commands concering testing are:
28
+ - `hatch run test:versions` prints package versions per test matrix
29
+ - `hatch run cov-erase` remove coverage report, i.e. "clean cache"
30
+ - `hatch run test:cov --cov-report=xml` run test matrix and generate coverage report
31
+
32
+ ## Hatch config
33
+
34
+ If you work with, e.g., VSCode and want to detect the python executable, one way to do
35
+ it is the following:
36
+
37
+ - Edit the `config.toml` of hatch. Look at https://hatch.pypa.io/latest/config/hatch/
38
+ for its platform dependent path.
39
+ - Add the entry
40
+ ```
41
+ [dirs.env]
42
+ virtual = ".hatch"
43
+ ```
44
+
45
+ This way, hatch will install the virtual environments specified in `pyprojects.toml`
46
+ (look out for `tool.hatch.envs.`) under a `.hatch` subdirectory in the project (for us
47
+ in the `model-diagnostics` git repository folder). Now, it is a bit easier to select a
48
+ path for the python interpreter or jupyter kernel, e.g. `.hatch/jupyter/bin/python`.
49
+
27
50
  ## Release Process
28
51
 
29
52
  See <https://packaging.python.org/en/latest/tutorials/packaging-projects/>,