drift-detectors-pack 0.5.3__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.
- drift_detectors_pack-0.5.3/LICENSE +201 -0
- drift_detectors_pack-0.5.3/PKG-INFO +348 -0
- drift_detectors_pack-0.5.3/README.md +294 -0
- drift_detectors_pack-0.5.3/pyproject.toml +123 -0
- drift_detectors_pack-0.5.3/setup.cfg +4 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/__init__.py +74 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/drift_detector.py +116 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/README.md +23 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/__init__.py +26 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/acf.py +43 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/base.py +48 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/dtw.py +54 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/lagged_corr.py +45 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/metadata.yaml +43 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/mse.py +25 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/pearson.py +32 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/disagreement_metrics/spearman.py +32 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/model_disagreement/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/model_disagreement/detector.py +252 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/model_disagreement/metadata.yaml +69 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/model_based/model_disagreement/usage.md +41 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/c2st/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/c2st/detector.py +108 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/c2st/metadata.yaml +48 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/c2st/usage.md +75 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/energy_distance/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/energy_distance/detector.py +101 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/energy_distance/metadata.yaml +45 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/energy_distance/usage.md +74 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/hdddm/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/hdddm/detector.py +40 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/hdddm/metadata.yaml +35 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/hdddm/usage.md +72 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/kdq_tree/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/kdq_tree/detector.py +89 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/kdq_tree/metadata.yaml +62 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/kdq_tree/usage.md +67 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mmd/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mmd/detector.py +115 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mmd/metadata.yaml +55 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mmd/usage.md +65 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mmd_linear/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mmd_linear/detector.py +74 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mmd_linear/metadata.yaml +37 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mmd_linear/usage.md +75 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mv_ks/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mv_ks/detector.py +49 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mv_ks/metadata.yaml +40 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/mv_ks/usage.md +74 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/nn_two_sample/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/nn_two_sample/detector.py +59 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/nn_two_sample/metadata.yaml +39 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/nn_two_sample/usage.md +74 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/pca_cd/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/pca_cd/detector.py +105 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/pca_cd/metadata.yaml +53 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/pca_cd/usage.md +73 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/pca_recon/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/pca_recon/detector.py +56 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/pca_recon/metadata.yaml +39 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/multivariate/pca_recon/usage.md +75 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/adwin/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/adwin/detector.py +76 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/adwin/metadata.yaml +46 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/adwin/usage.md +69 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/bhattacharyya/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/bhattacharyya/detector.py +15 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/bhattacharyya/metadata.yaml +38 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/bhattacharyya/usage.md +84 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/chi_square/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/chi_square/detector.py +14 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/chi_square/metadata.yaml +38 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/chi_square/usage.md +84 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/cramer_von_mises/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/cramer_von_mises/detector.py +18 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/cramer_von_mises/metadata.yaml +36 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/cramer_von_mises/usage.md +84 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/cusum/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/cusum/detector.py +48 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/cusum/metadata.yaml +35 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/cusum/usage.md +59 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ddm/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ddm/detector.py +46 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ddm/metadata.yaml +35 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ddm/usage.md +68 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ecdd/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ecdd/detector.py +49 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ecdd/metadata.yaml +37 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ecdd/usage.md +60 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/eddm/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/eddm/detector.py +198 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/eddm/metadata.yaml +47 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/eddm/usage.md +24 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/hddm_a/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/hddm_a/detector.py +180 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/hddm_a/metadata.yaml +40 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/hddm_a/usage.md +29 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/hellinger/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/hellinger/detector.py +14 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/hellinger/metadata.yaml +38 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/hellinger/usage.md +84 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/jensen_shannon/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/jensen_shannon/detector.py +15 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/jensen_shannon/metadata.yaml +38 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/jensen_shannon/usage.md +84 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ks/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ks/detector.py +80 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ks/metadata.yaml +56 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/ks/usage.md +67 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/kswin/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/kswin/detector.py +44 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/kswin/metadata.yaml +37 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/kswin/usage.md +60 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/page_hinkley/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/page_hinkley/detector.py +126 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/page_hinkley/metadata.yaml +40 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/page_hinkley/usage.md +28 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/psi/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/psi/detector.py +87 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/psi/metadata.yaml +50 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/psi/usage.md +66 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/rddm/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/rddm/detector.py +53 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/rddm/metadata.yaml +37 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/rddm/usage.md +69 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/stepd/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/stepd/detector.py +56 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/stepd/metadata.yaml +35 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/stepd/usage.md +68 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/total_variation/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/total_variation/detector.py +14 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/total_variation/metadata.yaml +38 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/total_variation/usage.md +84 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/wasserstein/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/wasserstein/detector.py +15 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/wasserstein/metadata.yaml +36 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/univariate/wasserstein/usage.md +84 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/utility/__init__.py +0 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/utility/_adwin.py +199 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/utility/_distributional.py +53 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/utility/_stats.py +178 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/utility/_streaming.py +51 -0
- drift_detectors_pack-0.5.3/src/drift_detectors/utility/drift_detection_output.py +32 -0
- drift_detectors_pack-0.5.3/src/drift_detectors_pack.egg-info/PKG-INFO +348 -0
- drift_detectors_pack-0.5.3/src/drift_detectors_pack.egg-info/SOURCES.txt +167 -0
- drift_detectors_pack-0.5.3/src/drift_detectors_pack.egg-info/dependency_links.txt +1 -0
- drift_detectors_pack-0.5.3/src/drift_detectors_pack.egg-info/requires.txt +35 -0
- drift_detectors_pack-0.5.3/src/drift_detectors_pack.egg-info/top_level.txt +1 -0
- drift_detectors_pack-0.5.3/tests/test_KDQ_tree.py +70 -0
- drift_detectors_pack-0.5.3/tests/test_adwin.py +87 -0
- drift_detectors_pack-0.5.3/tests/test_c2st.py +51 -0
- drift_detectors_pack-0.5.3/tests/test_distributional.py +57 -0
- drift_detectors_pack-0.5.3/tests/test_eddm.py +72 -0
- drift_detectors_pack-0.5.3/tests/test_energy_distance.py +53 -0
- drift_detectors_pack-0.5.3/tests/test_hddm_a.py +43 -0
- drift_detectors_pack-0.5.3/tests/test_ks.py +65 -0
- drift_detectors_pack-0.5.3/tests/test_metadata_schema.py +73 -0
- drift_detectors_pack-0.5.3/tests/test_mmd.py +56 -0
- drift_detectors_pack-0.5.3/tests/test_model_disagreement.py +207 -0
- drift_detectors_pack-0.5.3/tests/test_multivariate_extra.py +61 -0
- drift_detectors_pack-0.5.3/tests/test_page_hinkley.py +54 -0
- drift_detectors_pack-0.5.3/tests/test_pca_cd.py +52 -0
- drift_detectors_pack-0.5.3/tests/test_psi.py +95 -0
- drift_detectors_pack-0.5.3/tests/test_stats_equivalence.py +108 -0
- drift_detectors_pack-0.5.3/tests/test_streaming.py +77 -0
- drift_detectors_pack-0.5.3/tests/test_temporal_metrics.py +59 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 - David Camilo Corrales Munoz - David-Camilo.Corrales-Munoz@inrae.fr
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: drift_detectors_pack
|
|
3
|
+
Version: 0.5.3
|
|
4
|
+
Summary: Open-source drift detection toolkit for univariate and multivariate data, with batch and streaming detectors. Designed for low-resource MLOps deployments and reproducible scientific research.
|
|
5
|
+
Author: Elizabeth Galindez, Santiago Aristizabal Morales, Fayza Daboussi
|
|
6
|
+
Author-email: Matthew Crowther <nmc215@ncl.ac.uk>, Brett Metcalfe <brett.metcalfe@wur.nl>, Jasper Koehorst <jasper.koehorst@wur.nl>, David Camilo Corrales <David-Camilo.Corrales-Munoz@inrae.fr>, Carlos Alberto Suarez Muñoz <csuarez@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/stamm-4m/drift_detectors_pack
|
|
9
|
+
Project-URL: Repository, https://github.com/stamm-4m/drift_detectors_pack
|
|
10
|
+
Project-URL: Issues, https://github.com/stamm-4m/drift_detectors_pack/issues
|
|
11
|
+
Keywords: drift detection,concept drift,data drift,MLOps,monitoring,bioprocess,machine learning
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy>=1.24
|
|
24
|
+
Requires-Dist: PyYAML>=6.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-xdist>=3.6; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
31
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
32
|
+
Requires-Dist: scipy>=1.10; extra == "dev"
|
|
33
|
+
Requires-Dist: scikit-learn>=1.2; extra == "dev"
|
|
34
|
+
Requires-Dist: river>=0.21; extra == "dev"
|
|
35
|
+
Provides-Extra: compat
|
|
36
|
+
Requires-Dist: scipy>=1.10; extra == "compat"
|
|
37
|
+
Requires-Dist: scikit-learn>=1.2; extra == "compat"
|
|
38
|
+
Requires-Dist: river>=0.21; extra == "compat"
|
|
39
|
+
Provides-Extra: benchmark
|
|
40
|
+
Requires-Dist: pandas>=2.0; extra == "benchmark"
|
|
41
|
+
Requires-Dist: matplotlib>=3.7; extra == "benchmark"
|
|
42
|
+
Requires-Dist: psutil>=5.9; extra == "benchmark"
|
|
43
|
+
Requires-Dist: tabulate>=0.9; extra == "benchmark"
|
|
44
|
+
Provides-Extra: usecase
|
|
45
|
+
Requires-Dist: scikit-learn>=1.5; extra == "usecase"
|
|
46
|
+
Requires-Dist: tensorflow>=2.18; extra == "usecase"
|
|
47
|
+
Requires-Dist: pandas>=2.0; extra == "usecase"
|
|
48
|
+
Requires-Dist: PyYAML>=6.0; extra == "usecase"
|
|
49
|
+
Provides-Extra: docs
|
|
50
|
+
Requires-Dist: sphinx>=7.0; extra == "docs"
|
|
51
|
+
Requires-Dist: furo>=2024.1; extra == "docs"
|
|
52
|
+
Requires-Dist: myst-parser>=2.0; extra == "docs"
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
|
|
55
|
+
# drift_detectors_pack
|
|
56
|
+
|
|
57
|
+
A lightweight, open-source Python toolkit for **data and concept drift
|
|
58
|
+
detection**, designed to be *dependency-frugal*, *reproducible*, and easy to
|
|
59
|
+
deploy as the drift-detection layer of an MLOps stack — including
|
|
60
|
+
[STAMM](https://stamm.inrae.fr), the soft-sensor monitoring and maintenance
|
|
61
|
+
framework into which this package is integrated.
|
|
62
|
+
|
|
63
|
+
[](LICENSE)
|
|
64
|
+
[](https://www.python.org/)
|
|
65
|
+
[](.github/workflows/ci.yml)
|
|
66
|
+
[](pyproject.toml)
|
|
67
|
+
|
|
68
|
+
## What's new in 0.5.3
|
|
69
|
+
|
|
70
|
+
* Every constructor parameter that changes a result is documented in
|
|
71
|
+
`metadata.yaml`: `score_threshold` and `use_fisher` (KDQ-tree),
|
|
72
|
+
`min_consecutive_drift_signals` (EDDM) and `seed` (PCA reconstruction).
|
|
73
|
+
The KDQ-tree output description now says that drift is
|
|
74
|
+
`score >= score_threshold` (it said `>= alpha`). No code change.
|
|
75
|
+
* New test: every `__init__` parameter of a detector is in its metadata,
|
|
76
|
+
except `reference_data`, `online` and `models`, which are supplied by the
|
|
77
|
+
caller.
|
|
78
|
+
* **Default settings revised** (each change follows the original method or a
|
|
79
|
+
standard result; none was tuned on the synthetic example):
|
|
80
|
+
* Jensen-Shannon, chi-square and Bhattacharyya: default thresholds 0.015,
|
|
81
|
+
0.02 and 0.01, so that all histogram distances correspond to the same
|
|
82
|
+
Hellinger distance of 0.1 (the default of Hellinger and total variation).
|
|
83
|
+
* Cramer-von Mises: the score is now the standard two-sample statistic `T`
|
|
84
|
+
(Anderson, 1962) and the default threshold 0.461 is its asymptotic 5 %
|
|
85
|
+
critical value, so the decision no longer depends on the sample sizes.
|
|
86
|
+
* HDDM-A: the cut-point update and the test now follow Frias-Blanco et al.
|
|
87
|
+
(2015); before, the detector could stop firing after a few in-control
|
|
88
|
+
samples. Its `input_kind` is now `error`, because Hoeffding's bound
|
|
89
|
+
assumes values in [0, 1].
|
|
90
|
+
* MMD: `gamma="median"` by default, and the drift decision is a permutation
|
|
91
|
+
test (Gretton et al., 2012) with `alpha=0.05` and `n_permutations=100`.
|
|
92
|
+
The previous fixed rule is still available with `threshold=...`; the
|
|
93
|
+
score is unchanged.
|
|
94
|
+
* MMD-linear: the drift decision is a one-sided z-test on the linear-time
|
|
95
|
+
statistic (Gretton et al., 2012, Sec. 6) with `alpha=0.05`; a fixed
|
|
96
|
+
`threshold=...` is still accepted.
|
|
97
|
+
* **New synthetic example** in
|
|
98
|
+
[`examples/synthetic_drift/`](examples/synthetic_drift/): the thirty
|
|
99
|
+
detectors with their default settings on seven scenarios where the true
|
|
100
|
+
type of drift is known (no drift, sudden and gradual mean shift, variance
|
|
101
|
+
change, correlation change, concept drift and model divergence), over 100
|
|
102
|
+
random seeds. Precomputed results, the heatmap and the data of the first
|
|
103
|
+
seed of every scenario (`data/`) are included.
|
|
104
|
+
* **Reproducibility of the paper:** `use_cases/IndPenSim/experiments/run_ablation.py`
|
|
105
|
+
reproduces the ablation of the MDM design choices (Table S2); with
|
|
106
|
+
`--from-dump` it reuses the stored predictions, so no model and no
|
|
107
|
+
TensorFlow are needed.
|
|
108
|
+
* Documentation brought in line with the paper (CITATION.cff, ARCHITECTURE.md,
|
|
109
|
+
IndPenSim READMEs, fault windows, figures), a README for the
|
|
110
|
+
`disagreement_metrics` plug-ins of MDM, and CI fixes (ruff, mypy, UTF-8
|
|
111
|
+
reading on Windows, fixed seed in a KS test).
|
|
112
|
+
|
|
113
|
+
## What's new in 0.5.2
|
|
114
|
+
|
|
115
|
+
* **MDM `scale`**: the scale of the metrics that use one (MSE = RMSE / scale,
|
|
116
|
+
DTW) is configurable: `"window"` (default, as before: standard deviation of the
|
|
117
|
+
predictions given to `calculate`, which saturates at 1 on short windows or
|
|
118
|
+
flat signals), `"reference"` (standard deviation of past predictions passed
|
|
119
|
+
as `reference_data`, e.g. the run so far) or a positive number (e.g. the
|
|
120
|
+
expected range of the predicted variable).
|
|
121
|
+
* **MDM `decision`**: the family that gives `score` and `drift`: `"error"`
|
|
122
|
+
(default, as before), `"correlation"`, `"temporal"` or `"any"`.
|
|
123
|
+
* **Undefined correlations are reported, not invented**: Pearson, Spearman,
|
|
124
|
+
lagged correlation and ACF divergence return NaN when a series is constant
|
|
125
|
+
(until 0.5.1 Pearson / Spearman gave 0.5, which looked like a real value).
|
|
126
|
+
MDM averages over the defined pairs, counts the others in
|
|
127
|
+
`details["undefined_pairs"]`, and returns `score=None, drift=False` with
|
|
128
|
+
`details["status"] = "decision_undefined"` when the deciding family is not
|
|
129
|
+
defined.
|
|
130
|
+
* The metadata of `model_disagreement` documents `scale` and `decision`; the
|
|
131
|
+
`disagreement_metrics` catalogue lists the six shipped metrics.
|
|
132
|
+
|
|
133
|
+
## What's new in 0.5.1
|
|
134
|
+
|
|
135
|
+
* Every `metadata.yaml` declares **`input_kind`**, the kind of data the
|
|
136
|
+
detector consumes: `signal` (process values: distributional, sequential and
|
|
137
|
+
multivariate detectors), `error` (a binary error stream of a model, 1 =
|
|
138
|
+
error; needs ground truth: DDM, EDDM, RDDM, STEPD) or `predictions` (the
|
|
139
|
+
outputs of two or more co-deployed models: MDM). Platforms such as the
|
|
140
|
+
STAMM model registry use it to decide which data to feed each detector.
|
|
141
|
+
* `tests/test_metadata_schema.py` checks the required metadata keys of every
|
|
142
|
+
detector.
|
|
143
|
+
|
|
144
|
+
## What's new in 0.5.0
|
|
145
|
+
|
|
146
|
+
* The **Model Disagreement Metric** (`MDM`) is now a pluggable orchestrator: pass
|
|
147
|
+
`metrics=[...]` with any combination of `MSEDisagreement`,
|
|
148
|
+
`PearsonDisagreement`, `SpearmanDisagreement`, or your own subclass of
|
|
149
|
+
`DisagreementMetric`. The new API takes a list of prediction arrays
|
|
150
|
+
(`predictions=[y1, y2, ...]`) rather than model callables, matching the
|
|
151
|
+
STAMM model registry's per-batch export format.
|
|
152
|
+
* `MMDDetector` ships a `gamma='median'` option (median-distance heuristic),
|
|
153
|
+
essential for unscaled industrial data with mixed-scale features.
|
|
154
|
+
* **Catalogue expanded to 30 detectors** across three families: nine
|
|
155
|
+
distributional and ten sequential/error-based univariate detectors, ten
|
|
156
|
+
multivariate detectors, and the model-based MDM (whose disagreement
|
|
157
|
+
metrics now include three time-series-aware ones: DTW, lagged
|
|
158
|
+
cross-correlation and an autocorrelation-function divergence).
|
|
159
|
+
* **NumPy-only runtime.** Every detector now runs on NumPy alone: `scipy`,
|
|
160
|
+
`scikit-learn` and `river` were replaced by internal implementations
|
|
161
|
+
(`utility/_stats.py`, `utility/_adwin.py`) and moved to the optional
|
|
162
|
+
`compat` extra, used only by `tests/test_stats_equivalence.py` to verify
|
|
163
|
+
the re-implementations match the reference libraries. Runtime dependencies
|
|
164
|
+
are just `numpy` and `PyYAML` — no transitive `pandas`, no compiled ML
|
|
165
|
+
stack, installs anywhere.
|
|
166
|
+
* New **IndPenSim use case** at `use_cases/IndPenSim/` that reproduces the
|
|
167
|
+
experiments of the companion SoftwareX paper. Experiment 2 loads a
|
|
168
|
+
structurally diverse four-model panel from the STAMM model registry ---
|
|
169
|
+
RF and CART (Acosta-Pavas et al., 2024) and SVM and LSTM (STAMM, 2026)
|
|
170
|
+
--- via a metadata-driven loader (`registry_models.py`).
|
|
171
|
+
* New per-phase methodology: each detector is run independently in the four
|
|
172
|
+
canonical fermentation phases (lag, log/exponential, stationary, death),
|
|
173
|
+
respecting the non-stationarity of fed-batch fermentation.
|
|
174
|
+
* New [`ARCHITECTURE.md`](ARCHITECTURE.md) and a self-describing
|
|
175
|
+
`metadata.yaml` for every detector.
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## Why this package?
|
|
179
|
+
|
|
180
|
+
Most AI systems silently degrade as the world they were trained on changes —
|
|
181
|
+
a phenomenon called **drift**. Detecting drift is the cornerstone of
|
|
182
|
+
responsible model maintenance, but the existing ecosystem is fragmented
|
|
183
|
+
across libraries with very different APIs, dependency trees, and quality of
|
|
184
|
+
documentation. The fragmentation is particularly costly in operating regimes
|
|
185
|
+
where ground-truth labels arrive offline hours-to-days late (industrial
|
|
186
|
+
soft sensors in bioprocesses) and in deployments where small dependency
|
|
187
|
+
footprints matter.
|
|
188
|
+
|
|
189
|
+
`drift_detectors_pack` unifies a curated catalogue of detectors behind a
|
|
190
|
+
single `DriftDetector.calculate()` interface and ships a self-describing
|
|
191
|
+
`metadata.yaml` per detector so dashboards and platforms can introspect
|
|
192
|
+
the catalogue without special-casing.
|
|
193
|
+
|
|
194
|
+
## Catalogue
|
|
195
|
+
|
|
196
|
+
| Name | Family | Mode | Reference |
|
|
197
|
+
| --- | --- | --- | --- |
|
|
198
|
+
| PSI | Univariate, distributional | batch | Wu & Olson, 2010 |
|
|
199
|
+
| KS | Univariate, distributional | batch | Smirnov, 1948 |
|
|
200
|
+
| Jensen-Shannon | Univariate, distributional | batch | Lin, 1991 |
|
|
201
|
+
| Hellinger | Univariate, distributional | batch | Hellinger, 1909 |
|
|
202
|
+
| Total Variation | Univariate, distributional | batch | Levin & Peres, 2017 |
|
|
203
|
+
| Chi-square | Univariate, distributional | batch | Pearson, 1900 |
|
|
204
|
+
| Bhattacharyya | Univariate, distributional | batch | Bhattacharyya, 1946 |
|
|
205
|
+
| Wasserstein-1 | Univariate, distributional | batch | Kantorovich, 1960 |
|
|
206
|
+
| Cramer-von Mises | Univariate, distributional | batch | Anderson, 1962 |
|
|
207
|
+
| ADWIN | Univariate, sequential | streaming | Bifet & Gavaldà, 2007 |
|
|
208
|
+
| Page-Hinkley | Univariate, sequential | streaming | Page, 1954; Hinkley, 1971 |
|
|
209
|
+
| HDDM-A | Univariate, error-based | streaming | Frías-Blanco et al., 2015 |
|
|
210
|
+
| EDDM | Univariate, error-based | streaming | Baena-García et al., 2006 |
|
|
211
|
+
| DDM | Univariate, error-based | streaming | Gama et al., 2004 |
|
|
212
|
+
| RDDM | Univariate, error-based | streaming | Barros et al., 2017 |
|
|
213
|
+
| CUSUM | Univariate, sequential | streaming | Page, 1954 |
|
|
214
|
+
| ECDD | Univariate, sequential | streaming | Ross et al., 2012 |
|
|
215
|
+
| KSWIN | Univariate, windowing | streaming | Raab et al., 2020 |
|
|
216
|
+
| STEPD | Univariate, error-based | streaming | Nishida & Yamauchi, 2007 |
|
|
217
|
+
| MMD | Multivariate, kernel | batch | Gretton et al., 2012 |
|
|
218
|
+
| MMD-linear | Multivariate, kernel | batch | Gretton et al., 2012 |
|
|
219
|
+
| PCA-CD | Multivariate, projection | batch | Qahtan et al., 2015 |
|
|
220
|
+
| PCA reconstruction | Multivariate, projection | batch | Jackson & Mudholkar, 1979 |
|
|
221
|
+
| KDQ-Tree | Multivariate, partition | batch | Dasu et al., 2006 |
|
|
222
|
+
| Energy Distance | Multivariate, distance | batch | Székely & Rizzo, 2013 |
|
|
223
|
+
| C2ST | Multivariate, classifier | batch | Lopez-Paz & Oquab, 2017 |
|
|
224
|
+
| HDDDM | Multivariate, histogram | batch | Ditzler & Polikar, 2011 |
|
|
225
|
+
| Multivariate KS | Multivariate, projection | batch | Cuesta-Albertos et al., 2007 |
|
|
226
|
+
| NN two-sample | Multivariate, neighbours | batch | Schilling, 1986 |
|
|
227
|
+
| MDM | Model-based, ensemble | batch | Suarez et al., 2026 (STAMM) |
|
|
228
|
+
|
|
229
|
+
## Install
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# from PyPI (the import name is drift_detectors)
|
|
233
|
+
pip install drift_detectors_pack
|
|
234
|
+
|
|
235
|
+
# or the latest version from GitHub
|
|
236
|
+
pip install git+https://github.com/stamm-4m/drift_detectors_pack.git
|
|
237
|
+
|
|
238
|
+
# from source, editable
|
|
239
|
+
git clone https://github.com/stamm-4m/drift_detectors_pack.git
|
|
240
|
+
cd drift_detectors_pack
|
|
241
|
+
pip install -e ".[dev,benchmark]"
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Quick start
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
import numpy as np
|
|
248
|
+
from drift_detectors import PSI, MMDDetector, ModelDisagreementMetric
|
|
249
|
+
|
|
250
|
+
# univariate
|
|
251
|
+
ref = np.random.normal(0.0, 1.0, 1000)
|
|
252
|
+
test = np.random.normal(0.3, 1.0, 1000)
|
|
253
|
+
res = PSI().calculate(test, ref)
|
|
254
|
+
print(res.score, res.drift, res.details)
|
|
255
|
+
|
|
256
|
+
# multivariate: median-distance bandwidth and permutation test by default
|
|
257
|
+
ref_mv = np.random.normal(0.0, 1.0, size=(500, 4))
|
|
258
|
+
test_mv = np.random.normal(0.4, 1.0, size=(500, 4))
|
|
259
|
+
print(MMDDetector().calculate(test_mv, ref_mv))
|
|
260
|
+
|
|
261
|
+
# model disagreement across co-deployed soft sensors (predictions-in API):
|
|
262
|
+
# y1, y2, y3 are 1-D prediction arrays exported by each co-deployed model
|
|
263
|
+
mdm = ModelDisagreementMetric(threshold=0.25)
|
|
264
|
+
print(mdm.calculate(predictions=[y1, y2, y3]).score)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Streaming detectors
|
|
268
|
+
|
|
269
|
+
```python
|
|
270
|
+
from drift_detectors import PageHinkley, HDDM_A
|
|
271
|
+
ph = PageHinkley(online=True)
|
|
272
|
+
hd = HDDM_A(online=True)
|
|
273
|
+
for x, e in zip(stream, errors): # signal value and 0/1 error
|
|
274
|
+
if ph.calculate([x]).drift: # cumulative-deviation change point
|
|
275
|
+
...
|
|
276
|
+
if hd.calculate([e]).drift: # Hoeffding-bound change point on an error stream e in [0, 1]
|
|
277
|
+
...
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Reproducing the paper experiments
|
|
281
|
+
|
|
282
|
+
The full case study lives at
|
|
283
|
+
[`use_cases/IndPenSim/`](use_cases/IndPenSim/), with its own README, a
|
|
284
|
+
fetcher script for the upstream Goldrick dataset, the two paper experiments
|
|
285
|
+
as runnable scripts, and the per-batch result tables in
|
|
286
|
+
[`use_cases/IndPenSim/results/README.md`](use_cases/IndPenSim/results/README.md):
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# 1. fetch the 100-batch IndPenSim CSV (~21 MB)
|
|
290
|
+
python use_cases/IndPenSim/data/download_indpensim.py
|
|
291
|
+
|
|
292
|
+
# 2. run the two paper experiments
|
|
293
|
+
python -m use_cases.IndPenSim.experiments.run_experiment_1
|
|
294
|
+
python -m use_cases.IndPenSim.experiments.run_experiment_2
|
|
295
|
+
|
|
296
|
+
# 3. (optional) regenerate the paper figures
|
|
297
|
+
python use_cases/IndPenSim/figures/make_class_diagram.py
|
|
298
|
+
python use_cases/IndPenSim/figures/make_fault_timelines.py
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
A synthetic example that does not need IndPenSim, and shows which family of
|
|
302
|
+
detectors sees which type of drift, is in
|
|
303
|
+
[`examples/synthetic_drift/`](examples/synthetic_drift/):
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
python -m examples.synthetic_drift.synthetic_drift --seeds 100
|
|
307
|
+
python -m examples.synthetic_drift.make_figures # needs matplotlib
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
A general-purpose `BenchmarkRunner` lives in [`benchmarks/`](benchmarks/) for
|
|
311
|
+
evaluating any detector against any labelled dataset --- not used by the paper
|
|
312
|
+
protocol but documented in [`benchmarks/README.md`](benchmarks/README.md).
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
## Architecture
|
|
316
|
+
|
|
317
|
+
See [`ARCHITECTURE.md`](ARCHITECTURE.md) for the layered design, the result
|
|
318
|
+
dataclass schema, the `metadata.yaml` schema, and a step-by-step recipe
|
|
319
|
+
for adding a new detector. See [`CONTRIBUTING.md`](CONTRIBUTING.md) for
|
|
320
|
+
the development workflow.
|
|
321
|
+
|
|
322
|
+
## STAMM integration
|
|
323
|
+
|
|
324
|
+
This package is component (V) of the
|
|
325
|
+
[STAMM](https://stamm.inrae.fr) MLOps platform for industrial soft sensors.
|
|
326
|
+
STAMM hosts heterogeneous models (CART, M5, CUBIST, Random Forest, GBM,
|
|
327
|
+
LSTM and others) behind a common REST endpoint, runs continuous drift
|
|
328
|
+
monitoring through this package, and exposes the model-divergence panel
|
|
329
|
+
that is the dashboard counterpart of the `ModelDisagreementMetric`
|
|
330
|
+
detector.
|
|
331
|
+
|
|
332
|
+
## Detector pack (STAMM model-registry upload)
|
|
333
|
+
|
|
334
|
+
The STAMM model registry installs this toolkit as an uploadable, versioned
|
|
335
|
+
*detector pack*: its `register` endpoint ingests a **slim `drift_detectors/`
|
|
336
|
+
archive** (the package only -- no data, tests, use cases or benchmarks),
|
|
337
|
+
reads the version, parses every detector's `metadata.yaml` into a read-only
|
|
338
|
+
catalogue, and pins one active version that the workflow orchestrator runs
|
|
339
|
+
server-side. Build that archive with:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
python tools/build_detector_pack.py
|
|
343
|
+
# -> dist/drift_detectors_pack-<version>.zip (drift_detectors/ + pyproject.toml)
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Upload the resulting zip through the registry UI / `register` endpoint. Only
|
|
347
|
+
folders that contain both `detector.py` and `metadata.yaml` are registered as
|
|
348
|
+
detectors.
|