mllabiome 0.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.
Files changed (101) hide show
  1. mllabiome-0.1.0/CHANGELOG.md +5 -0
  2. mllabiome-0.1.0/CITATION.cff +36 -0
  3. mllabiome-0.1.0/LICENSE +202 -0
  4. mllabiome-0.1.0/MANIFEST.in +15 -0
  5. mllabiome-0.1.0/PKG-INFO +273 -0
  6. mllabiome-0.1.0/README.md +227 -0
  7. mllabiome-0.1.0/mllabiome/__init__.py +107 -0
  8. mllabiome-0.1.0/mllabiome/_evaluation_protocols.py +30 -0
  9. mllabiome-0.1.0/mllabiome/_r/ancombc2.R +79 -0
  10. mllabiome-0.1.0/mllabiome/_r/siamcat.R +213 -0
  11. mllabiome-0.1.0/mllabiome/_version.py +1 -0
  12. mllabiome-0.1.0/mllabiome/ancombc2_runtime.py +251 -0
  13. mllabiome-0.1.0/mllabiome/baseline_rf.py +104 -0
  14. mllabiome-0.1.0/mllabiome/cli.py +166 -0
  15. mllabiome-0.1.0/mllabiome/compute.py +194 -0
  16. mllabiome-0.1.0/mllabiome/configs_sweep.py +3454 -0
  17. mllabiome-0.1.0/mllabiome/console.py +171 -0
  18. mllabiome-0.1.0/mllabiome/data.py +920 -0
  19. mllabiome-0.1.0/mllabiome/diagnostic_statistics.py +885 -0
  20. mllabiome-0.1.0/mllabiome/ensemble.py +6 -0
  21. mllabiome-0.1.0/mllabiome/ensemble_aggregation.py +115 -0
  22. mllabiome-0.1.0/mllabiome/ensemble_progress.py +126 -0
  23. mllabiome-0.1.0/mllabiome/ensemble_sweep.py +1793 -0
  24. mllabiome-0.1.0/mllabiome/estimator_protocol.py +47 -0
  25. mllabiome-0.1.0/mllabiome/evaluation_predictions.py +459 -0
  26. mllabiome-0.1.0/mllabiome/evaluation_splits.py +428 -0
  27. mllabiome-0.1.0/mllabiome/explainability.py +3346 -0
  28. mllabiome-0.1.0/mllabiome/explainability_algorithms.py +1011 -0
  29. mllabiome-0.1.0/mllabiome/explainability_cache.py +581 -0
  30. mllabiome-0.1.0/mllabiome/explainability_config.py +206 -0
  31. mllabiome-0.1.0/mllabiome/explainability_context.py +266 -0
  32. mllabiome-0.1.0/mllabiome/explainability_methods.py +268 -0
  33. mllabiome-0.1.0/mllabiome/explainability_model.py +100 -0
  34. mllabiome-0.1.0/mllabiome/explainability_reporting.py +479 -0
  35. mllabiome-0.1.0/mllabiome/explainability_runtime.py +175 -0
  36. mllabiome-0.1.0/mllabiome/explainability_support.py +19 -0
  37. mllabiome-0.1.0/mllabiome/explainability_values.py +498 -0
  38. mllabiome-0.1.0/mllabiome/explainability_visuals.py +2200 -0
  39. mllabiome-0.1.0/mllabiome/explore.py +3197 -0
  40. mllabiome-0.1.0/mllabiome/figure_export.py +63 -0
  41. mllabiome-0.1.0/mllabiome/figures.py +1212 -0
  42. mllabiome-0.1.0/mllabiome/final_explainability.py +178 -0
  43. mllabiome-0.1.0/mllabiome/final_models.py +593 -0
  44. mllabiome-0.1.0/mllabiome/inference.py +978 -0
  45. mllabiome-0.1.0/mllabiome/integrations.py +320 -0
  46. mllabiome-0.1.0/mllabiome/learners.py +979 -0
  47. mllabiome-0.1.0/mllabiome/metrics.py +535 -0
  48. mllabiome-0.1.0/mllabiome/modalities.py +641 -0
  49. mllabiome-0.1.0/mllabiome/mpma_e_explainability.py +1408 -0
  50. mllabiome-0.1.0/mllabiome/mpma_e_figure.py +2075 -0
  51. mllabiome-0.1.0/mllabiome/multimodal_candidates.py +578 -0
  52. mllabiome-0.1.0/mllabiome/multimodal_sweep.py +1910 -0
  53. mllabiome-0.1.0/mllabiome/oof_statistics.py +794 -0
  54. mllabiome-0.1.0/mllabiome/paired_statistics.py +512 -0
  55. mllabiome-0.1.0/mllabiome/pipeline.py +280 -0
  56. mllabiome-0.1.0/mllabiome/py.typed +0 -0
  57. mllabiome-0.1.0/mllabiome/regression_ensemble.py +1290 -0
  58. mllabiome-0.1.0/mllabiome/regression_explainability.py +1709 -0
  59. mllabiome-0.1.0/mllabiome/report.py +3518 -0
  60. mllabiome-0.1.0/mllabiome/report_compute.py +260 -0
  61. mllabiome-0.1.0/mllabiome/report_explainability.py +968 -0
  62. mllabiome-0.1.0/mllabiome/report_oof.py +1957 -0
  63. mllabiome-0.1.0/mllabiome/report_statistics.py +1005 -0
  64. mllabiome-0.1.0/mllabiome/report_terminal.py +493 -0
  65. mllabiome-0.1.0/mllabiome/resolutions.py +353 -0
  66. mllabiome-0.1.0/mllabiome/robustness.py +1112 -0
  67. mllabiome-0.1.0/mllabiome/runtime.py +284 -0
  68. mllabiome-0.1.0/mllabiome/selection.py +476 -0
  69. mllabiome-0.1.0/mllabiome/siamcat.py +313 -0
  70. mllabiome-0.1.0/mllabiome/siamcat_runtime.py +419 -0
  71. mllabiome-0.1.0/mllabiome/splits.py +677 -0
  72. mllabiome-0.1.0/mllabiome/stage_results.py +529 -0
  73. mllabiome-0.1.0/mllabiome/statistical_tests.py +156 -0
  74. mllabiome-0.1.0/mllabiome/statistics_common.py +93 -0
  75. mllabiome-0.1.0/mllabiome/storage.py +263 -0
  76. mllabiome-0.1.0/mllabiome/style.py +198 -0
  77. mllabiome-0.1.0/mllabiome/sweep_types.py +1102 -0
  78. mllabiome-0.1.0/mllabiome/target_sweeps.py +146 -0
  79. mllabiome-0.1.0/mllabiome/task_reports.py +1908 -0
  80. mllabiome-0.1.0/mllabiome/threading.py +18 -0
  81. mllabiome-0.1.0/mllabiome/transformations.py +1877 -0
  82. mllabiome-0.1.0/mllabiome/utils.py +168 -0
  83. mllabiome-0.1.0/mllabiome.egg-info/SOURCES.txt +99 -0
  84. mllabiome-0.1.0/pyproject.toml +135 -0
  85. mllabiome-0.1.0/setup.cfg +4 -0
  86. mllabiome-0.1.0/tests/test_adversarial_lodo_leakage.py +411 -0
  87. mllabiome-0.1.0/tests/test_data_safeguards.py +116 -0
  88. mllabiome-0.1.0/tests/test_dataset_identity.py +50 -0
  89. mllabiome-0.1.0/tests/test_evaluation.py +586 -0
  90. mllabiome-0.1.0/tests/test_explainability_lodo_coordinates.py +174 -0
  91. mllabiome-0.1.0/tests/test_final_specification_oof_explainability.py +328 -0
  92. mllabiome-0.1.0/tests/test_grouped_internal_cv.py +226 -0
  93. mllabiome-0.1.0/tests/test_hierarchical_lodo_protocol.py +45 -0
  94. mllabiome-0.1.0/tests/test_lodo.py +488 -0
  95. mllabiome-0.1.0/tests/test_metric_direction_and_losses.py +104 -0
  96. mllabiome-0.1.0/tests/test_multiclass_permutation_efficiency.py +78 -0
  97. mllabiome-0.1.0/tests/test_provenance.py +104 -0
  98. mllabiome-0.1.0/tests/test_report_statistics_bootstrap.py +87 -0
  99. mllabiome-0.1.0/tests/test_resolutions.py +499 -0
  100. mllabiome-0.1.0/tests/test_transformations.py +651 -0
  101. mllabiome-0.1.0/tests/test_version_sync.py +36 -0
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 - 2026-10-05
4
+
5
+ Initial public release of `mllabiome`.
@@ -0,0 +1,36 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use mllabiome in research, please cite this software release using these metadata."
3
+ title: "mllabiome"
4
+ type: software
5
+ version: "0.1.0"
6
+ date-released: 2026-10-05
7
+ authors:
8
+ - name: "Agata Polejowska"
9
+ abstract: >-
10
+ mllabiome is a Python library for leakage-controlled machine learning on
11
+ microbiome data. It supports nested and subject-aware cross-validation,
12
+ leave-one-dataset-out evaluation, microbiota profile data representation
13
+ (MPDR) analysis, base and ensemble microbiota profile modelling algorithms
14
+ (MPMA-B and MPMA-E), multimodal modelling, explainable AI, robustness
15
+ analysis, statistical comparison, and research reporting. It is intended for research use only
16
+ and is not a medical device or clinical decision-support system.
17
+ license: Apache-2.0
18
+ repository-code: "https://github.com/CMG-GUTS/mllabiome"
19
+ url: "https://github.com/CMG-GUTS/mllabiome"
20
+ keywords:
21
+ - microbiome
22
+ - microbiota
23
+ - metagenomics
24
+ - machine learning
25
+ - microbiome machine learning
26
+ - nested cross-validation
27
+ - grouped cross-validation
28
+ - leave-one-dataset-out
29
+ - cross-cohort validation
30
+ - compositional data
31
+ - ensemble learning
32
+ - multimodal learning
33
+ - explainable AI
34
+ - SHAP
35
+ - LIME
36
+ - bioinformatics
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2025 CMG-GUTS
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,15 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include CITATION.cff
5
+ include pyproject.toml
6
+ recursive-include tests *.py
7
+ include mllabiome/py.typed
8
+ recursive-include mllabiome/_r *.R
9
+ global-exclude __pycache__
10
+ global-exclude *.py[cod]
11
+ global-exclude .DS_Store
12
+ global-exclude ._*
13
+ prune build
14
+ prune dist
15
+ prune *.egg-info
@@ -0,0 +1,273 @@
1
+ Metadata-Version: 2.4
2
+ Name: mllabiome
3
+ Version: 0.1.0
4
+ Summary: Machine learning, ensemble learning, multimodal modeling, and explainable AI for microbiome data with end to end evaluation.
5
+ Author: Agata Polejowska
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/CMG-GUTS/mllabiome
8
+ Project-URL: Documentation, https://cmg-guts.github.io/mllabiome/
9
+ Project-URL: Repository, https://github.com/CMG-GUTS/mllabiome
10
+ Project-URL: Issues, https://github.com/CMG-GUTS/mllabiome/issues
11
+ Project-URL: Changelog, https://github.com/CMG-GUTS/mllabiome/blob/main/CHANGELOG.md
12
+ Keywords: microbiome,microbiota,metagenomics,machine-learning,bioinformatics,microbiome-machine-learning,ensemble-learning,multimodal-learning,explainable-ai,xai,shap,lime,nested-cross-validation,cross-validation,compositional-data,biomarker-discovery
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: numpy>=1.23
27
+ Requires-Dist: pandas>=1.5
28
+ Requires-Dist: scipy>=1.9
29
+ Requires-Dist: scikit-learn>=1.6
30
+ Requires-Dist: matplotlib>=3.6
31
+ Requires-Dist: polars>=0.20
32
+ Requires-Dist: pyarrow>=12
33
+ Requires-Dist: xgboost>=2
34
+ Requires-Dist: lightgbm>=4
35
+ Requires-Dist: catboost>=1.2
36
+ Requires-Dist: flaml>=2
37
+ Requires-Dist: shap>=0.44
38
+ Requires-Dist: lime>=0.2.0.1
39
+ Requires-Dist: PyALE>=1.2.0
40
+ Requires-Dist: scikit-bio>=0.7.0
41
+ Requires-Dist: networkx>=3
42
+ Requires-Dist: rich>=13
43
+ Requires-Dist: tqdm>=4.66
44
+ Requires-Dist: psutil>=7.2.2
45
+ Dynamic: license-file
46
+
47
+ <p>
48
+ <img
49
+ src="https://raw.githubusercontent.com/CMG-GUTS/mllabiome/main/assets/favicon.svg"
50
+ width="82"
51
+ height="82"
52
+ alt="mllabiome icon"
53
+ >
54
+ &nbsp;&nbsp;&nbsp;
55
+ <a href="https://cmg-guts.github.io/mllabiome/">
56
+ <img
57
+ src="https://raw.githubusercontent.com/CMG-GUTS/mllabiome/main/assets/mllabiome-readme-flow-symbols.svg"
58
+ width="350"
59
+ align="right"
60
+ alt="From microbiome abundance data through machine learning to learned patterns and interactions"
61
+ >
62
+ </a>
63
+ </p>
64
+
65
+ <b>E</b>valuate, <b>e</b>nsemble, <b>e</b>xplain machine learning for microbiota data analysis in single-modality and multimodality scenarios.
66
+
67
+ > An integrated leakage-controlled framework for microbiome machine learning that jointly handles compositional preprocessing and taxonomic representation selection, subject/cohort-aware nested evaluation, inner-OOF ensemble and multimodal model construction, cross-fitted explanation, and uncertainty/robustness analysis.
68
+
69
+ > mllabiome addresses a methodological gap between general-purpose machine-learning libraries and microbiome-specific analytical workflows. Its distinguishing feature is an evaluation architecture in which microbiome representation, preprocessing, model optimization, ensemble construction, and multimodal integration can be evaluated within the same nested, group-aware resampling hierarchy. This design allows analytical choices that are commonly fixed before cross-validation to be treated as model-selection decisions while maintaining an untouched outer evaluation set. The framework additionally propagates this separation to model interpretation and robustness analyses, providing a common provenance structure from preprocessing through prediction and explanation.
70
+
71
+ `mllabiome` is a Python library for **microbiome machine learning**, designed for rigorous phenotype prediction, model benchmarking, ensemble learning, multimodal integration, explainable AI, and cross-cohort validation.
72
+
73
+ It provides an end-to-end workflow for evaluating combinations of **microbiome representations, abundance transformations, taxonomic resolutions, machine-learning models, and ensembles** using nested validation procedures that keep preprocessing and model selection inside the training data.
74
+
75
+ Use `mllabiome` when you need to build or benchmark predictive models from microbiome abundance data without leaking information from held-out samples.
76
+
77
+ ## What it does
78
+
79
+ - **Nested cross-validation** and repeated nested cross-validation
80
+ - **Subject-aware grouped splitting** for repeated or longitudinal samples
81
+ - **Leave-one-dataset-out (LODO)** and cross-cohort evaluation
82
+ - **Leakage-controlled preprocessing** fitted within training partitions
83
+ - Microbiome transformations including relative abundance, presence/absence, Hellinger, arcsine-square-root, CLR, ALR, ILR, and prevalence filtering
84
+ - Evaluation across **taxonomic resolutions**
85
+ - Classification and regression
86
+ - scikit-learn-compatible models plus XGBoost, LightGBM, CatBoost, AutoML, and SIAMCAT integration
87
+ - **Ensemble learning** using inner out-of-fold predictions
88
+ - **Multimodal learning** with early, intermediate, and late integration
89
+ - **Explainable AI** using permutation importance, SHAP, ALE, LIME, and ALE interactions
90
+ - Cross-fitted explanations based on held-out predictions
91
+ - Robustness and feature-stability analyses
92
+ - Exploratory microbiome analysis, including community-level statistics and differential abundance
93
+ - Publication-oriented tables, figures, prediction files, and HTML reports
94
+
95
+ ## Why mllabiome?
96
+
97
+ Microbiome machine-learning workflows are unusually vulnerable to optimistic performance estimates when feature filtering, transformations, model selection, repeated samples, or dataset structure are handled outside the validation procedure.
98
+
99
+ `mllabiome` is designed around a simple rule:
100
+
101
+ > **Information from a held-out sample must not influence the pipeline used to predict that sample.**
102
+
103
+ Accordingly, preprocessing and candidate selection are performed within the appropriate training partitions, repeated samples can be kept at the subject level, and ensemble members are selected from inner out-of-fold predictions before evaluation on the outer test data.
104
+
105
+ This makes `mllabiome` particularly suited to **microbiome phenotype prediction, microbiome ML benchmarking, cross-study validation, and reproducible evaluation of predictive microbiome signatures**.
106
+
107
+ ## Install
108
+
109
+ Python 3.10 or newer is required.
110
+
111
+ ```bash
112
+ uv pip install mllabiome
113
+ ```
114
+
115
+ or:
116
+
117
+ ```bash
118
+ pip install mllabiome
119
+ ```
120
+
121
+ To use benchmark datasets:
122
+ ```bash
123
+ pip install -e ".[benchmark]"
124
+ ```
125
+
126
+ For development from a checked-out repository:
127
+
128
+ ```bash
129
+ uv venv
130
+ source .venv/bin/activate
131
+ uv pip install -e ".[dev]"
132
+ uv run pytest -q
133
+ ```
134
+
135
+ ## Quick start
136
+
137
+ Analyses are defined in Python configuration files and can be run end-to-end:
138
+
139
+ ```bash
140
+ mllabiome examples/ncv__ptsd_configs_sweep.py
141
+ ```
142
+
143
+ or stage by stage:
144
+
145
+ ```bash
146
+ mllabiome examples/ncv__ptsd_configs_sweep.py --stage explore
147
+ mllabiome examples/ncv__ptsd_configs_sweep.py --stage evaluate
148
+ mllabiome examples/ncv__ptsd_configs_sweep.py --stage ensemble
149
+ mllabiome examples/ncv__ptsd_configs_sweep.py --stage explain
150
+ mllabiome examples/ncv__ptsd_configs_sweep.py --stage robustness
151
+ mllabiome examples/ncv__ptsd_configs_sweep.py --stage report
152
+ ```
153
+
154
+ For cross-study validation:
155
+
156
+ ```bash
157
+ mllabiome examples/ibs_lodo_configs_sweep.py --stage evaluate
158
+ ```
159
+
160
+ The main workflow is:
161
+
162
+ ```text
163
+ explore → evaluate → ensemble → inference → explain → robustness → report
164
+ ```
165
+
166
+ ## Typical use cases
167
+
168
+ `mllabiome` is intended for questions such as:
169
+
170
+ - Which preprocessing and machine-learning pipeline generalizes best for a microbiome phenotype?
171
+ - How should microbiome models be compared using nested cross-validation?
172
+ - How well does a microbiome classifier generalize to unseen cohorts?
173
+ - Which taxonomic resolution or abundance transformation is most useful for prediction?
174
+ - Can multiple omics or clinical modalities improve prediction?
175
+ - Does an ensemble improve over individual microbiome models?
176
+ - Which microbial features consistently influence held-out predictions?
177
+ - How stable are model explanations across folds, cohorts, and analysis choices?
178
+
179
+ ## Data
180
+
181
+ `mllabiome` operates on already quantified feature or abundance tables together with sample metadata.
182
+
183
+ Supported workflows include wide tabular data and feature-by-sample microbiome profiles such as MetaPhlAn-style taxonomic abundance tables.
184
+
185
+ `mllabiome` is **not** a raw sequencing pipeline: read QC, assembly, taxonomic profiling, and generation of abundance tables should be performed upstream.
186
+
187
+ ## Models and representations
188
+
189
+ Any compatible scikit-learn estimator can be included in a model sweep. Common workflows can combine models such as logistic regression, random forests, ExtraTrees, XGBoost, LightGBM, CatBoost, neural networks, SIAMCAT, and AutoML methods.
190
+
191
+ Microbiome representations can be evaluated across taxonomic levels and abundance transformations within the same validation framework.
192
+
193
+ ## Multimodal analysis
194
+
195
+ `mllabiome` supports unimodal and multimodal prediction, including:
196
+
197
+ - early feature concatenation
198
+ - modality-specific intermediate representations
199
+ - joint intermediate representations
200
+ - late prediction integration
201
+ - weighted prediction integration
202
+ - stacked / Super Learner-style integration
203
+
204
+ Integration choices are evaluated within the same held-out evaluation framework.
205
+
206
+ ## Explainability
207
+
208
+ Model interpretation is available for selected individual models and ensembles using:
209
+
210
+ - permutation importance
211
+ - SHAP
212
+ - accumulated local effects (ALE)
213
+ - ALE interactions
214
+ - LIME
215
+
216
+ Where applicable, explanations are generated from models for which the explained observations were held out during model fitting.
217
+
218
+ Feature attribution should be interpreted as **model-based evidence and hypothesis generation**, not as proof of causal biological effects.
219
+
220
+ ## Outputs
221
+
222
+ A run can produce:
223
+
224
+ - out-of-fold predictions
225
+ - classification or regression metrics
226
+ - candidate rankings
227
+ - selected model and ensemble specifications
228
+ - statistical comparisons
229
+ - explainability results
230
+ - robustness analyses
231
+ - publication-ready figures
232
+ - machine-readable result tables
233
+ - an integrated HTML report
234
+
235
+ Tabular results can also be exported as TSV and figures as PNG or PDF.
236
+
237
+ ## Reproducibility
238
+
239
+ `mllabiome` records analysis configurations and separates model selection from held-out performance estimation.
240
+
241
+ For reproducible research, analyses should be run from a fixed `mllabiome` release together with the exact configuration, dataset version, software environment, and random seed used for the study.
242
+
243
+ Optional R-backed functionality uses version-controlled integrations for SIAMCAT and ANCOM-BC2.
244
+
245
+ ## Examples
246
+
247
+ Runnable configurations are available in [`examples/`](examples/), including:
248
+
249
+ - grouped repeated nested cross-validation
250
+ - leave-one-dataset-out evaluation
251
+ - microbiome transformation and taxonomic-resolution sweeps
252
+ - ensemble selection
253
+ - explainability and robustness analysis
254
+
255
+ ## Scope
256
+
257
+ `mllabiome` focuses on **rigorous evaluation of predictive microbiome models**.
258
+
259
+ It complements upstream microbiome-processing tools and general-purpose machine-learning frameworks by providing microbiome-aware evaluation, representation search, cohort-aware validation, ensemble construction, explainability, and reporting in one workflow.
260
+
261
+ ## Citation
262
+
263
+ If you use `mllabiome` in published research, please cite the software release and the accompanying methods paper.
264
+
265
+ Citation information will be provided in `CITATION.cff`.
266
+
267
+ ## License
268
+
269
+ `mllabiome` is released under the Apache License 2.0.
270
+
271
+ ## Keywords
272
+
273
+ Microbiome machine learning · microbiota machine learning · metagenomics · phenotype prediction · nested cross-validation · grouped cross-validation · leave-one-dataset-out · cross-cohort validation · compositional data · ensemble learning · multimodal learning · explainable AI · SHAP · ALE · LIME · microbiome biomarker discovery · bioinformatics · classifying gut microbiome profiles to predict a health condition · taxonomic profiling data · comparing model performance across validation approaches