srdkit 1.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.
- srdkit-1.0/.gitignore +53 -0
- srdkit-1.0/CHANGELOG.md +42 -0
- srdkit-1.0/CITATION.cff +76 -0
- srdkit-1.0/LICENSE +21 -0
- srdkit-1.0/PKG-INFO +151 -0
- srdkit-1.0/README.md +80 -0
- srdkit-1.0/examples/01_basics/README.rst +2 -0
- srdkit-1.0/examples/01_basics/plot_01_first_srd.py +62 -0
- srdkit-1.0/examples/01_basics/plot_02_references.py +57 -0
- srdkit-1.0/examples/01_basics/plot_03_ties_and_ranks.py +56 -0
- srdkit-1.0/examples/02_validation/README.rst +2 -0
- srdkit-1.0/examples/02_validation/plot_01_exact_distribution.py +73 -0
- srdkit-1.0/examples/02_validation/plot_02_crrn_and_cv.py +65 -0
- srdkit-1.0/examples/02_validation/plot_03_anova.py +45 -0
- srdkit-1.0/examples/02_validation/plot_04_power.py +20 -0
- srdkit-1.0/examples/03_family/README.rst +2 -0
- srdkit-1.0/examples/03_family/plot_01_rank_distances.py +62 -0
- srdkit-1.0/examples/03_family/plot_02_weighted_and_topk.py +55 -0
- srdkit-1.0/examples/03_family/plot_03_dne_dnm.py +63 -0
- srdkit-1.0/examples/03_family/plot_04_beyond_ranks.py +109 -0
- srdkit-1.0/examples/04_decision/README.rst +2 -0
- srdkit-1.0/examples/04_decision/plot_01_usrd_emissions.py +60 -0
- srdkit-1.0/examples/04_decision/plot_02_promethee_psrd.py +60 -0
- srdkit-1.0/examples/04_decision/plot_03_mcda_consensus.py +42 -0
- srdkit-1.0/examples/04_decision/plot_04_nmf_srd.py +47 -0
- srdkit-1.0/examples/04_decision/plot_05_post_pareto.py +33 -0
- srdkit-1.0/examples/04_decision/plot_06_fair_comparison.py +82 -0
- srdkit-1.0/examples/04_decision/plot_07_data_driven_weights.py +82 -0
- srdkit-1.0/examples/05_visualization/README.rst +2 -0
- srdkit-1.0/examples/05_visualization/plot_01_parallel_coordinates.py +45 -0
- srdkit-1.0/examples/05_visualization/plot_02_maps_constellations.py +36 -0
- srdkit-1.0/examples/05_visualization/plot_03_heatmaps_dendrograms.py +31 -0
- srdkit-1.0/examples/06_segmentation/README.rst +2 -0
- srdkit-1.0/examples/06_segmentation/plot_01_ranking_regimes.py +45 -0
- srdkit-1.0/examples/06_segmentation/plot_02_local_agreement.py +37 -0
- srdkit-1.0/examples/07_fusion/README.rst +2 -0
- srdkit-1.0/examples/07_fusion/plot_01_merit_fusion.py +32 -0
- srdkit-1.0/examples/07_fusion/plot_02_outliers_and_roc.py +47 -0
- srdkit-1.0/examples/07_fusion/plot_03_gpcm.py +29 -0
- srdkit-1.0/examples/08_diagnostics/README.rst +2 -0
- srdkit-1.0/examples/08_diagnostics/plot_01_influence_sensitivity.py +41 -0
- srdkit-1.0/examples/08_diagnostics/plot_02_reduction_and_report.py +32 -0
- srdkit-1.0/examples/README.rst +9 -0
- srdkit-1.0/pyproject.toml +86 -0
- srdkit-1.0/src/srdkit/__init__.py +101 -0
- srdkit-1.0/src/srdkit/_utils.py +75 -0
- srdkit-1.0/src/srdkit/_version.py +1 -0
- srdkit-1.0/src/srdkit/anova.py +185 -0
- srdkit-1.0/src/srdkit/clustering.py +110 -0
- srdkit-1.0/src/srdkit/core.py +364 -0
- srdkit-1.0/src/srdkit/datasets/__init__.py +160 -0
- srdkit-1.0/src/srdkit/datasets/data/co2_2018.csv +148 -0
- srdkit-1.0/src/srdkit/diagnostics.py +186 -0
- srdkit-1.0/src/srdkit/distances.py +204 -0
- srdkit-1.0/src/srdkit/distribution.py +503 -0
- srdkit-1.0/src/srdkit/framework.py +368 -0
- srdkit-1.0/src/srdkit/fusion.py +221 -0
- srdkit-1.0/src/srdkit/gpcm.py +138 -0
- srdkit-1.0/src/srdkit/mcda.py +201 -0
- srdkit-1.0/src/srdkit/nmf.py +141 -0
- srdkit-1.0/src/srdkit/parcoord.py +283 -0
- srdkit-1.0/src/srdkit/pareto.py +126 -0
- srdkit-1.0/src/srdkit/promethee.py +371 -0
- srdkit-1.0/src/srdkit/ranking.py +193 -0
- srdkit-1.0/src/srdkit/reference.py +232 -0
- srdkit-1.0/src/srdkit/report.py +114 -0
- srdkit-1.0/src/srdkit/representation.py +127 -0
- srdkit-1.0/src/srdkit/segmentation.py +247 -0
- srdkit-1.0/src/srdkit/simulate.py +171 -0
- srdkit-1.0/src/srdkit/tournament.py +167 -0
- srdkit-1.0/src/srdkit/utility.py +277 -0
- srdkit-1.0/src/srdkit/validation.py +501 -0
- srdkit-1.0/src/srdkit/value.py +189 -0
- srdkit-1.0/src/srdkit/viz/__init__.py +31 -0
- srdkit-1.0/src/srdkit/viz/_style.py +87 -0
- srdkit-1.0/src/srdkit/viz/applications.py +156 -0
- srdkit-1.0/src/srdkit/viz/basic.py +201 -0
- srdkit-1.0/src/srdkit/viz/framework.py +148 -0
- srdkit-1.0/src/srdkit/viz/maps.py +145 -0
- srdkit-1.0/src/srdkit/viz/validation.py +149 -0
- srdkit-1.0/src/srdkit/weighted.py +167 -0
- srdkit-1.0/src/srdkit/weights.py +230 -0
- srdkit-1.0/tests/test_applications.py +147 -0
- srdkit-1.0/tests/test_core.py +130 -0
- srdkit-1.0/tests/test_distribution.py +107 -0
- srdkit-1.0/tests/test_framework.py +179 -0
- srdkit-1.0/tests/test_validation.py +101 -0
- srdkit-1.0/tests/test_variants.py +123 -0
- srdkit-1.0/tests/test_viz.py +58 -0
srdkit-1.0/.gitignore
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.pyc
|
|
3
|
+
*.egg-info/
|
|
4
|
+
dist/
|
|
5
|
+
build/
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
.ruff_cache/
|
|
8
|
+
docs/_build/
|
|
9
|
+
docs/auto_examples/
|
|
10
|
+
docs/gen_modules/
|
|
11
|
+
docs/sg_execution_times.rst
|
|
12
|
+
book/figures/
|
|
13
|
+
book/*.aux
|
|
14
|
+
book/*.log
|
|
15
|
+
book/*.out
|
|
16
|
+
book/*.toc
|
|
17
|
+
book/*.bbl
|
|
18
|
+
book/*.bcf
|
|
19
|
+
book/*.blg
|
|
20
|
+
book/*.run.xml
|
|
21
|
+
book/*.idx
|
|
22
|
+
book/*.ilg
|
|
23
|
+
book/*.ind
|
|
24
|
+
book/*.fls
|
|
25
|
+
book/*.fdb_latexmk
|
|
26
|
+
book/*.synctex.gz
|
|
27
|
+
book/main.pdf
|
|
28
|
+
*.ipynb_checkpoints
|
|
29
|
+
book/_check_tmp/
|
|
30
|
+
book/_check.tex
|
|
31
|
+
docs/_build/
|
|
32
|
+
docs/api/generated/
|
|
33
|
+
docs/_build_log.txt
|
|
34
|
+
book/_build/
|
|
35
|
+
.coverage
|
|
36
|
+
book/_build_new/
|
|
37
|
+
book/_check_*.tex
|
|
38
|
+
book/cover/*.aux
|
|
39
|
+
book/cover/*.log
|
|
40
|
+
book/cover/*.fls
|
|
41
|
+
book/cover/*.fdb_latexmk
|
|
42
|
+
book/cover/cover_*.pdf
|
|
43
|
+
book/cover/logo.svg
|
|
44
|
+
*.blg
|
|
45
|
+
book/_build_epub/
|
|
46
|
+
book/_build_web/
|
|
47
|
+
docs/_gallery_src/
|
|
48
|
+
|
|
49
|
+
# generated by docs/build_api_pages.py and the gallery
|
|
50
|
+
docs/api/generated/
|
|
51
|
+
# LaTeX intermediates of the cover
|
|
52
|
+
book/cover/*.aux
|
|
53
|
+
book/cover/*.log
|
srdkit-1.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0 (2026-11-29)
|
|
4
|
+
|
|
5
|
+
First public release, together with the documentation and the book
|
|
6
|
+
*Sum of Ranking Differences in Python: The srdkit toolbox*.
|
|
7
|
+
|
|
8
|
+
**The published SRD methods**
|
|
9
|
+
|
|
10
|
+
- SRD with mid-ranks for ties, every data-fusion reference (mean, median,
|
|
11
|
+
minimum, maximum, mixed row rules, trimmed, weighted, geometric, mean rank),
|
|
12
|
+
normalization by the theoretical or attainable maximum, pairwise SRD.
|
|
13
|
+
- CRRN randomization test, cross-validation (random, k-fold, contiguous,
|
|
14
|
+
leave-one-out, bootstrap, 5x2) with Wilcoxon, Dietterich and Alpaydin tests,
|
|
15
|
+
SRD-ANOVA with post hoc tests.
|
|
16
|
+
- Weighted and top-k SRD, rank distances (Kendall, Cayley, Ulam, Hamming,
|
|
17
|
+
Spearman, Chebyshev, Cayley-footrule), the value-based DnE and DnM with their
|
|
18
|
+
randomization test and cross-validation, utility-based SRD (uSRD).
|
|
19
|
+
- Promethee II, P-SRD, GAIA, sparse GAIA and P-PFA; NMF-SRD many-objective
|
|
20
|
+
ranking; post-Pareto analysis; MCDM methods and their SRD consensus.
|
|
21
|
+
- SRD-ordered parallel coordinates with the deviation angle; model-merit
|
|
22
|
+
fusion; consensus outliers; SRD-ROC; PCM and GPCM with the conditional exact
|
|
23
|
+
and Williams' tests.
|
|
24
|
+
- SRD-derived weights and weighted references; the COVAT heatmap; the
|
|
25
|
+
seven-method consensus framework for fair comparison (SRD, DnE, DnM, HM,
|
|
26
|
+
CEpW, WtpW, power-weakness ratio).
|
|
27
|
+
|
|
28
|
+
**New in srdkit**
|
|
29
|
+
|
|
30
|
+
- Exact null distribution of SRD for any number of objects and any tie
|
|
31
|
+
pattern (dynamic programme over a sweep), exact moments with ties.
|
|
32
|
+
- Footrule-optimal (assignment) and Kemeny consensus references,
|
|
33
|
+
leave-one-out references.
|
|
34
|
+
- Corrected resampled t-test, Friedman test with critical differences,
|
|
35
|
+
compact letter display, power analysis.
|
|
36
|
+
- Soft ranks, exact normalization of weighted SRD, permutation null of DnE
|
|
37
|
+
and DnM, row scaling for value-based SRD.
|
|
38
|
+
- Self-consistent data-driven weights, SRD-based criterion weights,
|
|
39
|
+
proficiency-test z-scores and leave-one-method-out diagnostics.
|
|
40
|
+
- SRD maps and constellations, travelling-salesman orderings of parallel
|
|
41
|
+
coordinates, segmentation of ranking sequences and range-dependent agreement,
|
|
42
|
+
diagnostics, criteria reduction and one-call reports.
|
srdkit-1.0/CITATION.cff
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use srdkit, please cite it as below, together with the original publications of the methods you use."
|
|
3
|
+
type: software
|
|
4
|
+
title: "srdkit: sum of ranking differences in Python"
|
|
5
|
+
version: "1.0"
|
|
6
|
+
date-released: 2026-11-29
|
|
7
|
+
license: MIT
|
|
8
|
+
repository-code: "https://github.com/ComplexSystemsIntelligence/srdkit"
|
|
9
|
+
url: "https://complexsystemsintelligence.github.io/srdkit"
|
|
10
|
+
authors:
|
|
11
|
+
- family-names: Héberger
|
|
12
|
+
given-names: Károly
|
|
13
|
+
affiliation: "HUN-REN Research Centre for Natural Sciences, Budapest, Hungary"
|
|
14
|
+
- family-names: Ipkovich
|
|
15
|
+
given-names: Ádám
|
|
16
|
+
affiliation: "University of Pannonia, Veszprém, Hungary"
|
|
17
|
+
- family-names: Abonyi
|
|
18
|
+
given-names: János
|
|
19
|
+
affiliation: "University of Pannonia, Veszprém, Hungary"
|
|
20
|
+
orcid: "https://orcid.org/0000-0001-8593-1493"
|
|
21
|
+
keywords:
|
|
22
|
+
- sum of ranking differences
|
|
23
|
+
- SRD
|
|
24
|
+
- method comparison
|
|
25
|
+
- model comparison
|
|
26
|
+
- multicriteria decision making
|
|
27
|
+
- ranking
|
|
28
|
+
- randomization test
|
|
29
|
+
- cross-validation
|
|
30
|
+
- chemometrics
|
|
31
|
+
references:
|
|
32
|
+
- type: article
|
|
33
|
+
title: "Sum of ranking differences compares methods or models fairly"
|
|
34
|
+
authors:
|
|
35
|
+
- family-names: Héberger
|
|
36
|
+
given-names: Károly
|
|
37
|
+
journal: "TrAC Trends in Analytical Chemistry"
|
|
38
|
+
volume: 29
|
|
39
|
+
start: 101
|
|
40
|
+
end: 109
|
|
41
|
+
year: 2010
|
|
42
|
+
doi: 10.1016/j.trac.2009.09.009
|
|
43
|
+
- type: article
|
|
44
|
+
title: "Sum of ranking differences for method discrimination and its validation: comparison of ranks with random numbers"
|
|
45
|
+
authors:
|
|
46
|
+
- family-names: Héberger
|
|
47
|
+
given-names: Károly
|
|
48
|
+
- family-names: Kollár-Hunek
|
|
49
|
+
given-names: Klára
|
|
50
|
+
journal: "Journal of Chemometrics"
|
|
51
|
+
volume: 25
|
|
52
|
+
start: 151
|
|
53
|
+
end: 158
|
|
54
|
+
year: 2011
|
|
55
|
+
doi: 10.1002/cem.1320
|
|
56
|
+
- type: article
|
|
57
|
+
title: "Sum of Euclidean distance differences and sum of absolute Manhattan distance differences: multicriteria decision making tools for small data tables"
|
|
58
|
+
authors:
|
|
59
|
+
- family-names: Héberger
|
|
60
|
+
given-names: Károly
|
|
61
|
+
journal: "Analytica Chimica Acta"
|
|
62
|
+
volume: 1381
|
|
63
|
+
start: 344649
|
|
64
|
+
year: 2026
|
|
65
|
+
doi: 10.1016/j.aca.2025.344649
|
|
66
|
+
- type: article
|
|
67
|
+
title: "Framework for fair model comparison as standard for multicriteria decision making"
|
|
68
|
+
authors:
|
|
69
|
+
- family-names: Héberger
|
|
70
|
+
given-names: Károly
|
|
71
|
+
journal: "Decision Making and Analysis"
|
|
72
|
+
volume: 4
|
|
73
|
+
issue: 1
|
|
74
|
+
start: 257
|
|
75
|
+
end: 283
|
|
76
|
+
year: 2026
|
srdkit-1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Károly Héberger, Ádám Ipkovich, János Abonyi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
srdkit-1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: srdkit
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: Sum of Ranking Differences (SRD) in Python: the complete SRD family (classic, tied, weighted, value-based DnE/DnM, utility-based uSRD, Promethee P-SRD, NMF-SRD), exact null distributions for any tie pattern, cross-validation tests, SRD-ANOVA, data-driven weights, a tested consensus of complementary MCDM methods, GPCM, fusion, segmentation, representation and visualization.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ComplexSystemsIntelligence/srdkit
|
|
6
|
+
Project-URL: Documentation, https://complexsystemsintelligence.github.io/srdkit
|
|
7
|
+
Project-URL: Repository, https://github.com/ComplexSystemsIntelligence/srdkit
|
|
8
|
+
Project-URL: Issues, https://github.com/ComplexSystemsIntelligence/srdkit/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/ComplexSystemsIntelligence/srdkit/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Book (PDF), https://complexsystemsintelligence.github.io/srdkit/srdkit-book.pdf
|
|
11
|
+
Author: Ádám Ipkovich
|
|
12
|
+
Author-email: Károly Héberger <heberger.karoly@ttk.hu>, János Abonyi <janos@abonyilab.com>
|
|
13
|
+
Maintainer-email: János Abonyi <janos@abonyilab.com>
|
|
14
|
+
License-Expression: MIT
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Keywords: MCDM,Promethee,SRD,Spearman footrule,chemometrics,cross-validation,method comparison,model comparison,multicriteria decision making,parallel coordinates,permutation test,rank aggregation,ranking,sum of ranking differences
|
|
17
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering
|
|
27
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
29
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
30
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
31
|
+
Requires-Python: >=3.10
|
|
32
|
+
Requires-Dist: matplotlib>=3.7
|
|
33
|
+
Requires-Dist: numpy>=1.24
|
|
34
|
+
Requires-Dist: pandas>=2.0
|
|
35
|
+
Requires-Dist: scipy>=1.11
|
|
36
|
+
Provides-Extra: all
|
|
37
|
+
Requires-Dist: openpyxl>=3.1; extra == 'all'
|
|
38
|
+
Requires-Dist: scikit-learn>=1.3; extra == 'all'
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: build; extra == 'dev'
|
|
41
|
+
Requires-Dist: myst-parser; extra == 'dev'
|
|
42
|
+
Requires-Dist: numpydoc; extra == 'dev'
|
|
43
|
+
Requires-Dist: openpyxl>=3.1; extra == 'dev'
|
|
44
|
+
Requires-Dist: pydata-sphinx-theme; extra == 'dev'
|
|
45
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
47
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
48
|
+
Requires-Dist: scikit-learn>=1.3; extra == 'dev'
|
|
49
|
+
Requires-Dist: sphinx-copybutton; extra == 'dev'
|
|
50
|
+
Requires-Dist: sphinx-design; extra == 'dev'
|
|
51
|
+
Requires-Dist: sphinx-gallery>=0.15; extra == 'dev'
|
|
52
|
+
Requires-Dist: sphinx>=7; extra == 'dev'
|
|
53
|
+
Requires-Dist: twine; extra == 'dev'
|
|
54
|
+
Provides-Extra: docs
|
|
55
|
+
Requires-Dist: myst-parser; extra == 'docs'
|
|
56
|
+
Requires-Dist: numpydoc; extra == 'docs'
|
|
57
|
+
Requires-Dist: openpyxl>=3.1; extra == 'docs'
|
|
58
|
+
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
|
|
59
|
+
Requires-Dist: sphinx-copybutton; extra == 'docs'
|
|
60
|
+
Requires-Dist: sphinx-design; extra == 'docs'
|
|
61
|
+
Requires-Dist: sphinx-gallery>=0.15; extra == 'docs'
|
|
62
|
+
Requires-Dist: sphinx>=7; extra == 'docs'
|
|
63
|
+
Provides-Extra: excel
|
|
64
|
+
Requires-Dist: openpyxl>=3.1; extra == 'excel'
|
|
65
|
+
Provides-Extra: ml
|
|
66
|
+
Requires-Dist: scikit-learn>=1.3; extra == 'ml'
|
|
67
|
+
Provides-Extra: test
|
|
68
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
69
|
+
Requires-Dist: pytest>=7; extra == 'test'
|
|
70
|
+
Description-Content-Type: text/markdown
|
|
71
|
+
|
|
72
|
+
<p align="center"><img src="https://raw.githubusercontent.com/ComplexSystemsIntelligence/srdkit/main/docs/_static/banner.png" alt="srdkit: sum of ranking differences in Python"></p>
|
|
73
|
+
|
|
74
|
+
# srdkit: sum of ranking differences in Python
|
|
75
|
+
|
|
76
|
+
[](https://github.com/ComplexSystemsIntelligence/srdkit/actions/workflows/ci.yml)
|
|
77
|
+
[](https://complexsystemsintelligence.github.io/srdkit)
|
|
78
|
+
[](https://complexsystemsintelligence.github.io/srdkit/book.html)
|
|
79
|
+
[](https://pypi.org/project/srdkit/)
|
|
80
|
+
[](https://github.com/ComplexSystemsIntelligence/srdkit/blob/main/LICENSE)
|
|
81
|
+
|
|
82
|
+
**srdkit** compares methods, models, laboratories, experts or alternatives
|
|
83
|
+
fairly. The sum of ranking differences (SRD) of Héberger
|
|
84
|
+
([TrAC 29: 101–109, 2010](https://doi.org/10.1016/j.trac.2009.09.009)) ranks
|
|
85
|
+
every solution and a reference — a gold standard or a consensus fused from the
|
|
86
|
+
data — and sums the absolute rank differences. Two statistical validations
|
|
87
|
+
follow: a randomization test (comparison of ranks with random numbers, CRRN)
|
|
88
|
+
and cross-validation. SRD needs no weights, and the classical multicriteria
|
|
89
|
+
decision-making (MCDM) methods offer no such validation of their rankings
|
|
90
|
+
(Héberger, [Anal. Chim. Acta 1381: 344649, 2026](https://doi.org/10.1016/j.aca.2025.344649)).
|
|
91
|
+
|
|
92
|
+
The package implements the published SRD methods — of Héberger and co-workers,
|
|
93
|
+
of the authors' group and of others — and adds new ones.
|
|
94
|
+
|
|
95
|
+
| Module | Contents |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `srdkit.core`, `ranking`, `reference` | SRD with mid-ranks, every data-fusion reference (mean, median, min, max, mixed, trimmed, weighted, mean rank), footrule-optimal and Kemeny consensus, leave-one-out references, pairwise SRD, a scikit-learn style estimator |
|
|
98
|
+
| `srdkit.distribution`, `validation`, `anova` | **exact null distribution for any number of objects and any ties** (new), exact moments, rSRD-compatible Monte Carlo options; CRRN; cross-validation (random, k-fold, contiguous, LOO, bootstrap, 5x2) with Wilcoxon, Dietterich, Alpaydin, Nadeau–Bengio, sign and permutation tests; Friedman test, critical differences, letter displays; SRD-ANOVA |
|
|
99
|
+
| `srdkit.distances`, `weighted`, `value`, `utility` | Kendall, Cayley, Ulam, Hamming, Spearman, Chebyshev and Cayley–footrule distances with exact nulls; weighted and top-k SRD with exact normalization; soft ranks; **DnE and DnM** beyond the ranks with randomization test and cross-validation; utility-based SRD (uSRD) |
|
|
100
|
+
| `srdkit.promethee`, `mcda`, `pareto`, `nmf` | Promethee II, P-SRD, GAIA, sparse GAIA, P-PFA; eleven MCDM methods and objective weights; non-dominated sorting, post-Pareto SRD; NMF-SRD many-objective ranking |
|
|
101
|
+
| `srdkit.weights`, `tournament`, `framework` | SRD-derived weights and weighted references (Gere et al. 2022), self-consistent weighting (new); power–weakness ratio and sPWR; **the seven-method consensus framework of Héberger (2026)** — SRD, DnE, DnM, COVAT heatmap, CEpW, WtpW, DRAPE/PWR — with Friedman, Wilcoxon and leave-one-method-out tests |
|
|
102
|
+
| `srdkit.parcoord`, `representation`, `clustering`, `viz` | SRD-ordered parallel coordinates with the deviation angle (Ipkovich et al. 2021) and crossing-minimal orderings; SRD maps and constellations; heatmaps, dendrograms, similarity groups; all plots |
|
|
103
|
+
| `srdkit.segmentation`, `fusion`, `gpcm` | regimes of ranking sequences, range-dependent agreement; model-merit fusion, consensus outliers, SRD-ROC; PCM and GPCM with conditional exact and Williams' tests |
|
|
104
|
+
| `srdkit.diagnostics`, `report` | object influence, reference and tie sensitivity, noise robustness, power analysis, criteria reduction; the one-call report |
|
|
105
|
+
|
|
106
|
+
## Installation
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pip install srdkit
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Python ≥ 3.10; depends on numpy, scipy, pandas and matplotlib.
|
|
113
|
+
|
|
114
|
+
## Quick start
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import srdkit as sk
|
|
118
|
+
|
|
119
|
+
X, y = sk.datasets.small_example() # 8 objects (rows), 5 solutions (columns), a gold standard
|
|
120
|
+
res = sk.srd(X, reference=y) # or reference="mean", "max", "min", "mixed", ...
|
|
121
|
+
val = res.validate() # exact randomization test: similar / random / reversed
|
|
122
|
+
cv = res.cross_validate(n_folds=8) # uncertainties
|
|
123
|
+
print(cv.test()) # Wilcoxon tests of neighbouring solutions
|
|
124
|
+
sk.viz.plot_srd(res, val) # the classical SRD plot
|
|
125
|
+
|
|
126
|
+
sk.dne(X, reference=y) # beyond ranks: sum of Euclidean distance differences
|
|
127
|
+
fc = sk.fair_comparison(X, reference=y) # tested consensus of seven complementary methods
|
|
128
|
+
print(fc.summary())
|
|
129
|
+
print(sk.analyze(X, reference=y).to_markdown()) # the whole analysis as a report
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Documentation and book
|
|
133
|
+
|
|
134
|
+
* Documentation with the example gallery and the API: https://complexsystemsintelligence.github.io/srdkit
|
|
135
|
+
* The book *Sum of Ranking Differences in Python: The srdkit toolbox* (CC BY 4.0) is built from `book/`;
|
|
136
|
+
every computed figure comes from a script of the gallery.
|
|
137
|
+
|
|
138
|
+
## Citing
|
|
139
|
+
|
|
140
|
+
K. Héberger, Á. Ipkovich, J. Abonyi, *srdkit: sum of ranking differences in Python*, version 1.0, 2026.
|
|
141
|
+
Please cite also the original publications of the methods you use; see `CITATION.cff` and the
|
|
142
|
+
[citing page](https://complexsystemsintelligence.github.io/srdkit/citing.html).
|
|
143
|
+
|
|
144
|
+
## Acknowledgement
|
|
145
|
+
|
|
146
|
+
Supported by the National Research, Development and Innovation Office of Hungary (NKFIH) through the
|
|
147
|
+
OTKA 143482 project.
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT for the software, CC BY 4.0 for the book.
|
srdkit-1.0/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/ComplexSystemsIntelligence/srdkit/main/docs/_static/banner.png" alt="srdkit: sum of ranking differences in Python"></p>
|
|
2
|
+
|
|
3
|
+
# srdkit: sum of ranking differences in Python
|
|
4
|
+
|
|
5
|
+
[](https://github.com/ComplexSystemsIntelligence/srdkit/actions/workflows/ci.yml)
|
|
6
|
+
[](https://complexsystemsintelligence.github.io/srdkit)
|
|
7
|
+
[](https://complexsystemsintelligence.github.io/srdkit/book.html)
|
|
8
|
+
[](https://pypi.org/project/srdkit/)
|
|
9
|
+
[](https://github.com/ComplexSystemsIntelligence/srdkit/blob/main/LICENSE)
|
|
10
|
+
|
|
11
|
+
**srdkit** compares methods, models, laboratories, experts or alternatives
|
|
12
|
+
fairly. The sum of ranking differences (SRD) of Héberger
|
|
13
|
+
([TrAC 29: 101–109, 2010](https://doi.org/10.1016/j.trac.2009.09.009)) ranks
|
|
14
|
+
every solution and a reference — a gold standard or a consensus fused from the
|
|
15
|
+
data — and sums the absolute rank differences. Two statistical validations
|
|
16
|
+
follow: a randomization test (comparison of ranks with random numbers, CRRN)
|
|
17
|
+
and cross-validation. SRD needs no weights, and the classical multicriteria
|
|
18
|
+
decision-making (MCDM) methods offer no such validation of their rankings
|
|
19
|
+
(Héberger, [Anal. Chim. Acta 1381: 344649, 2026](https://doi.org/10.1016/j.aca.2025.344649)).
|
|
20
|
+
|
|
21
|
+
The package implements the published SRD methods — of Héberger and co-workers,
|
|
22
|
+
of the authors' group and of others — and adds new ones.
|
|
23
|
+
|
|
24
|
+
| Module | Contents |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `srdkit.core`, `ranking`, `reference` | SRD with mid-ranks, every data-fusion reference (mean, median, min, max, mixed, trimmed, weighted, mean rank), footrule-optimal and Kemeny consensus, leave-one-out references, pairwise SRD, a scikit-learn style estimator |
|
|
27
|
+
| `srdkit.distribution`, `validation`, `anova` | **exact null distribution for any number of objects and any ties** (new), exact moments, rSRD-compatible Monte Carlo options; CRRN; cross-validation (random, k-fold, contiguous, LOO, bootstrap, 5x2) with Wilcoxon, Dietterich, Alpaydin, Nadeau–Bengio, sign and permutation tests; Friedman test, critical differences, letter displays; SRD-ANOVA |
|
|
28
|
+
| `srdkit.distances`, `weighted`, `value`, `utility` | Kendall, Cayley, Ulam, Hamming, Spearman, Chebyshev and Cayley–footrule distances with exact nulls; weighted and top-k SRD with exact normalization; soft ranks; **DnE and DnM** beyond the ranks with randomization test and cross-validation; utility-based SRD (uSRD) |
|
|
29
|
+
| `srdkit.promethee`, `mcda`, `pareto`, `nmf` | Promethee II, P-SRD, GAIA, sparse GAIA, P-PFA; eleven MCDM methods and objective weights; non-dominated sorting, post-Pareto SRD; NMF-SRD many-objective ranking |
|
|
30
|
+
| `srdkit.weights`, `tournament`, `framework` | SRD-derived weights and weighted references (Gere et al. 2022), self-consistent weighting (new); power–weakness ratio and sPWR; **the seven-method consensus framework of Héberger (2026)** — SRD, DnE, DnM, COVAT heatmap, CEpW, WtpW, DRAPE/PWR — with Friedman, Wilcoxon and leave-one-method-out tests |
|
|
31
|
+
| `srdkit.parcoord`, `representation`, `clustering`, `viz` | SRD-ordered parallel coordinates with the deviation angle (Ipkovich et al. 2021) and crossing-minimal orderings; SRD maps and constellations; heatmaps, dendrograms, similarity groups; all plots |
|
|
32
|
+
| `srdkit.segmentation`, `fusion`, `gpcm` | regimes of ranking sequences, range-dependent agreement; model-merit fusion, consensus outliers, SRD-ROC; PCM and GPCM with conditional exact and Williams' tests |
|
|
33
|
+
| `srdkit.diagnostics`, `report` | object influence, reference and tie sensitivity, noise robustness, power analysis, criteria reduction; the one-call report |
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install srdkit
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Python ≥ 3.10; depends on numpy, scipy, pandas and matplotlib.
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
import srdkit as sk
|
|
47
|
+
|
|
48
|
+
X, y = sk.datasets.small_example() # 8 objects (rows), 5 solutions (columns), a gold standard
|
|
49
|
+
res = sk.srd(X, reference=y) # or reference="mean", "max", "min", "mixed", ...
|
|
50
|
+
val = res.validate() # exact randomization test: similar / random / reversed
|
|
51
|
+
cv = res.cross_validate(n_folds=8) # uncertainties
|
|
52
|
+
print(cv.test()) # Wilcoxon tests of neighbouring solutions
|
|
53
|
+
sk.viz.plot_srd(res, val) # the classical SRD plot
|
|
54
|
+
|
|
55
|
+
sk.dne(X, reference=y) # beyond ranks: sum of Euclidean distance differences
|
|
56
|
+
fc = sk.fair_comparison(X, reference=y) # tested consensus of seven complementary methods
|
|
57
|
+
print(fc.summary())
|
|
58
|
+
print(sk.analyze(X, reference=y).to_markdown()) # the whole analysis as a report
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Documentation and book
|
|
62
|
+
|
|
63
|
+
* Documentation with the example gallery and the API: https://complexsystemsintelligence.github.io/srdkit
|
|
64
|
+
* The book *Sum of Ranking Differences in Python: The srdkit toolbox* (CC BY 4.0) is built from `book/`;
|
|
65
|
+
every computed figure comes from a script of the gallery.
|
|
66
|
+
|
|
67
|
+
## Citing
|
|
68
|
+
|
|
69
|
+
K. Héberger, Á. Ipkovich, J. Abonyi, *srdkit: sum of ranking differences in Python*, version 1.0, 2026.
|
|
70
|
+
Please cite also the original publications of the methods you use; see `CITATION.cff` and the
|
|
71
|
+
[citing page](https://complexsystemsintelligence.github.io/srdkit/citing.html).
|
|
72
|
+
|
|
73
|
+
## Acknowledgement
|
|
74
|
+
|
|
75
|
+
Supported by the National Research, Development and Innovation Office of Hungary (NKFIH) through the
|
|
76
|
+
OTKA 143482 project.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT for the software, CC BY 4.0 for the book.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""
|
|
2
|
+
First steps: the sum of ranking differences
|
|
3
|
+
============================================
|
|
4
|
+
|
|
5
|
+
Five methods estimate a property of eight samples, and a reference value is
|
|
6
|
+
known for every sample. SRD ranks every column, compares the ranks with the
|
|
7
|
+
ranks of the reference and sums the absolute differences. The smaller the sum,
|
|
8
|
+
the closer the method to the reference. The values are normalized by the largest
|
|
9
|
+
possible SRD, :math:`\\lfloor n^2/2\\rfloor`, the SRD of the reversed ranking.
|
|
10
|
+
|
|
11
|
+
The table is invented for teaching: M1 follows the reference, M2 swaps two
|
|
12
|
+
pairs, M3 is noisy, M4 is almost random and M5 reverses the order.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import matplotlib.pyplot as plt
|
|
16
|
+
|
|
17
|
+
import srdkit as sk
|
|
18
|
+
from srdkit import viz
|
|
19
|
+
|
|
20
|
+
# %%
|
|
21
|
+
# Computing SRD
|
|
22
|
+
# -------------
|
|
23
|
+
# [snippet:compute]
|
|
24
|
+
X, y = sk.datasets.small_example()
|
|
25
|
+
res = sk.srd(X, reference=y) # an external reference (gold standard)
|
|
26
|
+
print(res)
|
|
27
|
+
print("ranks of M2:", res.ranks["M2"].tolist())
|
|
28
|
+
print("reference ranks:", res.reference_ranks.tolist())
|
|
29
|
+
print("|differences| of M2:", res.contributions["M2"].tolist())
|
|
30
|
+
# [/snippet:compute]
|
|
31
|
+
|
|
32
|
+
# %%
|
|
33
|
+
# The classical SRD plot
|
|
34
|
+
# ----------------------
|
|
35
|
+
# Every method is a line at its normalized SRD. The black curve is the
|
|
36
|
+
# cumulative distribution of SRD values of random rankings of eight objects
|
|
37
|
+
# (computed exactly); the dotted lines mark its 5% (XX1), 50% (Med) and 95%
|
|
38
|
+
# (XX19) points. Lines left of XX1 are better than random, lines right of XX19
|
|
39
|
+
# are reversed.
|
|
40
|
+
# [snippet:plot]
|
|
41
|
+
val = res.validate() # comparison of ranks with random numbers
|
|
42
|
+
print(val.table)
|
|
43
|
+
ax = viz.plot_srd(res, val)
|
|
44
|
+
# [/snippet:plot]
|
|
45
|
+
|
|
46
|
+
# %%
|
|
47
|
+
# The contributions of the objects
|
|
48
|
+
# --------------------------------
|
|
49
|
+
# The absolute rank differences show *which* samples a method misplaces.
|
|
50
|
+
fig, axs = plt.subplots(1, 2, figsize=(10, 3.6))
|
|
51
|
+
viz.plot_contributions(res, ax=axs[0])
|
|
52
|
+
viz.plot_rank_flow(res, columns=["M2", "M3", "M4"], ax=axs[1])
|
|
53
|
+
fig.tight_layout()
|
|
54
|
+
|
|
55
|
+
# %%
|
|
56
|
+
# Parameter study: the number of objects
|
|
57
|
+
# --------------------------------------
|
|
58
|
+
# The same relative agreement is more convincing with more objects: the band
|
|
59
|
+
# between XX1 and XX19 narrows around the expected value 2/3 of random rankings.
|
|
60
|
+
for n in (5, 8, 13, 20, 50, 100):
|
|
61
|
+
p = sk.null_distribution(n=n).percentiles()
|
|
62
|
+
print(f"n={n:3d} XX1={p['XX1']:.3f} Med={p['Med']:.3f} XX19={p['XX19']:.3f}")
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Choosing the reference
|
|
3
|
+
======================
|
|
4
|
+
|
|
5
|
+
When no gold standard exists, the reference is fused from the data row by row:
|
|
6
|
+
the row mean (random errors cancel), the median (robust to outliers), the
|
|
7
|
+
minimum (for errors) or maximum (for accuracies), a different rule per row, or a
|
|
8
|
+
rank aggregate. Here six methods measure a latent property with increasing
|
|
9
|
+
noise; one of them (M6) measures a *nonlinear and non-monotone* transform. We
|
|
10
|
+
compare the SRD values obtained with different references with those obtained
|
|
11
|
+
with the truth.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import matplotlib.pyplot as plt
|
|
15
|
+
import pandas as pd
|
|
16
|
+
|
|
17
|
+
import srdkit as sk
|
|
18
|
+
from srdkit import viz
|
|
19
|
+
|
|
20
|
+
# %%
|
|
21
|
+
# Data with a known truth
|
|
22
|
+
# -----------------------
|
|
23
|
+
# [snippet:data]
|
|
24
|
+
X, truth = sk.datasets.make_method_comparison(
|
|
25
|
+
n_objects=25, noise=(0.1, 0.3, 0.6, 1.0, 1.5, 0.3),
|
|
26
|
+
nonlinear=[None, None, None, None, None, "square"], random_state=7)
|
|
27
|
+
# [/snippet:data]
|
|
28
|
+
|
|
29
|
+
# %%
|
|
30
|
+
# SRD under several references
|
|
31
|
+
# ----------------------------
|
|
32
|
+
# [snippet:references]
|
|
33
|
+
refs = {"truth": truth.to_numpy(), "mean": "mean", "median": "median", "borda": "borda",
|
|
34
|
+
"consensus": "consensus", "kemeny": "kemeny", "pc1": "pc1", "loo-mean": "loo-mean"}
|
|
35
|
+
table = pd.DataFrame({name: sk.srd(X, reference=r).percent for name, r in refs.items()})
|
|
36
|
+
print(table.round(1))
|
|
37
|
+
# [/snippet:references]
|
|
38
|
+
|
|
39
|
+
fig, ax = plt.subplots(figsize=(7.5, 3.6))
|
|
40
|
+
for k, col in enumerate(table.columns):
|
|
41
|
+
ax.plot(table.index, table[col], marker="o", ms=4, lw=1.2 if col != "truth" else 2.5,
|
|
42
|
+
color="#009E73" if col == "truth" else viz._style.CATEGORICAL[k % 8], label=col)
|
|
43
|
+
ax.set_ylabel("SRD (%)")
|
|
44
|
+
ax.legend(fontsize=7, ncol=4, frameon=False)
|
|
45
|
+
viz._style.despine(ax)
|
|
46
|
+
|
|
47
|
+
# %%
|
|
48
|
+
# Self-influence and the leave-one-out reference
|
|
49
|
+
# ----------------------------------------------
|
|
50
|
+
# A reference fused with the participation of a method is pulled towards that
|
|
51
|
+
# method. The leave-one-out reference of a method excludes it; the difference
|
|
52
|
+
# matters when few methods are compared.
|
|
53
|
+
for m in (3, 4, 6, 10):
|
|
54
|
+
Xs, t = sk.datasets.make_method_comparison(20, noise=tuple([0.5] * m), random_state=1)
|
|
55
|
+
a = sk.srd(Xs, reference="mean").percent.mean()
|
|
56
|
+
b = sk.srd(Xs, reference="loo-mean").percent.mean()
|
|
57
|
+
print(f"{m:2d} methods: mean SRD% with mean reference {a:5.1f}, with leave-one-out reference {b:5.1f}")
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Ties, rank conventions and soft ranks
|
|
3
|
+
=====================================
|
|
4
|
+
|
|
5
|
+
Rounded measurements produce ties. SRD gives tied values the mean of the
|
|
6
|
+
positions they occupy (mid-ranks; Kollár-Hunek and Héberger, 2013). Other
|
|
7
|
+
conventions change SRD slightly; the exact null distribution of srdkit takes the
|
|
8
|
+
tie pattern of every column into account. Soft ranks — the expected ranks under a
|
|
9
|
+
small Gaussian measurement error — make SRD a continuous function of the data:
|
|
10
|
+
equal values get half a rank each from the other, exactly the mid-rank.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import matplotlib.pyplot as plt
|
|
14
|
+
import numpy as np
|
|
15
|
+
|
|
16
|
+
import srdkit as sk
|
|
17
|
+
from srdkit import viz
|
|
18
|
+
|
|
19
|
+
# %%
|
|
20
|
+
# Rank conventions
|
|
21
|
+
# ----------------
|
|
22
|
+
# [snippet:ties]
|
|
23
|
+
x = np.array([3.1, 2.0, 2.0, 5.4, 3.1, 3.1, 1.2])
|
|
24
|
+
for t in ("average", "min", "max", "dense", "ordinal"):
|
|
25
|
+
print(f"{t:8s}", sk.ranking.rank_vector(x, ties=t))
|
|
26
|
+
print("tie blocks:", sk.ranking.tie_blocks(x), " tie probability:", sk.ranking.tie_probability(x))
|
|
27
|
+
# [/snippet:ties]
|
|
28
|
+
|
|
29
|
+
# %%
|
|
30
|
+
# Rounding creates ties; SRD reacts
|
|
31
|
+
# ---------------------------------
|
|
32
|
+
X, truth = sk.datasets.make_method_comparison(20, noise=(0.3, 0.3, 0.3, 0.3), decimals=(3, 1, 0, -1), random_state=3)
|
|
33
|
+
print(sk.diagnostics.tie_sensitivity(X, reference=truth.to_numpy()).round(3))
|
|
34
|
+
|
|
35
|
+
# %%
|
|
36
|
+
# The null distribution depends on the ties
|
|
37
|
+
# -----------------------------------------
|
|
38
|
+
# [snippet:tiedist]
|
|
39
|
+
d0 = sk.null_distribution(n=12)
|
|
40
|
+
xt = sk.ranking.rank_vector([1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8])
|
|
41
|
+
d1 = sk.null_distribution(xt, None, n=12)
|
|
42
|
+
print("no ties: ", {k: round(v, 3) for k, v in d0.percentiles().items()})
|
|
43
|
+
print("with ties: ", {k: round(v, 3) for k, v in d1.percentiles().items()})
|
|
44
|
+
# [/snippet:tiedist]
|
|
45
|
+
fig, ax = plt.subplots(figsize=(6.5, 3.2))
|
|
46
|
+
viz.plot_distribution(d0, ax=ax, cumulative=True, label="no ties")
|
|
47
|
+
viz.plot_distribution(d1, ax=ax, cumulative=True, color="#D55E00", label="solution with ties")
|
|
48
|
+
ax.legend(frameon=False, fontsize=8)
|
|
49
|
+
|
|
50
|
+
# %%
|
|
51
|
+
# Parameter study: the soft-rank error
|
|
52
|
+
# ------------------------------------
|
|
53
|
+
# As sigma grows, close values blend; SRD becomes smooth and less sensitive to
|
|
54
|
+
# measurement noise. sigma -> 0 recovers SRD with mid-ranks.
|
|
55
|
+
for s in (1e-6, 0.02, 0.05, 0.1, 0.3):
|
|
56
|
+
print(f"sigma={s:<6} soft SRD%:", sk.soft_srd(X, reference=truth.to_numpy(), sigma=s).percent.round(1).tolist())
|