paradigma 0.3.1__tar.gz → 0.4.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.
- {paradigma-0.3.1 → paradigma-0.4.0}/PKG-INFO +58 -14
- paradigma-0.4.0/README.md +101 -0
- {paradigma-0.3.1 → paradigma-0.4.0}/pyproject.toml +10 -3
- paradigma-0.4.0/src/paradigma/assets/gait_detection_clf_package.pkl +0 -0
- paradigma-0.4.0/src/paradigma/assets/gait_filtering_clf_package.pkl +0 -0
- paradigma-0.4.0/src/paradigma/assets/ppg_quality_clf_package.pkl +0 -0
- paradigma-0.4.0/src/paradigma/assets/tremor_detection_clf_package.pkl +0 -0
- paradigma-0.4.0/src/paradigma/classification.py +115 -0
- paradigma-0.4.0/src/paradigma/config.py +314 -0
- paradigma-0.4.0/src/paradigma/constants.py +106 -0
- paradigma-0.4.0/src/paradigma/feature_extraction.py +967 -0
- paradigma-0.4.0/src/paradigma/pipelines/__init__.py +0 -0
- paradigma-0.4.0/src/paradigma/pipelines/gait_pipeline.py +727 -0
- paradigma-0.4.0/src/paradigma/pipelines/heart_rate_pipeline.py +426 -0
- paradigma-0.4.0/src/paradigma/pipelines/heart_rate_utils.py +780 -0
- paradigma-0.4.0/src/paradigma/pipelines/tremor_pipeline.py +299 -0
- paradigma-0.4.0/src/paradigma/preprocessing.py +363 -0
- paradigma-0.4.0/src/paradigma/segmenting.py +396 -0
- paradigma-0.4.0/src/paradigma/testing.py +416 -0
- paradigma-0.4.0/src/paradigma/util.py +427 -0
- paradigma-0.3.1/README.md +0 -59
- paradigma-0.3.1/src/paradigma/constants.py +0 -65
- paradigma-0.3.1/src/paradigma/feature_extraction.py +0 -703
- paradigma-0.3.1/src/paradigma/gait_analysis.py +0 -415
- paradigma-0.3.1/src/paradigma/gait_analysis_config.py +0 -266
- paradigma-0.3.1/src/paradigma/heart_rate_analysis.py +0 -127
- paradigma-0.3.1/src/paradigma/heart_rate_analysis_config.py +0 -9
- paradigma-0.3.1/src/paradigma/heart_rate_util.py +0 -173
- paradigma-0.3.1/src/paradigma/imu_preprocessing.py +0 -232
- paradigma-0.3.1/src/paradigma/ppg/classifier/LR_PPG_quality.pkl +0 -0
- paradigma-0.3.1/src/paradigma/ppg/classifier/LR_model.mat +0 -0
- paradigma-0.3.1/src/paradigma/ppg/feat_extraction/acc_feature.m +0 -20
- paradigma-0.3.1/src/paradigma/ppg/feat_extraction/peakdet.m +0 -64
- paradigma-0.3.1/src/paradigma/ppg/feat_extraction/ppg_features.m +0 -53
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/extract_hr_segments.m +0 -37
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/extract_overlapping_segments.m +0 -23
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/AUTHORS.txt +0 -41
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/ChangeLog.txt +0 -74
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/LICENSE_BSD.txt +0 -25
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/LICENSE_GPLv3.txt +0 -699
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/README.txt +0 -394
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/entries +0 -368
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_jsonlab_basic.m.svn-base +0 -180
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_ubjson_basic.m.svn-base +0 -180
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example1.json.svn-base +0 -23
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example2.json.svn-base +0 -22
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example3.json.svn-base +0 -11
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example4.json.svn-base +0 -34
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_basictest.matlab.svn-base +0 -662
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.m.svn-base +0 -27
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.matlab.svn-base +0 -144
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_speedtest.m.svn-base +0 -21
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/demo_jsonlab_basic.m +0 -180
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/demo_ubjson_basic.m +0 -180
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/example1.json +0 -23
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/example2.json +0 -22
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/example3.json +0 -11
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/example4.json +0 -34
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_basictest.matlab +0 -662
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.m +0 -27
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.matlab +0 -144
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_speedtest.m +0 -21
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/jsonopt.m +0 -32
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/loadjson.m +0 -566
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/loadubjson.m +0 -528
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/mergestruct.m +0 -33
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/savejson.m +0 -475
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/saveubjson.m +0 -504
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/jsonlab/varargin2struct.m +0 -40
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/sample_prob_final.m +0 -49
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/synchronization.m +0 -76
- paradigma-0.3.1/src/paradigma/ppg/glob_functions/tsdf_scan_meta.m +0 -22
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/Long_TFD_JOT.m +0 -37
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/PPG_TFD_HR.m +0 -59
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/.gitignore +0 -4
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/CHANGELOG.md +0 -23
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/LICENCE.md +0 -27
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/README.md +0 -251
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/README.pdf +0 -0
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_kern.m +0 -142
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_lag_kern.m +0 -314
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_lag_kern.m +0 -123
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/dec_tfd.m +0 -154
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_di_gdtfd.m +0 -194
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_li_gdtfd.m +0 -200
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_nonsep_gdtfd.m +0 -229
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_sep_gdtfd.m +0 -241
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/di_gdtfd.m +0 -157
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/li_gdtfd.m +0 -190
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/nonsep_gdtfd.m +0 -196
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/sep_gdtfd.m +0 -199
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/full_tfd.m +0 -144
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/load_curdir.m +0 -13
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/pics/decimated_TFDs_examples.png +0 -0
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/pics/full_TFDs_examples.png +0 -0
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/check_dec_params_seq.m +0 -79
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispEE.m +0 -9
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispVars.m +0 -26
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/disp_bytes.m +0 -25
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_full.m +0 -40
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_half.m +0 -34
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/gen_LFM.m +0 -29
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_analytic_signal.m +0 -76
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_window.m +0 -176
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/isreal_fn.m +0 -11
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/padWin.m +0 -97
- paradigma-0.3.1/src/paradigma/ppg/hr_functions/TFD toolbox JOT/utils/vtfd.m +0 -149
- paradigma-0.3.1/src/paradigma/ppg/preprocessing/preprocessing_imu.m +0 -15
- paradigma-0.3.1/src/paradigma/ppg/preprocessing/preprocessing_ppg.m +0 -13
- paradigma-0.3.1/src/paradigma/ppg_preprocessing.py +0 -313
- paradigma-0.3.1/src/paradigma/preprocessing_config.py +0 -69
- paradigma-0.3.1/src/paradigma/quantification.py +0 -58
- paradigma-0.3.1/src/paradigma/tremor/TremorFeaturesAndClassification.m +0 -345
- paradigma-0.3.1/src/paradigma/tremor/feat_extraction/DerivativesExtract.m +0 -22
- paradigma-0.3.1/src/paradigma/tremor/feat_extraction/ExtractBandSignalsRMS.m +0 -72
- paradigma-0.3.1/src/paradigma/tremor/feat_extraction/MFCCExtract.m +0 -100
- paradigma-0.3.1/src/paradigma/tremor/feat_extraction/PSDBandPower.m +0 -52
- paradigma-0.3.1/src/paradigma/tremor/feat_extraction/PSDEst.m +0 -63
- paradigma-0.3.1/src/paradigma/tremor/feat_extraction/PSDExtrAxis.m +0 -88
- paradigma-0.3.1/src/paradigma/tremor/feat_extraction/PSDExtrOpt.m +0 -95
- paradigma-0.3.1/src/paradigma/tremor/preprocessing/InterpData.m +0 -32
- paradigma-0.3.1/src/paradigma/tremor/weekly_aggregates/WeeklyAggregates.m +0 -295
- paradigma-0.3.1/src/paradigma/util.py +0 -50
- paradigma-0.3.1/src/paradigma/windowing.py +0 -219
- {paradigma-0.3.1 → paradigma-0.4.0}/LICENSE +0 -0
- {paradigma-0.3.1 → paradigma-0.4.0}/src/paradigma/__init__.py +0 -0
|
@@ -1,35 +1,70 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: paradigma
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Paradigma - a toolbox for Digital Biomarkers for Parkinson's Disease
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: Peter Kok
|
|
7
7
|
Author-email: p.kok@esciencecenter.nl
|
|
8
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Dist: nbsphinx (>=0.9.6,<0.10.0)
|
|
14
15
|
Requires-Dist: pandas (>=2.1.4,<3.0.0)
|
|
16
|
+
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
|
|
15
17
|
Requires-Dist: pytype (>=2024.4.11,<2025.0.0)
|
|
16
|
-
Requires-Dist: scikit-learn (>=1.3.2,<
|
|
18
|
+
Requires-Dist: scikit-learn (>=1.3.2,<1.6.1)
|
|
19
|
+
Requires-Dist: sphinx-autoapi (>=3.4.0,<4.0.0)
|
|
17
20
|
Requires-Dist: tsdf (>=0.5.2,<0.6.0)
|
|
18
21
|
Description-Content-Type: text/markdown
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+

|
|
21
24
|
|
|
22
25
|
| Badges | |
|
|
23
26
|
|:----:|----|
|
|
24
27
|
| **Packages and Releases** | [](https://github.com/biomarkersparkinson/paradigma/releases/latest) [](https://pypi.python.org/pypi/paradigma/) [](https://research-software-directory.org/software/paradigma) |
|
|
28
|
+
| **DOI** | [](https://doi.org/10.5281/zenodo.13838393) |
|
|
25
29
|
| **Build Status** | [](https://www.python.org/downloads/) [](https://github.com/biomarkersParkinson/paradigma/actions/workflows/build-and-test.yml) [](https://github.com/biomarkersParkinson/paradigma/actions/workflows/pages/pages-build-deployment) |
|
|
26
30
|
| **License** | [](https://github.com/biomarkersparkinson/paradigma/blob/main/LICENSE) |
|
|
27
|
-
<!-- | **
|
|
28
|
-
|
|
31
|
+
<!-- | **Fairness** | [](https://fair-software.eu) [](https://www.bestpractices.dev/projects/8083) | -->
|
|
32
|
+
|
|
33
|
+
ParaDigMa is a Python package for processing time series data of wrist-worn sensors to quantify signs of Parkinson’s disease (PD). It contains functionalities for processing the following sensor types:
|
|
34
|
+
* Inertial Measurement Units (accelerometer, gyroscope)
|
|
35
|
+
* Photoplethysmogram (PPG)
|
|
36
|
+
|
|
37
|
+
And analyses of the following motor and non-motor domains:
|
|
38
|
+
* Gait
|
|
39
|
+
* Tremor
|
|
40
|
+
* Heart Rate
|
|
41
|
+
|
|
42
|
+
## More about ParaDigMa
|
|
43
|
+
The components of ParaDigMa are visually shown in the diagram below.
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
#### Processes
|
|
48
|
+
ParaDigMa can best be understood by categorizing the sequential processes:
|
|
49
|
+
|
|
50
|
+
| Process | Description |
|
|
51
|
+
| ---- | ---- |
|
|
52
|
+
| Preprocessing | Ensuring that the sensor data is ready for further processing |
|
|
53
|
+
| Feature extraction | Creating features based on windowed views of the timestamps |
|
|
54
|
+
| Classification | Making predictions using developed and validated classifiers |
|
|
55
|
+
| Quantification | Selecting specific features of interest |
|
|
56
|
+
| Aggregation | Aggregating the features at a specified time-level |
|
|
57
|
+
|
|
58
|
+
#### Domain requirements
|
|
59
|
+
ParaDigMa can be used to extract aggregations related to a single or multiple domain(s). Each domain has its specific data requirements. Strict requirements for the domain are marked by X, soft requirements (for some additional functionalities) are marked by O.
|
|
60
|
+
|
|
61
|
+
| | Gait | Tremor | Heart Rate |
|
|
62
|
+
|----------|:-----------:|:-----------:|:-----------:|
|
|
63
|
+
| **Accelerometer** | X | | O |
|
|
64
|
+
| **Gyroscope** | X | X | |
|
|
65
|
+
| **PPG** | | | X |
|
|
29
66
|
|
|
30
|
-
Digital Biomarkers for Parkinson's Disease Toolbox
|
|
31
67
|
|
|
32
|
-
A package ([documentation](https://biomarkersparkinson.github.io/paradigma/)) to process wearable sensor data for Parkinson's disease.
|
|
33
68
|
|
|
34
69
|
## Installation
|
|
35
70
|
|
|
@@ -43,11 +78,11 @@ pip install paradigma
|
|
|
43
78
|
|
|
44
79
|
See our [extended documentation](https://biomarkersparkinson.github.io/paradigma/).
|
|
45
80
|
|
|
46
|
-
|
|
47
81
|
## Development
|
|
48
82
|
|
|
49
83
|
### Installation
|
|
50
|
-
|
|
84
|
+
|
|
85
|
+
The package requires Python 3.11 or higher. Use [Poetry](https://python-poetry.org/docs/#installation) to set up the environment and install the dependencies:
|
|
51
86
|
|
|
52
87
|
```bash
|
|
53
88
|
poetry install
|
|
@@ -59,6 +94,12 @@ poetry install
|
|
|
59
94
|
poetry run pytest
|
|
60
95
|
```
|
|
61
96
|
|
|
97
|
+
### Type checking
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
poetry run pytype .
|
|
101
|
+
```
|
|
102
|
+
|
|
62
103
|
### Building documentation
|
|
63
104
|
|
|
64
105
|
```bash
|
|
@@ -71,9 +112,12 @@ Interested in contributing? Check out the contributing guidelines. Please note t
|
|
|
71
112
|
|
|
72
113
|
## License
|
|
73
114
|
|
|
74
|
-
|
|
115
|
+
ParaDigMa was created by Peter Kok, Vedran Kasalica, Erik Post, Kars Veldkamp, Nienke Timmermans, Diogo Coutinho Soriano, Luc Evers. It is licensed under the terms of the Apache License 2.0 license.
|
|
75
116
|
|
|
76
117
|
## Credits
|
|
77
118
|
|
|
78
|
-
|
|
119
|
+
ParaDigMa was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
|
|
120
|
+
|
|
121
|
+
## Contact
|
|
79
122
|
|
|
123
|
+
For more information or questions about ParaDigMa, please reach out to erik.post@radboudumc.nl.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
| Badges | |
|
|
4
|
+
|:----:|----|
|
|
5
|
+
| **Packages and Releases** | [](https://github.com/biomarkersparkinson/paradigma/releases/latest) [](https://pypi.python.org/pypi/paradigma/) [](https://research-software-directory.org/software/paradigma) |
|
|
6
|
+
| **DOI** | [](https://doi.org/10.5281/zenodo.13838393) |
|
|
7
|
+
| **Build Status** | [](https://www.python.org/downloads/) [](https://github.com/biomarkersParkinson/paradigma/actions/workflows/build-and-test.yml) [](https://github.com/biomarkersParkinson/paradigma/actions/workflows/pages/pages-build-deployment) |
|
|
8
|
+
| **License** | [](https://github.com/biomarkersparkinson/paradigma/blob/main/LICENSE) |
|
|
9
|
+
<!-- | **Fairness** | [](https://fair-software.eu) [](https://www.bestpractices.dev/projects/8083) | -->
|
|
10
|
+
|
|
11
|
+
ParaDigMa is a Python package for processing time series data of wrist-worn sensors to quantify signs of Parkinson’s disease (PD). It contains functionalities for processing the following sensor types:
|
|
12
|
+
* Inertial Measurement Units (accelerometer, gyroscope)
|
|
13
|
+
* Photoplethysmogram (PPG)
|
|
14
|
+
|
|
15
|
+
And analyses of the following motor and non-motor domains:
|
|
16
|
+
* Gait
|
|
17
|
+
* Tremor
|
|
18
|
+
* Heart Rate
|
|
19
|
+
|
|
20
|
+
## More about ParaDigMa
|
|
21
|
+
The components of ParaDigMa are visually shown in the diagram below.
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
#### Processes
|
|
26
|
+
ParaDigMa can best be understood by categorizing the sequential processes:
|
|
27
|
+
|
|
28
|
+
| Process | Description |
|
|
29
|
+
| ---- | ---- |
|
|
30
|
+
| Preprocessing | Ensuring that the sensor data is ready for further processing |
|
|
31
|
+
| Feature extraction | Creating features based on windowed views of the timestamps |
|
|
32
|
+
| Classification | Making predictions using developed and validated classifiers |
|
|
33
|
+
| Quantification | Selecting specific features of interest |
|
|
34
|
+
| Aggregation | Aggregating the features at a specified time-level |
|
|
35
|
+
|
|
36
|
+
#### Domain requirements
|
|
37
|
+
ParaDigMa can be used to extract aggregations related to a single or multiple domain(s). Each domain has its specific data requirements. Strict requirements for the domain are marked by X, soft requirements (for some additional functionalities) are marked by O.
|
|
38
|
+
|
|
39
|
+
| | Gait | Tremor | Heart Rate |
|
|
40
|
+
|----------|:-----------:|:-----------:|:-----------:|
|
|
41
|
+
| **Accelerometer** | X | | O |
|
|
42
|
+
| **Gyroscope** | X | X | |
|
|
43
|
+
| **PPG** | | | X |
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
The package is available in PyPi and requires [Python 3.10](https://www.python.org/downloads/) or higher. It can be installed using:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install paradigma
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
See our [extended documentation](https://biomarkersparkinson.github.io/paradigma/).
|
|
58
|
+
|
|
59
|
+
## Development
|
|
60
|
+
|
|
61
|
+
### Installation
|
|
62
|
+
|
|
63
|
+
The package requires Python 3.11 or higher. Use [Poetry](https://python-poetry.org/docs/#installation) to set up the environment and install the dependencies:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
poetry install
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Testing
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
poetry run pytest
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Type checking
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
poetry run pytype .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Building documentation
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
poetry run make html --directory docs/
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Contributing
|
|
88
|
+
|
|
89
|
+
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
ParaDigMa was created by Peter Kok, Vedran Kasalica, Erik Post, Kars Veldkamp, Nienke Timmermans, Diogo Coutinho Soriano, Luc Evers. It is licensed under the terms of the Apache License 2.0 license.
|
|
94
|
+
|
|
95
|
+
## Credits
|
|
96
|
+
|
|
97
|
+
ParaDigMa was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
|
|
98
|
+
|
|
99
|
+
## Contact
|
|
100
|
+
|
|
101
|
+
For more information or questions about ParaDigMa, please reach out to erik.post@radboudumc.nl.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "paradigma"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.0"
|
|
4
4
|
description = "Paradigma - a toolbox for Digital Biomarkers for Parkinson's Disease"
|
|
5
5
|
authors = [ "Peter Kok <p.kok@esciencecenter.nl>",
|
|
6
6
|
"Vedran Kasalica <v.kaslica@esciencecenter.nl>",
|
|
@@ -13,13 +13,16 @@ license = "Apache License 2.0"
|
|
|
13
13
|
readme = "README.md"
|
|
14
14
|
|
|
15
15
|
[tool.poetry.dependencies]
|
|
16
|
-
python = "^3.
|
|
16
|
+
python = "^3.11"
|
|
17
17
|
pandas = "^2.1.4"
|
|
18
|
-
scikit-learn = "
|
|
18
|
+
scikit-learn = ">=1.3.2,<1.6.1"
|
|
19
19
|
tsdf = "^0.5.2"
|
|
20
20
|
pytype = "^2024.4.11"
|
|
21
21
|
# for the record: pytype was installed directly with pip (in the poetry environment),
|
|
22
22
|
# because poetry didn't handle the install for different CPU architectures
|
|
23
|
+
python-dateutil = "^2.9.0.post0"
|
|
24
|
+
sphinx-autoapi = "^3.4.0"
|
|
25
|
+
nbsphinx = "^0.9.6"
|
|
23
26
|
|
|
24
27
|
[tool.poetry.group.testing.dependencies]
|
|
25
28
|
ipykernel = "^6.27.1"
|
|
@@ -35,6 +38,10 @@ sphinx-autoapi = "^3.0.0"
|
|
|
35
38
|
sphinx-rtd-theme = "^2.0.0"
|
|
36
39
|
sphinx-serve = "^1.0.1"
|
|
37
40
|
|
|
41
|
+
|
|
42
|
+
[tool.poetry.group.dev.dependencies]
|
|
43
|
+
pytype = "^2024.10.11"
|
|
44
|
+
|
|
38
45
|
[build-system]
|
|
39
46
|
requires = ["poetry-core>=1.0.0"]
|
|
40
47
|
build-backend = "poetry.core.masonry.api"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pickle
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from sklearn.base import BaseEstimator
|
|
6
|
+
from typing import Any, Optional
|
|
7
|
+
|
|
8
|
+
class ClassifierPackage:
|
|
9
|
+
def __init__(self, classifier: Optional[BaseEstimator] = None,
|
|
10
|
+
threshold: Optional[float] = None,
|
|
11
|
+
scaler: Optional[Any] = None):
|
|
12
|
+
"""
|
|
13
|
+
Initialize the ClassifierPackage with a classifier, threshold, and scaler.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
classifier
|
|
18
|
+
The trained classifier.
|
|
19
|
+
threshold : float
|
|
20
|
+
The classification threshold.
|
|
21
|
+
scaler
|
|
22
|
+
The trained scaler (e.g., StandardScaler or MinMaxScaler).
|
|
23
|
+
"""
|
|
24
|
+
self.classifier = classifier
|
|
25
|
+
self.threshold = threshold
|
|
26
|
+
self.scaler = scaler
|
|
27
|
+
|
|
28
|
+
def transform_features(self, X) -> np.ndarray:
|
|
29
|
+
"""
|
|
30
|
+
Transform the input features using the scaler.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
X : np.ndarray
|
|
35
|
+
The input features.
|
|
36
|
+
|
|
37
|
+
Return
|
|
38
|
+
------
|
|
39
|
+
np.ndarray
|
|
40
|
+
The transformed features.
|
|
41
|
+
"""
|
|
42
|
+
if not self.scaler:
|
|
43
|
+
return X
|
|
44
|
+
return self.scaler.transform(X)
|
|
45
|
+
|
|
46
|
+
def predict_proba(self, X) -> float:
|
|
47
|
+
"""
|
|
48
|
+
Make predictions using the classifier and apply the threshold.
|
|
49
|
+
|
|
50
|
+
Parameters
|
|
51
|
+
----------
|
|
52
|
+
X : np.ndarray
|
|
53
|
+
The input features.
|
|
54
|
+
|
|
55
|
+
Return
|
|
56
|
+
------
|
|
57
|
+
float
|
|
58
|
+
The predicted probability.
|
|
59
|
+
|
|
60
|
+
"""
|
|
61
|
+
if not self.classifier:
|
|
62
|
+
raise ValueError("Classifier is not loaded.")
|
|
63
|
+
return self.classifier.predict_proba(X)[:, 1]
|
|
64
|
+
|
|
65
|
+
def predict(self, X) -> int:
|
|
66
|
+
"""
|
|
67
|
+
Make predictions using the classifier and apply the threshold.
|
|
68
|
+
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
X : np.ndarray
|
|
72
|
+
The input features.
|
|
73
|
+
|
|
74
|
+
Return
|
|
75
|
+
------
|
|
76
|
+
int
|
|
77
|
+
The predicted class.
|
|
78
|
+
|
|
79
|
+
"""
|
|
80
|
+
if not self.classifier:
|
|
81
|
+
raise ValueError("Classifier is not loaded.")
|
|
82
|
+
return int(self.predict_proba(X) >= self.threshold)
|
|
83
|
+
|
|
84
|
+
def save(self, filepath: str | Path) -> None:
|
|
85
|
+
"""
|
|
86
|
+
Save the ClassifierPackage to a file.
|
|
87
|
+
|
|
88
|
+
Parameters
|
|
89
|
+
----------
|
|
90
|
+
filepath : str
|
|
91
|
+
The path to the file.
|
|
92
|
+
"""
|
|
93
|
+
with open(filepath, 'wb') as f:
|
|
94
|
+
pickle.dump(self, f)
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def load(cls, filepath: str | Path):
|
|
98
|
+
"""
|
|
99
|
+
Load a ClassifierPackage from a file.
|
|
100
|
+
|
|
101
|
+
Parameters
|
|
102
|
+
----------
|
|
103
|
+
filepath : str
|
|
104
|
+
The path to the file.
|
|
105
|
+
|
|
106
|
+
Return
|
|
107
|
+
------
|
|
108
|
+
ClassifierPackage
|
|
109
|
+
The loaded classifier package.
|
|
110
|
+
"""
|
|
111
|
+
try:
|
|
112
|
+
with open(filepath, 'rb') as f:
|
|
113
|
+
return pickle.load(f)
|
|
114
|
+
except Exception as e:
|
|
115
|
+
raise ValueError(f"Failed to load classifier package: {e}") from e
|