MaldiDeepKit 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 (56) hide show
  1. maldideepkit-0.1.0/LICENSE +21 -0
  2. maldideepkit-0.1.0/MaldiDeepKit.egg-info/PKG-INFO +301 -0
  3. maldideepkit-0.1.0/MaldiDeepKit.egg-info/SOURCES.txt +54 -0
  4. maldideepkit-0.1.0/MaldiDeepKit.egg-info/dependency_links.txt +1 -0
  5. maldideepkit-0.1.0/MaldiDeepKit.egg-info/requires.txt +24 -0
  6. maldideepkit-0.1.0/MaldiDeepKit.egg-info/top_level.txt +1 -0
  7. maldideepkit-0.1.0/PKG-INFO +301 -0
  8. maldideepkit-0.1.0/README.md +252 -0
  9. maldideepkit-0.1.0/maldideepkit/__init__.py +54 -0
  10. maldideepkit-0.1.0/maldideepkit/_bin_scaling.py +52 -0
  11. maldideepkit-0.1.0/maldideepkit/_blocks.py +80 -0
  12. maldideepkit-0.1.0/maldideepkit/attention/__init__.py +5 -0
  13. maldideepkit-0.1.0/maldideepkit/attention/mlp.py +319 -0
  14. maldideepkit-0.1.0/maldideepkit/augment/__init__.py +15 -0
  15. maldideepkit-0.1.0/maldideepkit/augment/mixing.py +113 -0
  16. maldideepkit-0.1.0/maldideepkit/augment/spectra.py +251 -0
  17. maldideepkit-0.1.0/maldideepkit/base/__init__.py +15 -0
  18. maldideepkit-0.1.0/maldideepkit/base/classifier.py +1079 -0
  19. maldideepkit-0.1.0/maldideepkit/base/data.py +322 -0
  20. maldideepkit-0.1.0/maldideepkit/blocks.py +39 -0
  21. maldideepkit-0.1.0/maldideepkit/cnn/__init__.py +5 -0
  22. maldideepkit-0.1.0/maldideepkit/cnn/cnn.py +316 -0
  23. maldideepkit-0.1.0/maldideepkit/py.typed +0 -0
  24. maldideepkit-0.1.0/maldideepkit/resnet/__init__.py +5 -0
  25. maldideepkit-0.1.0/maldideepkit/resnet/resnet.py +380 -0
  26. maldideepkit-0.1.0/maldideepkit/transformer/__init__.py +7 -0
  27. maldideepkit-0.1.0/maldideepkit/transformer/transformer.py +492 -0
  28. maldideepkit-0.1.0/maldideepkit/utils/__init__.py +22 -0
  29. maldideepkit-0.1.0/maldideepkit/utils/calibration.py +134 -0
  30. maldideepkit-0.1.0/maldideepkit/utils/ensemble.py +132 -0
  31. maldideepkit-0.1.0/maldideepkit/utils/loss.py +138 -0
  32. maldideepkit-0.1.0/maldideepkit/utils/lr_finder.py +173 -0
  33. maldideepkit-0.1.0/maldideepkit/utils/reproducibility.py +70 -0
  34. maldideepkit-0.1.0/maldideepkit/utils/sam.py +121 -0
  35. maldideepkit-0.1.0/maldideepkit/utils/training.py +386 -0
  36. maldideepkit-0.1.0/pyproject.toml +101 -0
  37. maldideepkit-0.1.0/requirements-dev.txt +5 -0
  38. maldideepkit-0.1.0/requirements-docs.txt +7 -0
  39. maldideepkit-0.1.0/requirements.txt +8 -0
  40. maldideepkit-0.1.0/setup.cfg +4 -0
  41. maldideepkit-0.1.0/tests/test_augment.py +279 -0
  42. maldideepkit-0.1.0/tests/test_base.py +1343 -0
  43. maldideepkit-0.1.0/tests/test_bin_scaling.py +212 -0
  44. maldideepkit-0.1.0/tests/test_blocks.py +77 -0
  45. maldideepkit-0.1.0/tests/test_calibration.py +217 -0
  46. maldideepkit-0.1.0/tests/test_cnn.py +52 -0
  47. maldideepkit-0.1.0/tests/test_ensemble.py +100 -0
  48. maldideepkit-0.1.0/tests/test_loss.py +285 -0
  49. maldideepkit-0.1.0/tests/test_lr_finder.py +189 -0
  50. maldideepkit-0.1.0/tests/test_maldiset_integration.py +80 -0
  51. maldideepkit-0.1.0/tests/test_mlp.py +67 -0
  52. maldideepkit-0.1.0/tests/test_resnet.py +107 -0
  53. maldideepkit-0.1.0/tests/test_sam.py +60 -0
  54. maldideepkit-0.1.0/tests/test_sklearn_compat.py +72 -0
  55. maldideepkit-0.1.0/tests/test_transformer.py +251 -0
  56. maldideepkit-0.1.0/tests/test_warping.py +166 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ettore Rocchi
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.
@@ -0,0 +1,301 @@
1
+ Metadata-Version: 2.4
2
+ Name: MaldiDeepKit
3
+ Version: 0.1.0
4
+ Summary: A catalog of sklearn-compatible deep learning classifiers for MALDI-TOF binned spectra
5
+ Author-email: Ettore Rocchi <ettore.rocchi3@unibo.it>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/EttoreRocchi/MaldiDeepKit
8
+ Project-URL: Documentation, https://maldideepkit.readthedocs.io/
9
+ Project-URL: Source, https://github.com/EttoreRocchi/MaldiDeepKit
10
+ Project-URL: Issues, https://github.com/EttoreRocchi/MaldiDeepKit/issues
11
+ Keywords: MALDI,MALDI-TOF,mass-spectrometry,deep-learning,pytorch,classification,AMR,antimicrobial-resistance,machine-learning
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Operating System :: OS Independent
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: numpy>=1.21.0
27
+ Requires-Dist: pandas>=1.3.0
28
+ Requires-Dist: scipy>=1.13.0
29
+ Requires-Dist: scikit-learn>=1.3.0
30
+ Requires-Dist: matplotlib>=3.4.0
31
+ Requires-Dist: torch>=2.0.0
32
+ Requires-Dist: einops>=0.7.0
33
+ Requires-Dist: maldiamrkit>=0.12.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
38
+ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
39
+ Requires-Dist: hypothesis>=6.0.0; extra == "dev"
40
+ Provides-Extra: docs
41
+ Requires-Dist: sphinx>=7.0.0; extra == "docs"
42
+ Requires-Dist: pydata-sphinx-theme>=0.15.0; extra == "docs"
43
+ Requires-Dist: sphinx-autodoc-typehints>=2.0.0; extra == "docs"
44
+ Requires-Dist: sphinx-design>=0.6.0; extra == "docs"
45
+ Requires-Dist: nbsphinx>=0.9.0; extra == "docs"
46
+ Requires-Dist: ipykernel>=6.0.0; extra == "docs"
47
+ Requires-Dist: ipywidgets>=8.0.0; extra == "docs"
48
+ Dynamic: license-file
49
+
50
+ # MaldiDeepKit
51
+
52
+ [![CI](https://github.com/EttoreRocchi/MaldiDeepKit/actions/workflows/ci.yml/badge.svg)](https://github.com/EttoreRocchi/MaldiDeepKit/actions/workflows/ci.yml)
53
+ [![Coverage](https://codecov.io/github/EttoreRocchi/MaldiDeepKit/branch/main/graph/badge.svg)](https://codecov.io/github/EttoreRocchi/MaldiDeepKit)
54
+ [![Documentation](https://img.shields.io/badge/docs-online-blue)](https://maldideepkit.readthedocs.io/)
55
+
56
+ [![PyPI Version](https://img.shields.io/pypi/v/maldideepkit)](https://pypi.org/project/maldideepkit/)
57
+ [![Python](https://img.shields.io/pypi/pyversions/maldideepkit)](https://pypi.org/project/maldideepkit/)
58
+ [![License](https://img.shields.io/github/license/EttoreRocchi/MaldiDeepKit)](https://github.com/EttoreRocchi/MaldiDeepKit/blob/main/LICENSE)
59
+
60
+ <p align="center">
61
+ <img src="docs/maldideepkit_logo.png" alt="MaldiDeepKit" width="320"/>
62
+ </p>
63
+
64
+ <p align="center">
65
+ <strong>A catalog of sklearn-compatible deep learning classifiers for MALDI-TOF binned spectra</strong>
66
+ </p>
67
+
68
+ <p align="center">
69
+ <a href="#installation">Installation</a> •
70
+ <a href="#features">Features</a> •
71
+ <a href="#quick-start">Quick Start</a> •
72
+ <a href="https://maldideepkit.readthedocs.io/">Documentation</a> •
73
+ <a href="#tutorials">Tutorials</a> •
74
+ <a href="#maldisuite-ecosystem">MaldiSuite</a> •
75
+ <a href="#contributing">Contributing</a> •
76
+ <a href="#citing">Citing</a> •
77
+ <a href="#license">License</a>
78
+ </p>
79
+
80
+ MaldiDeepKit is part of the **MaldiSuite** ecosystem and complements [MaldiAMRKit](https://github.com/EttoreRocchi/MaldiAMRKit) and [MaldiBatchKit](https://github.com/EttoreRocchi/MaldiBatchKit): where MaldiAMRKit handles preprocessing, alignment and AMR-aware evaluation, and MaldiBatchKit harmonises multi-centre spectra, MaldiDeepKit focuses on the *classification* step, providing four PyTorch architectures wrapped in a unified scikit-learn estimator API with defaults calibrated for 6000-bin MALDI-TOF input.
81
+
82
+ ## Installation
83
+
84
+ ```bash
85
+ pip install maldideepkit
86
+ ```
87
+
88
+ `maldiamrkit` is a core dependency and is installed automatically - MaldiDeepKit duck-types on the `MaldiSet` data model and reuses `maldiamrkit.alignment.Warping` for leak-safe spectral warping.
89
+
90
+ ### Development Installation
91
+
92
+ ```bash
93
+ git clone https://github.com/EttoreRocchi/MaldiDeepKit.git
94
+ cd MaldiDeepKit
95
+ pip install -e ".[dev]"
96
+ pre-commit install
97
+ ```
98
+
99
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) for coding conventions, testing, and PR guidelines.
100
+
101
+ ## Features
102
+
103
+ - **Unified sklearn API** (`BaseEstimator` + `ClassifierMixin`) for every classifier. Each one implements `fit` / `predict` / `predict_proba` / `score` / `get_params` / `set_params` and plugs into `Pipeline`, `cross_val_score`, and `GridSearchCV` with no glue code.
104
+ - **Four PyTorch architectures** sharing the same base class and hyperparameter surface:
105
+ - `MaldiMLPClassifier` - MLP with optional sigmoid-gated attention, interpretable per-bin gates.
106
+ - `MaldiCNNClassifier` - 1-D Conv1D + BatchNorm + ReLU + MaxPool blocks for local pattern learning.
107
+ - `MaldiResNetClassifier` - 1-D ResNet-18-style residual blocks for a deeper convolutional backbone.
108
+ - `MaldiTransformerClassifier` - 1-D Vision Transformer with global self-attention, pre-norm, LayerScale, and stochastic depth.
109
+ - **MALDI-TOF defaults**: kernel sizes, depths, patch widths, and warmup / cosine-annealing schedules are tuned for 6000-bin spectra in the 2000-20000 Da range.
110
+ - **Auto-scaling for non-default layouts**: every classifier ships a `from_spectrum(bin_width, input_dim, **overrides)` factory that rescales conv kernels and patches when the user trims the m/z range or picks a different bin width. See the [Spectrum scaling guide](https://maldideepkit.readthedocs.io/en/latest/spectrum_scaling.html).
111
+ - **Training recipes**: AdamW-on-`weight_decay` dispatch, gradient clipping, linear warmup + cosine annealing, focal loss, label smoothing, mixed precision (AMP), Stochastic Weight Averaging, Sharpness-Aware Minimization, post-hoc threshold tuning, and temperature scaling - all exposed as classifier kwargs.
112
+ - **Leak-safe spectral warping**: pass any sklearn-style transformer ([`maldiamrkit.alignment.Warping`](https://github.com/EttoreRocchi/MaldiAMRKit)) via `warping=`; it is fitted on the training fold only and applied to both splits during training and to new spectra at `predict` time, *before* per-feature standardization.
113
+ - **MaldiSet integration**: pass a `maldiamrkit.MaldiSet` directly to `fit` / `predict`; MaldiDeepKit duck-types on the DataFrame-like `.X` attribute, so MaldiSuite's data model flows end-to-end.
114
+ - **Persistence**: `save()` writes a state-dict `.pt` plus a hyperparameter `.json` (and a sibling `.warper.pkl` if a warper was fitted); `load()` fails fast on class or `input_dim` mismatches.
115
+ - **CPU-friendly**: every classifier runs on CPU, which is what the project's CI tests against; CUDA speeds up the models' training significantly.
116
+
117
+ ## Documentation
118
+
119
+ Full documentation is available at [maldideepkit.readthedocs.io](https://maldideepkit.readthedocs.io/).
120
+
121
+ ## Quick Start
122
+
123
+ ### Fit a Classifier
124
+
125
+ Every MaldiDeepKit classifier exposes the standard scikit-learn estimator API. Swapping architectures is a one-line change:
126
+
127
+ ```python
128
+ import numpy as np
129
+ from maldideepkit import MaldiMLPClassifier
130
+
131
+ rng = np.random.default_rng(0)
132
+ X = rng.standard_normal((200, 6000)).astype("float32") # 200 binned spectra
133
+ y = rng.integers(0, 2, size=200)
134
+
135
+ clf = MaldiMLPClassifier(random_state=0)
136
+ clf.fit(X, y)
137
+
138
+ proba = clf.predict_proba(X)
139
+ preds = clf.predict(X)
140
+ acc = clf.score(X, y)
141
+
142
+ # Inspect attention weights (MLP only)
143
+ weights = clf.get_attention_weights(X[:10]) # (10, hidden_dim)
144
+ ```
145
+
146
+ ### Inside an Sklearn Pipeline
147
+
148
+ ```python
149
+ from sklearn.model_selection import StratifiedKFold, cross_val_score
150
+ from sklearn.pipeline import Pipeline
151
+ from sklearn.preprocessing import StandardScaler
152
+ from maldideepkit import MaldiCNNClassifier
153
+
154
+ pipe = Pipeline([
155
+ ("scaler", StandardScaler()),
156
+ ("clf", MaldiCNNClassifier(random_state=0)),
157
+ ])
158
+
159
+ cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=0)
160
+ scores = cross_val_score(pipe, X, y, cv=cv, scoring="accuracy")
161
+ print(f"CV accuracy: {scores.mean():.3f} +/- {scores.std():.3f}")
162
+ ```
163
+
164
+ ### MaldiSet Integration
165
+
166
+ Integration with [MaldiAMRKit](https://github.com/EttoreRocchi/MaldiAMRKit) is first-class: pass a `MaldiSet` directly.
167
+
168
+ ```python
169
+ from maldiamrkit import MaldiSet
170
+ from maldideepkit import MaldiCNNClassifier
171
+
172
+ ds = MaldiSet.from_directory(
173
+ "spectra/", "metadata.csv",
174
+ aggregate_by={"antibiotics": "Ciprofloxacin"},
175
+ n_jobs=-1,
176
+ )
177
+ clf = MaldiCNNClassifier(random_state=0).fit(ds, ds.y.squeeze())
178
+ preds = clf.predict(ds)
179
+ ```
180
+
181
+ ### Auto-Scaling for Custom Layouts
182
+
183
+ When the spectrum layout deviates from the reference 6000-bin / 3 Da default, `from_spectrum` rescales conv kernels and patches:
184
+
185
+ ```python
186
+ from maldideepkit import MaldiCNNClassifier, MaldiTransformerClassifier
187
+
188
+ # Reference layout (kernel_size=7, patch_size=4)
189
+ cnn = MaldiCNNClassifier.from_spectrum(bin_width=3, input_dim=6000)
190
+
191
+ # Wider bins -> smaller kernel
192
+ cnn_coarse = MaldiCNNClassifier.from_spectrum(bin_width=6, input_dim=3000)
193
+
194
+ # Transformer is scale-agnostic; only input_dim is recorded
195
+ tr = MaldiTransformerClassifier.from_spectrum(bin_width=1, input_dim=18000)
196
+ ```
197
+
198
+ See the [Spectrum scaling guide](https://maldideepkit.readthedocs.io/en/latest/spectrum_scaling.html) for the semantics behind each knob.
199
+
200
+ ### Save and Load
201
+
202
+ ```python
203
+ clf.save("my_model")
204
+ # -> my_model.pt, my_model.json, my_model.warper.pkl (if warping was used)
205
+ restored = MaldiCNNClassifier.load("my_model")
206
+ ```
207
+
208
+ For more examples covering training recipes, calibration, attention inspection, and ensembles, see the [Quickstart Guide](https://maldideepkit.readthedocs.io/en/latest/quickstart.html) and the [API Reference](https://maldideepkit.readthedocs.io/en/latest/api/index.html).
209
+
210
+ ## Algorithms
211
+
212
+ | Classifier | Backbone | Typical use case |
213
+ |--------------------------------|--------------------------------------------------------|--------------------------------------------------------|
214
+ | `MaldiMLPClassifier` | MLP + optional sigmoid-gated attention | Fast baseline with interpretable feature gates |
215
+ | `MaldiCNNClassifier` | 1-D Conv1D + BatchNorm + ReLU + MaxPool blocks | Local pattern learning from binned spectra |
216
+ | `MaldiResNetClassifier` | 1-D ResNet-18-style residual blocks | Deeper convolutional backbone |
217
+ | `MaldiTransformerClassifier` | 1-D Vision Transformer (LayerScale, stochastic depth) | Long-range peak combinations via global self-attention |
218
+
219
+ All four inherit from `BaseSpectralClassifier` and share the same hyperparameter surface for optimisation, device placement, early stopping, calibration, and persistence.
220
+
221
+ ### Shared Training Knobs
222
+
223
+ | Feature | Kwarg | Notes |
224
+ |------------------------------------|--------------------------------|-------------------------------------------------------------------------------------|
225
+ | Decoupled weight decay | `weight_decay` | Switches Adam to AdamW when `> 0`. Default `0` (MLP/CNN), `1e-4` (ResNet), `0.05` (Transformer). |
226
+ | Gradient clipping | `grad_clip_norm` | `clip_grad_norm_` before every step. Default on (`1.0`) for the deep models. |
227
+ | Warmup + cosine annealing | `warmup_epochs` | Replaces plateau scheduler. Default `5` (deep models), `0` (MLP/CNN). |
228
+ | Stochastic depth (Transformer) | `drop_path_rate` | Linearly ramped across blocks. Default `0.1`. |
229
+ | LayerScale (Transformer) | `layerscale_init` | Per-channel residual scaling initialised near zero - crucial on small cohorts. |
230
+ | Focal loss | `loss="focal"` + `focal_gamma` | For imbalanced binary problems. |
231
+ | Label smoothing | `label_smoothing` | Passed to both cross-entropy and focal paths. |
232
+ | Stochastic Weight Averaging | `swa_start_epoch` | `AveragedModel` replaces best-val at end of fit. |
233
+ | Threshold tuning | `tune_threshold` | Binary only; sweeps balanced-accuracy / F1 / Youden on val. |
234
+ | Temperature scaling | `calibrate_temperature` | One-parameter LBFGS calibration on val logits. |
235
+ | Sharpness-Aware Minimization | `use_sam` + `sam_rho` | Two-pass training, ~2× compute. |
236
+ | Spectral warping | `warping` | Any `Warping`-like sklearn transformer; fitted on train only, applied before standardization. |
237
+
238
+ ### Utilities
239
+
240
+ `maldideepkit.utils` exposes:
241
+
242
+ - **`find_lr(clf, X, y)`** - learning-rate finder.
243
+ - **`tune_threshold` / `fit_temperature`** - post-hoc calibrators usable standalone.
244
+ - **`FocalLoss`, `SAMOptimizer`, `DropPath`** - building blocks for custom training loops.
245
+
246
+ ## Tutorials
247
+
248
+ For more detailed examples, see the notebooks:
249
+
250
+ - [Quick Start](notebooks/01_quick_start.ipynb) - Fit a `MaldiMLPClassifier` and explore the sklearn-compatible API.
251
+ - [Model Comparison](notebooks/02_model_comparison.ipynb) - Train all four classifiers on the same dataset and compare accuracy.
252
+ - [Attention Interpretation](notebooks/03_attention_interpretation.ipynb) - Visualise the sigmoid-gated attention learned by `MaldiMLPClassifier`.
253
+ - [Full Pipeline](notebooks/04_full_pipeline.ipynb) - End-to-end template: MaldiAMRKit preprocessing + MaldiDeepKit classification.
254
+
255
+ ## MaldiSuite Ecosystem
256
+
257
+ MaldiDeepKit is the third package of the MaldiSuite ecosystem:
258
+
259
+ - **[MaldiAMRKit](https://github.com/EttoreRocchi/MaldiAMRKit)** - preprocessing, alignment, peak detection, differential analysis, and classical-ML evaluation for MALDI-TOF AMR workflows.
260
+ - **[MaldiBatchKit](https://github.com/EttoreRocchi/MaldiBatchKit)** - batch-effect correction and harmonisation for multi-centre / multi-instrument MALDI-TOF spectra.
261
+ - **MaldiDeepKit** (this package) - sklearn-compatible deep learning classifiers.
262
+
263
+ The three packages share the `MaldiSet` / `MaldiSpectrum` data model and are designed to compose in a single end-to-end pipeline.
264
+
265
+ ## Requirements
266
+
267
+ The models benefit significantly from CUDA; CPU fallback is supported for all models.
268
+
269
+ ## Contributing
270
+
271
+ Pull requests, bug reports, and feature ideas are welcome. See the [Contributing Guide](CONTRIBUTING.md) for how to get started.
272
+
273
+ ## Citing
274
+
275
+ If you use MaldiDeepKit, please cite this repository until the companion paper is available.
276
+
277
+ Related publications from the MaldiSuite ecosystem:
278
+
279
+ > Rocchi, E., Nicitra, E., Calvo, M. et al. *Combining mass spectrometry and machine learning models for predicting Klebsiella pneumoniae antimicrobial resistance: a multicenter experience from clinical isolates in Italy*. **BMC Microbiol** (2026). [doi:10.1186/s12866-025-04657-2](https://link.springer.com/article/10.1186/s12866-025-04657-2)
280
+
281
+ See the [full publications list](https://maldideepkit.readthedocs.io/en/latest/papers.html) for more papers using the MaldiSuite.
282
+
283
+ ## License
284
+
285
+ This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.
286
+
287
+ ## Acknowledgements
288
+
289
+ The architectures and training recipes bundled in MaldiDeepKit are 1-D adaptations of well-established networks. In particular:
290
+
291
+ > **ResNet** - He K, Zhang X, Ren S, Sun J (2016). *Deep Residual Learning for Image Recognition*. **CVPR**. [doi:10.1109/CVPR.2016.90](https://doi.org/10.1109/CVPR.2016.90)
292
+
293
+ > **Vision Transformer** - Dosovitskiy A, Beyer L, Kolesnikov A, *et al.* (2021). *An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale*. **ICLR**. [arXiv:2010.11929](https://arxiv.org/abs/2010.11929)
294
+
295
+ > **LayerScale** - Touvron H, Cord M, Sablayrolles A, *et al.* (2021). *Going deeper with Image Transformers*. **ICCV**. [arXiv:2103.17239](https://arxiv.org/abs/2103.17239)
296
+
297
+ > **Stochastic Depth** - Huang G, Sun Y, Liu Z, Sedra D, Weinberger K (2016). *Deep Networks with Stochastic Depth*. **ECCV**. [arXiv:1603.09382](https://arxiv.org/abs/1603.09382)
298
+
299
+ > **Temperature Scaling** - Guo C, Pleiss G, Sun Y, Weinberger KQ (2017). *On Calibration of Modern Neural Networks*. **ICML**. [arXiv:1706.04599](https://arxiv.org/abs/1706.04599)
300
+
301
+ > **Sharpness-Aware Minimization** - Foret P, Kleiner A, Mobahi H, Neyshabur B (2021). *Sharpness-Aware Minimization for Efficiently Improving Generalization*. **ICLR**. [arXiv:2010.01412](https://arxiv.org/abs/2010.01412)
@@ -0,0 +1,54 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ requirements-dev.txt
5
+ requirements-docs.txt
6
+ requirements.txt
7
+ MaldiDeepKit.egg-info/PKG-INFO
8
+ MaldiDeepKit.egg-info/SOURCES.txt
9
+ MaldiDeepKit.egg-info/dependency_links.txt
10
+ MaldiDeepKit.egg-info/requires.txt
11
+ MaldiDeepKit.egg-info/top_level.txt
12
+ maldideepkit/__init__.py
13
+ maldideepkit/_bin_scaling.py
14
+ maldideepkit/_blocks.py
15
+ maldideepkit/blocks.py
16
+ maldideepkit/py.typed
17
+ maldideepkit/attention/__init__.py
18
+ maldideepkit/attention/mlp.py
19
+ maldideepkit/augment/__init__.py
20
+ maldideepkit/augment/mixing.py
21
+ maldideepkit/augment/spectra.py
22
+ maldideepkit/base/__init__.py
23
+ maldideepkit/base/classifier.py
24
+ maldideepkit/base/data.py
25
+ maldideepkit/cnn/__init__.py
26
+ maldideepkit/cnn/cnn.py
27
+ maldideepkit/resnet/__init__.py
28
+ maldideepkit/resnet/resnet.py
29
+ maldideepkit/transformer/__init__.py
30
+ maldideepkit/transformer/transformer.py
31
+ maldideepkit/utils/__init__.py
32
+ maldideepkit/utils/calibration.py
33
+ maldideepkit/utils/ensemble.py
34
+ maldideepkit/utils/loss.py
35
+ maldideepkit/utils/lr_finder.py
36
+ maldideepkit/utils/reproducibility.py
37
+ maldideepkit/utils/sam.py
38
+ maldideepkit/utils/training.py
39
+ tests/test_augment.py
40
+ tests/test_base.py
41
+ tests/test_bin_scaling.py
42
+ tests/test_blocks.py
43
+ tests/test_calibration.py
44
+ tests/test_cnn.py
45
+ tests/test_ensemble.py
46
+ tests/test_loss.py
47
+ tests/test_lr_finder.py
48
+ tests/test_maldiset_integration.py
49
+ tests/test_mlp.py
50
+ tests/test_resnet.py
51
+ tests/test_sam.py
52
+ tests/test_sklearn_compat.py
53
+ tests/test_transformer.py
54
+ tests/test_warping.py
@@ -0,0 +1,24 @@
1
+ numpy>=1.21.0
2
+ pandas>=1.3.0
3
+ scipy>=1.13.0
4
+ scikit-learn>=1.3.0
5
+ matplotlib>=3.4.0
6
+ torch>=2.0.0
7
+ einops>=0.7.0
8
+ maldiamrkit>=0.12.0
9
+
10
+ [dev]
11
+ pytest>=7.0.0
12
+ pytest-cov>=4.0.0
13
+ ruff>=0.1.0
14
+ pre-commit>=3.0.0
15
+ hypothesis>=6.0.0
16
+
17
+ [docs]
18
+ sphinx>=7.0.0
19
+ pydata-sphinx-theme>=0.15.0
20
+ sphinx-autodoc-typehints>=2.0.0
21
+ sphinx-design>=0.6.0
22
+ nbsphinx>=0.9.0
23
+ ipykernel>=6.0.0
24
+ ipywidgets>=8.0.0
@@ -0,0 +1 @@
1
+ maldideepkit