TINTOlib 1.2.1__tar.gz → 1.3.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.
- {tintolib-1.2.1 → tintolib-1.3.0}/.gitignore +5 -3
- {tintolib-1.2.1 → tintolib-1.3.0}/PKG-INFO +46 -20
- {tintolib-1.2.1 → tintolib-1.3.0}/README.md +14 -6
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/clusters.py +213 -16
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/deepInsight.py +21 -11
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/fotomics.py +12 -13
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/igtd.py +22 -1
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/paramImageMethod.py +10 -15
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/refined.py +15 -4
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/supertml.py +4 -1
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/assigner.py +23 -19
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/geometry.py +6 -1
- tintolib-1.3.0/pyproject.toml +72 -0
- tintolib-1.2.1/CITATION.cff +0 -39
- tintolib-1.2.1/Dataset/Multiclass/iris.csv +0 -151
- tintolib-1.2.1/Dataset/Regression/boston.csv +0 -507
- tintolib-1.2.1/Gemfile +0 -5
- tintolib-1.2.1/Gemfile.lock +0 -283
- tintolib-1.2.1/Papers Accepted/IEEE_JSTSP-TINTO_Hybrid_Neural_Networks.pdf +0 -0
- tintolib-1.2.1/Papers Accepted/INFUS-TINTO Use Case.pdf +0 -0
- tintolib-1.2.1/Papers Accepted/SoftwareX-TINTO Method.pdf +0 -0
- tintolib-1.2.1/Papers Accepted/SoftwareX-TINTOlib Library.pdf +16 -6686
- tintolib-1.2.1/Papers Accepted/TINTOlib-Benchmark-INFFUS.pdf +62 -21804
- tintolib-1.2.1/docs/.sass-cache/0bdba15b6d9b14ad176ecccceec543b5723d4a16/minima.scssc +0 -0
- tintolib-1.2.1/docs/.sass-cache/612f965de465c2fcff7de7ff3d41a706b9cd3d77/_base.scssc +0 -0
- tintolib-1.2.1/docs/.sass-cache/612f965de465c2fcff7de7ff3d41a706b9cd3d77/_layout.scssc +0 -0
- tintolib-1.2.1/docs/.sass-cache/612f965de465c2fcff7de7ff3d41a706b9cd3d77/_syntax-highlighting.scssc +0 -0
- tintolib-1.2.1/docs/.sass-cache/7995130582743275bf9ef216581ba1f64be550d0/_base.scssc +0 -0
- tintolib-1.2.1/docs/.sass-cache/7995130582743275bf9ef216581ba1f64be550d0/_layout.scssc +0 -0
- tintolib-1.2.1/docs/.sass-cache/7995130582743275bf9ef216581ba1f64be550d0/_syntax-highlighting.scssc +0 -0
- tintolib-1.2.1/docs/.sass-cache/ab63ac6cbbcf8f13c333c99c0c7d195aee5e7671/minima.scssc +0 -0
- tintolib-1.2.1/docs/Gemfile.lock +0 -4
- tintolib-1.2.1/docs/_config.yml +0 -18
- tintolib-1.2.1/docs/_data/datasets/binary/adult_cleaned/dataset.yml +0 -693
- tintolib-1.2.1/docs/_data/datasets/binary/bioresponse/dataset.yml +0 -433
- tintolib-1.2.1/docs/_data/datasets/binary/credit-approval/dataset.yml +0 -693
- tintolib-1.2.1/docs/_data/datasets/binary/dengue_chikunguya_bin/dataset.yml +0 -693
- tintolib-1.2.1/docs/_data/datasets/binary/nomao/dataset.yml +0 -693
- tintolib-1.2.1/docs/_data/datasets/binary/preprocessed_heloc/dataset.yml +0 -680
- tintolib-1.2.1/docs/_data/datasets/binary/qsar-biodeg/dataset.yml +0 -693
- tintolib-1.2.1/docs/_data/datasets/binary/sick_cleaned/dataset.yml +0 -693
- tintolib-1.2.1/docs/_data/datasets/multiclass/cmc/dataset.yml +0 -672
- tintolib-1.2.1/docs/_data/datasets/multiclass/cnae-9/dataset.yml +0 -479
- tintolib-1.2.1/docs/_data/datasets/multiclass/connect-4/dataset.yml +0 -661
- tintolib-1.2.1/docs/_data/datasets/multiclass/covtype/dataset.yml +0 -290
- tintolib-1.2.1/docs/_data/datasets/multiclass/dna/dataset.yml +0 -414
- tintolib-1.2.1/docs/_data/datasets/multiclass/gas-drift/dataset.yml +0 -496
- tintolib-1.2.1/docs/_data/datasets/multiclass/isolet/dataset.yml +0 -420
- tintolib-1.2.1/docs/_data/datasets/multiclass/mfeat-fourier/dataset.yml +0 -179
- tintolib-1.2.1/docs/_data/datasets/regression/boston/dataset.yml +0 -545
- tintolib-1.2.1/docs/_data/datasets/regression/california_housing/dataset.yml +0 -545
- tintolib-1.2.1/docs/_data/datasets/regression/geographical_origin_of_music/dataset.yml +0 -545
- tintolib-1.2.1/docs/_data/datasets/regression/geographical_origin_of_music/dataset_original.yml +0 -547
- tintolib-1.2.1/docs/_data/datasets/regression/health_insurance/dataset.yml +0 -441
- tintolib-1.2.1/docs/_data/datasets/regression/pumadyn32nh/dataset.yml +0 -545
- tintolib-1.2.1/docs/_data/datasets/regression/student_performance_por/dataset.yml +0 -545
- tintolib-1.2.1/docs/_data/datasets/regression/superconductivity/dataset.yml +0 -351
- tintolib-1.2.1/docs/_data/quick_check/binary.yml +0 -216
- tintolib-1.2.1/docs/_data/quick_check/multiclass.yml +0 -216
- tintolib-1.2.1/docs/_data/quick_check/regression.yml +0 -189
- tintolib-1.2.1/docs/_includes/gallery.html +0 -0
- tintolib-1.2.1/docs/_includes/mini-table.html +0 -0
- tintolib-1.2.1/docs/_includes/two-col.html +0 -0
- tintolib-1.2.1/docs/_site/assets/css/custom.scss +0 -15
- tintolib-1.2.1/docs/_site/assets/images/binary/dataset-4.png +0 -0
- tintolib-1.2.1/docs/_site/assets/images/multiclass/dataset-3.png +0 -0
- tintolib-1.2.1/docs/_site/assets/images/regression/dataset-1.png +0 -0
- tintolib-1.2.1/docs/_site/assets/images/regression/dataset-2.png +0 -0
- tintolib-1.2.1/docs/_site/assets/main.css +0 -1
- tintolib-1.2.1/docs/_site/assets/minima-social-icons.svg +0 -33
- tintolib-1.2.1/docs/_site/binary.html +0 -55904
- tintolib-1.2.1/docs/_site/feed.xml +0 -1
- tintolib-1.2.1/docs/_site/index.html +0 -116
- tintolib-1.2.1/docs/_site/multiclass.html +0 -37261
- tintolib-1.2.1/docs/_site/regression.html +0 -37669
- tintolib-1.2.1/docs/assets/css/custom.scss +0 -15
- tintolib-1.2.1/docs/assets/images/binary/dataset-4.png +0 -0
- tintolib-1.2.1/docs/assets/images/multiclass/dataset-3.png +0 -0
- tintolib-1.2.1/docs/assets/images/regression/dataset-1.png +0 -0
- tintolib-1.2.1/docs/assets/images/regression/dataset-2.png +0 -0
- tintolib-1.2.1/docs/assets/main.scss +0 -22
- tintolib-1.2.1/docs/binary.md +0 -306
- tintolib-1.2.1/docs/index.md +0 -33
- tintolib-1.2.1/docs/multiclass.md +0 -303
- tintolib-1.2.1/docs/regression.md +0 -298
- tintolib-1.2.1/examples/Pytorch_Regression-ViT.ipynb +0 -2905
- tintolib-1.2.1/examples/Pytorch_Regression-ViT.py +0 -666
- tintolib-1.2.1/examples/Pytorch_Regression_HyViT.ipynb +0 -2073
- tintolib-1.2.1/examples/TINTOlib-example.ipynb +0 -626
- tintolib-1.2.1/examples/Tensorflow_Classification_CNN.ipynb +0 -2421
- tintolib-1.2.1/examples/Tensorlflow_Multiclass_HyCNN.ipynb +0 -2385
- tintolib-1.2.1/examples/vit_pytorch/vit.py +0 -127
- tintolib-1.2.1/imgs/HybridViT.png +0 -0
- tintolib-1.2.1/imgs/Tabular-to-image-CNN.jpg +0 -0
- tintolib-1.2.1/imgs/blurring.png +0 -0
- tintolib-1.2.1/imgs/characteristic.png +0 -0
- tintolib-1.2.1/imgs/cnn.png +0 -0
- tintolib-1.2.1/imgs/hynn.png +0 -0
- tintolib-1.2.1/imgs/hynn_cla.png +0 -0
- tintolib-1.2.1/imgs/logo-oeg.png +0 -0
- tintolib-1.2.1/imgs/logo-uclm.png +0 -0
- tintolib-1.2.1/imgs/logo-uned-.jpg +0 -0
- tintolib-1.2.1/imgs/logo-upm.png +0 -0
- tintolib-1.2.1/imgs/logo.svg +0 -8
- tintolib-1.2.1/imgs/vit.png +0 -0
- tintolib-1.2.1/pyproject.toml +0 -42
- tintolib-1.2.1/requirements-example.txt +0 -14
- tintolib-1.2.1/requirements.txt +0 -10
- tintolib-1.2.1/scripts/generate_quick_check.py +0 -141
- tintolib-1.2.1/video/TINTOlib-video-En.mp4 +0 -0
- tintolib-1.2.1/video/TINTOlib-video-Es.mp4 +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/LICENSE +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/__init__.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/abstractImageMethod.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/barGraph.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/base.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/bie.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/combination.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/distanceMatrix.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/featureWrap.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/mappingMethod.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/tinto.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/CustomTransformer.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/LogScaler.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/Toolbox.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/config.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/constants.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/mpiHill_UF.py +0 -0
- {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/paraHill.py +0 -0
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: TINTOlib
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Converting tabular data into images
|
|
5
|
-
Project-URL: Homepage, https://github.com/oeg-upm/TINTOlib
|
|
6
|
-
|
|
5
|
+
Project-URL: Homepage, https://github.com/oeg-upm/TINTOlib
|
|
6
|
+
Project-URL: Documentation, https://tintolib.readthedocs.io/
|
|
7
|
+
Project-URL: Benchmarks, https://oeg-upm.github.io/TINTOlib/
|
|
8
|
+
Project-URL: Repository, https://github.com/oeg-upm/TINTOlib
|
|
9
|
+
Project-URL: Issues, https://github.com/oeg-upm/TINTOlib/issues
|
|
10
|
+
Author-email: BorjaRei <borjareinoso@gmail.com>, manwestc <jcastillo@fi.upm.es>, DavidGonzalezFernandez <david.g.f.2@gmail.com>, JiayunLiu <jiayun.liu@upm.es>, JavierLopez <javilecrin19@gmail.com>
|
|
7
11
|
License: Apache License
|
|
8
12
|
Version 2.0, January 2004
|
|
9
13
|
http://www.apache.org/licenses/
|
|
@@ -209,24 +213,38 @@ License-File: LICENSE
|
|
|
209
213
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
210
214
|
Classifier: Operating System :: OS Independent
|
|
211
215
|
Classifier: Programming Language :: Python :: 3
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
Requires-
|
|
218
|
-
Requires-Dist:
|
|
219
|
-
Requires-Dist:
|
|
220
|
-
Requires-Dist:
|
|
221
|
-
Requires-Dist:
|
|
222
|
-
Requires-Dist:
|
|
216
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
217
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
218
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
219
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
220
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
221
|
+
Requires-Python: >=3.9
|
|
222
|
+
Requires-Dist: bitstring<5,>=4.0
|
|
223
|
+
Requires-Dist: matplotlib<4,>=3.7
|
|
224
|
+
Requires-Dist: numpy<3,>=1.24
|
|
225
|
+
Requires-Dist: pandas<3,>=2.0
|
|
226
|
+
Requires-Dist: pillow<13,>=9.5
|
|
227
|
+
Requires-Dist: scikit-learn<2,>=1.2
|
|
228
|
+
Requires-Dist: scipy<2,>=1.10
|
|
229
|
+
Requires-Dist: tqdm<5,>=4.65
|
|
230
|
+
Provides-Extra: all
|
|
231
|
+
Requires-Dist: asymmetric-greedy-search==0.1.0; extra == 'all'
|
|
232
|
+
Requires-Dist: mpi4py<5,>=4; extra == 'all'
|
|
233
|
+
Requires-Dist: numba<0.61,>=0.60; (python_version < '3.10') and extra == 'all'
|
|
234
|
+
Requires-Dist: numba<0.63,>=0.62; (python_version >= '3.10') and extra == 'all'
|
|
235
|
+
Provides-Extra: greedy
|
|
236
|
+
Requires-Dist: asymmetric-greedy-search==0.1.0; extra == 'greedy'
|
|
237
|
+
Requires-Dist: numba<0.61,>=0.60; (python_version < '3.10') and extra == 'greedy'
|
|
238
|
+
Requires-Dist: numba<0.63,>=0.62; (python_version >= '3.10') and extra == 'greedy'
|
|
239
|
+
Provides-Extra: refined
|
|
240
|
+
Requires-Dist: mpi4py<5,>=4; extra == 'refined'
|
|
223
241
|
Description-Content-Type: text/markdown
|
|
224
242
|
|
|
225
243
|
# TINTOlib: Python Library to convert Tabular Data into Synthetic Images
|
|
226
244
|
|
|
227
245
|
[](https://oeg-upm.github.io/TINTOlib/)
|
|
228
246
|
[](https://github.com/oeg-upm/TINTOlib-Documentation/blob/main/LICENSE)
|
|
229
|
-
[](https://pypi.python.org/pypi/)
|
|
230
248
|
[](https://tintolib.readthedocs.io/en/latest/)
|
|
231
249
|
[](https://colab.research.google.com/github/oeg-upm/TINTOlib-Crash_Course/blob/main/Notebooks/Challenge/Regression_CNN.ipynb)
|
|
232
250
|
[](https://colab.research.google.com/github/oeg-upm/TINTOlib-Crash_Course/blob/main/Notebooks/Challenge/Regression_CNN%2BMLP.ipynb)
|
|
@@ -329,7 +347,7 @@ And use-case developed in **[INFFUS Paper](https://doi.org/10.1016/j.inffus.2022
|
|
|
329
347
|
- Designed for tidy data (**target column last**)
|
|
330
348
|
- Output: grayscale images from reduction and transformation methods
|
|
331
349
|
- Compatible with **Linux, Windows, macOS**
|
|
332
|
-
- Requires **Python 3.
|
|
350
|
+
- Requires **Python 3.9+**
|
|
333
351
|
|
|
334
352
|
---
|
|
335
353
|
|
|
@@ -374,12 +392,12 @@ This method relies on `mpi4py`, which enables parallel computation using MPI (Me
|
|
|
374
392
|
Once MPI is installed:
|
|
375
393
|
|
|
376
394
|
```bash
|
|
377
|
-
pip install
|
|
395
|
+
pip install "TINTOlib[refined]"
|
|
378
396
|
```
|
|
379
397
|
- **MacOS / Windows:** Direct installation is usually supported:
|
|
380
398
|
|
|
381
399
|
```bash
|
|
382
|
-
pip install
|
|
400
|
+
pip install "TINTOlib[refined]"
|
|
383
401
|
```
|
|
384
402
|
|
|
385
403
|
### SuperTML
|
|
@@ -408,10 +426,18 @@ On **Google Colab**, installing additional fonts is not permitted due to adminis
|
|
|
408
426
|
|
|
409
427
|
TINTOlib already includes all necessary dependencies, so there’s no need to install them individually.
|
|
410
428
|
|
|
429
|
+
Optional methods can be installed using dependency extras:
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
pip install "TINTOlib[greedy]" # Greedy feature-to-pixel assignment
|
|
433
|
+
pip install "TINTOlib[refined]" # REFINED and mpi4py
|
|
434
|
+
pip install "TINTOlib[all]" # All optional methods
|
|
435
|
+
```
|
|
436
|
+
|
|
411
437
|
However, if you prefer manual installation or want to explore the full environment:
|
|
412
438
|
|
|
413
|
-
- The repository includes a `requirements.txt` file
|
|
414
|
-
- **mpi4py** is
|
|
439
|
+
- The repository includes a `requirements.txt` file that installs TINTOlib and its core dependencies in editable mode for local development.
|
|
440
|
+
- **mpi4py** is installed by the `refined` extra and is only required for **REFINED**; an MPI runtime must also be installed as described in the [platform-specific notes](#platform-specific-notes).
|
|
415
441
|
- **Other notebooks**, which include training deep learning models on the generated images, require additional libraries. To run them, install the extended dependencies from `requirements-example.txt`:
|
|
416
442
|
|
|
417
443
|
---
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://oeg-upm.github.io/TINTOlib/)
|
|
4
4
|
[](https://github.com/oeg-upm/TINTOlib-Documentation/blob/main/LICENSE)
|
|
5
|
-
[](https://pypi.python.org/pypi/)
|
|
6
6
|
[](https://tintolib.readthedocs.io/en/latest/)
|
|
7
7
|
[](https://colab.research.google.com/github/oeg-upm/TINTOlib-Crash_Course/blob/main/Notebooks/Challenge/Regression_CNN.ipynb)
|
|
8
8
|
[](https://colab.research.google.com/github/oeg-upm/TINTOlib-Crash_Course/blob/main/Notebooks/Challenge/Regression_CNN%2BMLP.ipynb)
|
|
@@ -105,7 +105,7 @@ And use-case developed in **[INFFUS Paper](https://doi.org/10.1016/j.inffus.2022
|
|
|
105
105
|
- Designed for tidy data (**target column last**)
|
|
106
106
|
- Output: grayscale images from reduction and transformation methods
|
|
107
107
|
- Compatible with **Linux, Windows, macOS**
|
|
108
|
-
- Requires **Python 3.
|
|
108
|
+
- Requires **Python 3.9+**
|
|
109
109
|
|
|
110
110
|
---
|
|
111
111
|
|
|
@@ -150,12 +150,12 @@ This method relies on `mpi4py`, which enables parallel computation using MPI (Me
|
|
|
150
150
|
Once MPI is installed:
|
|
151
151
|
|
|
152
152
|
```bash
|
|
153
|
-
pip install
|
|
153
|
+
pip install "TINTOlib[refined]"
|
|
154
154
|
```
|
|
155
155
|
- **MacOS / Windows:** Direct installation is usually supported:
|
|
156
156
|
|
|
157
157
|
```bash
|
|
158
|
-
pip install
|
|
158
|
+
pip install "TINTOlib[refined]"
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
### SuperTML
|
|
@@ -184,10 +184,18 @@ On **Google Colab**, installing additional fonts is not permitted due to adminis
|
|
|
184
184
|
|
|
185
185
|
TINTOlib already includes all necessary dependencies, so there’s no need to install them individually.
|
|
186
186
|
|
|
187
|
+
Optional methods can be installed using dependency extras:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
pip install "TINTOlib[greedy]" # Greedy feature-to-pixel assignment
|
|
191
|
+
pip install "TINTOlib[refined]" # REFINED and mpi4py
|
|
192
|
+
pip install "TINTOlib[all]" # All optional methods
|
|
193
|
+
```
|
|
194
|
+
|
|
187
195
|
However, if you prefer manual installation or want to explore the full environment:
|
|
188
196
|
|
|
189
|
-
- The repository includes a `requirements.txt` file
|
|
190
|
-
- **mpi4py** is
|
|
197
|
+
- The repository includes a `requirements.txt` file that installs TINTOlib and its core dependencies in editable mode for local development.
|
|
198
|
+
- **mpi4py** is installed by the `refined` extra and is only required for **REFINED**; an MPI runtime must also be installed as described in the [platform-specific notes](#platform-specific-notes).
|
|
191
199
|
- **Other notebooks**, which include training deep learning models on the generated images, require additional libraries. To run them, install the extended dependencies from `requirements-example.txt`:
|
|
192
200
|
|
|
193
201
|
---
|
|
@@ -134,20 +134,205 @@ class Clusters(AbstractImageMethod):
|
|
|
134
134
|
normalize=None,
|
|
135
135
|
verbose = None,
|
|
136
136
|
algorithm = default_algorithm,
|
|
137
|
-
n_clusters =
|
|
138
|
-
random_seed=
|
|
139
|
-
n_init =
|
|
140
|
-
max_iter =
|
|
141
|
-
algorithmMethod =
|
|
142
|
-
covariance_type =
|
|
143
|
-
ensamMethod =
|
|
144
|
-
bandwidth =
|
|
145
|
-
kernel =
|
|
146
|
-
metric=
|
|
147
|
-
RBFKmeans=
|
|
137
|
+
n_clusters = None,
|
|
138
|
+
random_seed=None,
|
|
139
|
+
n_init = None,
|
|
140
|
+
max_iter = None,
|
|
141
|
+
algorithmMethod = None,
|
|
142
|
+
covariance_type = None,
|
|
143
|
+
ensamMethod = None,
|
|
144
|
+
bandwidth = None,
|
|
145
|
+
kernel = None,
|
|
146
|
+
metric = None,
|
|
147
|
+
RBFKmeans = None
|
|
148
148
|
|
|
149
149
|
):
|
|
150
150
|
|
|
151
|
+
# kmeans
|
|
152
|
+
# --------------------------------------------------
|
|
153
|
+
if algorithm == 'kmeans' and (covariance_type or ensamMethod or bandwidth or kernel or metric):
|
|
154
|
+
raise ValueError(
|
|
155
|
+
f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
|
|
156
|
+
f"The accepted hyperparameters for this algorithm are: n_clusters, random_seed, n_init, max_iter, algorithmMethod and RBFKmeans."
|
|
157
|
+
)
|
|
158
|
+
else:
|
|
159
|
+
if algorithm == 'kmeans':
|
|
160
|
+
if n_clusters is None:
|
|
161
|
+
n_clusters = self.default_n_clusters
|
|
162
|
+
if random_seed is None:
|
|
163
|
+
random_seed = self.default_random_seed
|
|
164
|
+
if n_init is None:
|
|
165
|
+
n_init = self.default_n_init
|
|
166
|
+
if max_iter is None:
|
|
167
|
+
max_iter = self.default_max_iter
|
|
168
|
+
if algorithmMethod is None:
|
|
169
|
+
algorithmMethod = self.default_algorithmMethod
|
|
170
|
+
if RBFKmeans is None:
|
|
171
|
+
RBFKmeans = self.default_RBFKmeans
|
|
172
|
+
# --------------------------------------------------
|
|
173
|
+
|
|
174
|
+
# gaussianMix
|
|
175
|
+
# --------------------------------------------------
|
|
176
|
+
if algorithm == 'gaussianMix' and (algorithmMethod or ensamMethod or bandwidth or kernel or metric or RBFKmeans):
|
|
177
|
+
raise ValueError(
|
|
178
|
+
f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
|
|
179
|
+
f"The accepted hyperparameters for this algorithm are: n_clusters, random_seed, n_init, max_iter and covariance_type."
|
|
180
|
+
)
|
|
181
|
+
else:
|
|
182
|
+
if algorithm == 'gaussianMix':
|
|
183
|
+
if n_clusters is None:
|
|
184
|
+
n_clusters = self.default_n_clusters
|
|
185
|
+
if random_seed is None:
|
|
186
|
+
random_seed = self.default_random_seed
|
|
187
|
+
if n_init is None:
|
|
188
|
+
n_init = self.default_n_init
|
|
189
|
+
if max_iter is None:
|
|
190
|
+
max_iter = self.default_max_iter
|
|
191
|
+
if covariance_type is None:
|
|
192
|
+
covariance_type = self.default_covariance_type
|
|
193
|
+
# --------------------------------------------------
|
|
194
|
+
|
|
195
|
+
# aggloKNN
|
|
196
|
+
# --------------------------------------------------
|
|
197
|
+
if algorithm == 'aggloKNN' and (covariance_type or ensamMethod or bandwidth or kernel or random_seed or n_init or max_iter or algorithmMethod or RBFKmeans):
|
|
198
|
+
raise ValueError(
|
|
199
|
+
f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
|
|
200
|
+
f"The accepted hyperparameters for this algorithm are: n_clusters and metric."
|
|
201
|
+
)
|
|
202
|
+
else:
|
|
203
|
+
if algorithm == 'aggloKNN':
|
|
204
|
+
if n_clusters is None:
|
|
205
|
+
n_clusters = self.default_n_clusters
|
|
206
|
+
if metric is None:
|
|
207
|
+
metric = self.default_metric
|
|
208
|
+
# --------------------------------------------------
|
|
209
|
+
|
|
210
|
+
# kde
|
|
211
|
+
# --------------------------------------------------
|
|
212
|
+
if algorithm == 'kde' and (n_clusters or covariance_type or ensamMethod or random_seed or n_init or max_iter or algorithmMethod or RBFKmeans):
|
|
213
|
+
raise ValueError(
|
|
214
|
+
f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
|
|
215
|
+
f"The accepted hyperparameters for this algorithm are: metric, kernel and bandwidth."
|
|
216
|
+
)
|
|
217
|
+
else:
|
|
218
|
+
if algorithm == 'kde':
|
|
219
|
+
if kernel is None:
|
|
220
|
+
kernel = self.default_kernel
|
|
221
|
+
if bandwidth is None:
|
|
222
|
+
bandwidth = self.default_bandwidth
|
|
223
|
+
if metric is None:
|
|
224
|
+
metric = self.default_metric
|
|
225
|
+
# --------------------------------------------------
|
|
226
|
+
|
|
227
|
+
# kmedoids
|
|
228
|
+
# --------------------------------------------------
|
|
229
|
+
if algorithm == 'kmedoids' and (covariance_type or ensamMethod or n_init or algorithmMethod or RBFKmeans or kernel or bandwidth):
|
|
230
|
+
raise ValueError(
|
|
231
|
+
f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
|
|
232
|
+
f"The accepted hyperparameters for this algorithm are: metric, n_clusters, max_iter and random_seed."
|
|
233
|
+
)
|
|
234
|
+
else:
|
|
235
|
+
if algorithm == 'kmedoids':
|
|
236
|
+
if n_clusters is None:
|
|
237
|
+
n_clusters = self.default_n_clusters
|
|
238
|
+
if max_iter is None:
|
|
239
|
+
max_iter = self.default_max_iter
|
|
240
|
+
if random_seed is None:
|
|
241
|
+
random_seed = self.default_random_seed
|
|
242
|
+
if metric is None:
|
|
243
|
+
metric = self.default_metric
|
|
244
|
+
# --------------------------------------------------
|
|
245
|
+
|
|
246
|
+
# factor
|
|
247
|
+
# --------------------------------------------------
|
|
248
|
+
if algorithm == 'factor' and (metric or max_iter or covariance_type or ensamMethod or n_init or algorithmMethod or RBFKmeans or kernel or bandwidth):
|
|
249
|
+
raise ValueError(
|
|
250
|
+
f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
|
|
251
|
+
f"The accepted hyperparameters for this algorithm are: n_clusters and random_seed."
|
|
252
|
+
)
|
|
253
|
+
else:
|
|
254
|
+
if algorithm == 'factor':
|
|
255
|
+
if n_clusters is None:
|
|
256
|
+
n_clusters = self.default_n_clusters
|
|
257
|
+
if random_seed is None:
|
|
258
|
+
random_seed = self.default_random_seed
|
|
259
|
+
# --------------------------------------------------
|
|
260
|
+
|
|
261
|
+
# mixMethod
|
|
262
|
+
# --------------------------------------------------
|
|
263
|
+
if algorithm == 'mixMethod':
|
|
264
|
+
if ensamMethod is None:
|
|
265
|
+
ensamMethod = self.default_ensamMethod
|
|
266
|
+
hiperAll={'n_clusters','random_seed','n_init','max_iter','algorithmMethod','RBFKmeans','covariance_type','metric','ensamMethod','bandwidth','kernel'}
|
|
267
|
+
hiperOK=set()
|
|
268
|
+
if 'kmeans' in ensamMethod:
|
|
269
|
+
hiperOK.update(['n_clusters','random_seed','n_init','max_iter','algorithmMethod','RBFKmeans'])
|
|
270
|
+
if 'gaussianMix' in ensamMethod:
|
|
271
|
+
hiperOK.update(['n_clusters','random_seed','n_init','max_iter','covariance_type'])
|
|
272
|
+
if 'aggloKNN' in ensamMethod:
|
|
273
|
+
hiperOK.update(['n_clusters','metric'])
|
|
274
|
+
if 'kmedoids' in ensamMethod:
|
|
275
|
+
hiperOK.update(['n_clusters','metric','random_seed','max_iter'])
|
|
276
|
+
if 'factor' in ensamMethod:
|
|
277
|
+
hiperOK.update(['n_clusters','random_seed'])
|
|
278
|
+
hiperOK.update(['ensamMethod'])
|
|
279
|
+
hiperKO=hiperAll-hiperOK
|
|
280
|
+
|
|
281
|
+
vari = locals().copy()
|
|
282
|
+
vari.pop('self', None)
|
|
283
|
+
|
|
284
|
+
if algorithm == 'mixMethod' and (any(vari[name] is not None for name in hiperKO)):
|
|
285
|
+
raise ValueError(
|
|
286
|
+
f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
|
|
287
|
+
f"The accepted hyperparameters for this algorithm are: {hiperOK}."
|
|
288
|
+
)
|
|
289
|
+
else:
|
|
290
|
+
if algorithm == 'mixMethod':
|
|
291
|
+
if 'kmeans' in ensamMethod:
|
|
292
|
+
if n_clusters is None:
|
|
293
|
+
n_clusters = self.default_n_clusters
|
|
294
|
+
if random_seed is None:
|
|
295
|
+
random_seed = self.default_random_seed
|
|
296
|
+
if n_init is None:
|
|
297
|
+
n_init = self.default_n_init
|
|
298
|
+
if max_iter is None:
|
|
299
|
+
max_iter = self.default_max_iter
|
|
300
|
+
if algorithmMethod is None:
|
|
301
|
+
algorithmMethod = self.default_algorithmMethod
|
|
302
|
+
if RBFKmeans is None:
|
|
303
|
+
RBFKmeans = self.default_RBFKmeans
|
|
304
|
+
if 'gaussianMix' in ensamMethod:
|
|
305
|
+
if n_clusters is None:
|
|
306
|
+
n_clusters = self.default_n_clusters
|
|
307
|
+
if random_seed is None:
|
|
308
|
+
random_seed = self.default_random_seed
|
|
309
|
+
if n_init is None:
|
|
310
|
+
n_init = self.default_n_init
|
|
311
|
+
if max_iter is None:
|
|
312
|
+
max_iter = self.default_max_iter
|
|
313
|
+
if covariance_type is None:
|
|
314
|
+
covariance_type = self.default_covariance_type
|
|
315
|
+
if 'aggloKNN' in ensamMethod:
|
|
316
|
+
if n_clusters is None:
|
|
317
|
+
n_clusters = self.default_n_clusters
|
|
318
|
+
if metric is None:
|
|
319
|
+
metric = self.default_metric
|
|
320
|
+
if 'kmedoids' in ensamMethod:
|
|
321
|
+
if n_clusters is None:
|
|
322
|
+
n_clusters = self.default_n_clusters
|
|
323
|
+
if max_iter is None:
|
|
324
|
+
max_iter = self.default_max_iter
|
|
325
|
+
if random_seed is None:
|
|
326
|
+
random_seed = self.default_random_seed
|
|
327
|
+
if metric is None:
|
|
328
|
+
metric = self.default_metric
|
|
329
|
+
if 'factor' in ensamMethod:
|
|
330
|
+
if n_clusters is None:
|
|
331
|
+
n_clusters = self.default_n_clusters
|
|
332
|
+
if random_seed is None:
|
|
333
|
+
random_seed = self.default_random_seed
|
|
334
|
+
# --------------------------------------------------
|
|
335
|
+
|
|
151
336
|
if algorithm=="aggloKNN":
|
|
152
337
|
self.METRICS_TYPES = {'euclidean', 'manhattan', 'cosine'}
|
|
153
338
|
|
|
@@ -160,19 +345,31 @@ class Clusters(AbstractImageMethod):
|
|
|
160
345
|
f"Allowed values are: {self.ALGORITHMS}"
|
|
161
346
|
)
|
|
162
347
|
|
|
163
|
-
if covariance_type not in self.COV_TYPES:
|
|
348
|
+
if algorithm == 'gaussianMix' and covariance_type not in self.COV_TYPES:
|
|
349
|
+
raise ValueError(
|
|
350
|
+
f"Invalid covariance_type '{covariance_type}'. "
|
|
351
|
+
f"Allowed values are: {self.COV_TYPES}"
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
if algorithm == 'mixMethod' and 'gaussianMix' in ensamMethod and covariance_type not in self.COV_TYPES:
|
|
164
355
|
raise ValueError(
|
|
165
356
|
f"Invalid covariance_type '{covariance_type}'. "
|
|
166
357
|
f"Allowed values are: {self.COV_TYPES}"
|
|
167
358
|
)
|
|
168
359
|
|
|
169
|
-
if kernel not in self.KERNEL_TYPES:
|
|
360
|
+
if algorithm == 'kde' and kernel not in self.KERNEL_TYPES:
|
|
170
361
|
raise ValueError(
|
|
171
362
|
f"Invalid kernel '{kernel}'. "
|
|
172
363
|
f"Allowed values are: {self.KERNEL_TYPES}"
|
|
173
364
|
)
|
|
174
365
|
|
|
175
|
-
if metric not in self.METRICS_TYPES:
|
|
366
|
+
if algorithm in ['kde', 'aggloKNN', 'kmedoids'] and metric not in self.METRICS_TYPES:
|
|
367
|
+
raise ValueError(
|
|
368
|
+
f"Invalid metric '{metric}'. "
|
|
369
|
+
f"Allowed values are: {self.METRICS_TYPES}"
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
if algorithm == 'mixMethod' and any(method in ensamMethod for method in ['aggloKNN', 'kmedoids']) and metric not in self.METRICS_TYPES:
|
|
176
373
|
raise ValueError(
|
|
177
374
|
f"Invalid metric '{metric}'. "
|
|
178
375
|
f"Allowed values are: {self.METRICS_TYPES}"
|
|
@@ -195,7 +392,7 @@ class Clusters(AbstractImageMethod):
|
|
|
195
392
|
"Algorithms cannot be repeated."
|
|
196
393
|
)
|
|
197
394
|
|
|
198
|
-
if
|
|
395
|
+
if algorithm in ["kde","aggloKNN"] and (n_clusters=="auto" or isinstance(n_clusters, list)):
|
|
199
396
|
raise ValueError(
|
|
200
397
|
"For these algorithms ('kde', 'aggloKNN'), the 'auto' option to automatically select the optimal number of clusters is not enabled."
|
|
201
398
|
)
|
|
@@ -321,7 +518,7 @@ class Clusters(AbstractImageMethod):
|
|
|
321
518
|
listDist=listDist[(listDist[:,0]!=ind) & (listDist[:,1]!=ind)]
|
|
322
519
|
ind=newInd
|
|
323
520
|
|
|
324
|
-
# pip install pyclustering
|
|
521
|
+
# YA NO SE USA: pip install pyclustering
|
|
325
522
|
def __kmedoids_pam(self,X, K, max_iter=100, random_state=0):
|
|
326
523
|
|
|
327
524
|
"""
|
|
@@ -78,8 +78,10 @@ class DeepInsight(ParamImageMethod):
|
|
|
78
78
|
):
|
|
79
79
|
if (algorithm_rd not in [constants.pca_algorithm, constants.tsne_algorithm,constants.kpca_algorithm]):
|
|
80
80
|
raise TypeError(f"Algorithm_rd parameter must be in {[constants.pca_algorithm, constants.tsne_algorithm,constants.kpca_algorithm]}")
|
|
81
|
+
|
|
82
|
+
if(algorithm_rd != constants.pca_algorithm and (relocate == True or group_method == constants.relevance_option or assignment_method == constants.relevance_assigner)):
|
|
83
|
+
raise TypeError(f"PCA extract method is required to optimize or group using features relevance based on loadings")
|
|
81
84
|
|
|
82
|
-
if(algorithm_rd != constants.pca_algorithm): relocate = False
|
|
83
85
|
|
|
84
86
|
super().__init__( image_dim,problem,transformer,verbose,assignment_method,relocate,algorithm_opt,group_method,zoom,format,cmap,random_seed)
|
|
85
87
|
|
|
@@ -96,17 +98,25 @@ class DeepInsight(ParamImageMethod):
|
|
|
96
98
|
Returns:
|
|
97
99
|
features coordinate matrix
|
|
98
100
|
"""
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
if self.__algorithm_rd == constants.pca_algorithm:
|
|
102
|
+
return PCA(n_components=2, random_state=self._random_seed).fit_transform(x)
|
|
103
|
+
elif self.__algorithm_rd == constants.tsne_algorithm:
|
|
104
|
+
return TSNE(
|
|
105
|
+
n_components=2,
|
|
106
|
+
metric='cosine',
|
|
107
|
+
random_state=self._random_seed,
|
|
108
|
+
perplexity=self._image_dim
|
|
109
|
+
).fit_transform(x)
|
|
110
|
+
elif self.__algorithm_rd == constants.kpca_algorithm:
|
|
111
|
+
return KernelPCA(
|
|
112
|
+
n_components=2,
|
|
113
|
+
kernel='rbf',
|
|
114
|
+
random_state=self._random_seed
|
|
115
|
+
).fit_transform(x)
|
|
106
116
|
|
|
107
117
|
def _compute_relevance(self, x=None,features_coord=None):
|
|
108
118
|
"""
|
|
109
|
-
|
|
119
|
+
Compute features relevance considering the values of the eigenvector associated with the largest eigenvalue in a PCA transformation.
|
|
110
120
|
Args:
|
|
111
121
|
x: features dataset not transposed
|
|
112
122
|
features_coord: features coordinates retrieved using a features extraction method
|
|
@@ -114,7 +124,7 @@ class DeepInsight(ParamImageMethod):
|
|
|
114
124
|
Array that contains features relevance
|
|
115
125
|
"""
|
|
116
126
|
pca_fitted=PCA(n_components=2,random_state=self._random_seed).fit(x)
|
|
117
|
-
features_relevance = MinMaxScaler().fit_transform(pca_fitted.components_[0,:].reshape(-1,1)) + 1
|
|
127
|
+
features_relevance = MinMaxScaler().fit_transform(np.absolute(pca_fitted.components_[0,:].reshape(-1,1))) + 1
|
|
118
128
|
return features_relevance
|
|
119
129
|
|
|
120
130
|
def _get_features_coords(self, x):
|
|
@@ -129,4 +139,4 @@ class DeepInsight(ParamImageMethod):
|
|
|
129
139
|
features_coord = self.__apply_dimensionality_reduction(x)
|
|
130
140
|
# Apply Convex Hull algorithm to get limit points, calculate mimimun rectangle area and rotate
|
|
131
141
|
rotmat, rect_coords, limit_points = get_minimum_rectangle(features_coord)
|
|
132
|
-
return np.dot(rotmat, features_coord.T).T
|
|
142
|
+
return np.dot(rotmat, features_coord.T).T
|
|
@@ -140,19 +140,18 @@ class Fotomics(ParamImageMethod):
|
|
|
140
140
|
lower_limits = (percentiles[:, 0] - iqrs).reshape(-1, 1)
|
|
141
141
|
upper_limits = (percentiles[:, 1] + iqrs).reshape(-1, 1)
|
|
142
142
|
x_t = x.T
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
x_t = np.where(x_t <= upper_limits, x_t, 0)
|
|
143
|
+
if self.__outliers_treatment == constants.avg_option:
|
|
144
|
+
subs = np.tile(np.mean(x, axis=0), (x.shape[0], 1)).T
|
|
145
|
+
x_t = np.where(x_t >= lower_limits, x_t, subs)
|
|
146
|
+
x_t = np.where(x_t <= upper_limits, x_t, subs)
|
|
147
|
+
elif self.__outliers_treatment == constants.max_min_option:
|
|
148
|
+
max = np.tile(lower_limits.T, (x.shape[0], 1)).T
|
|
149
|
+
min = np.tile(upper_limits.T, (x.shape[0], 1)).T
|
|
150
|
+
x_t = np.where(x_t >= lower_limits, x_t, max)
|
|
151
|
+
x_t = np.where(x_t <= upper_limits, x_t, min)
|
|
152
|
+
elif self.__outliers_treatment == constants.zero_option:
|
|
153
|
+
x_t = np.where(x_t >= lower_limits, x_t, 0)
|
|
154
|
+
x_t = np.where(x_t <= upper_limits, x_t, 0)
|
|
156
155
|
return x_t.T
|
|
157
156
|
|
|
158
157
|
def _get_features_coords(self,x):
|
|
@@ -8,7 +8,9 @@ import matplotlib.pyplot as plt
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
import pandas as pd
|
|
10
10
|
from scipy.spatial.distance import pdist, squareform
|
|
11
|
-
from scipy.stats import rankdata, spearmanr
|
|
11
|
+
from scipy.stats import rankdata, spearmanr, rankdata, wasserstein_distance
|
|
12
|
+
from sklearn.manifold import Isomap
|
|
13
|
+
from sklearn.metrics.pairwise import pairwise_distances
|
|
12
14
|
|
|
13
15
|
# Typing imports
|
|
14
16
|
from typing import List, Optional, Union
|
|
@@ -17,6 +19,7 @@ from sklearn.preprocessing import MinMaxScaler
|
|
|
17
19
|
|
|
18
20
|
# Local application/library imports
|
|
19
21
|
from TINTOlib.mappingMethod import MappingMethod
|
|
22
|
+
from TINTOlib.utils.geometry import tropical_distance
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
###########################################################
|
|
@@ -187,6 +190,24 @@ class IGTD(MappingMethod):
|
|
|
187
190
|
corr1 = np.dot(np.transpose(data), data)
|
|
188
191
|
corr2 = data.shape[0] - np.dot(np.transpose(1 - data), 1 - data)
|
|
189
192
|
corr = corr1 / corr2
|
|
193
|
+
elif self.fea_dist_method == 'Wasserstein':
|
|
194
|
+
corr = squareform(pdist(np.transpose(data), lambda u, v: wasserstein_distance(u, v)))
|
|
195
|
+
corr = np.max(corr) - corr
|
|
196
|
+
corr = corr / np.max(corr)
|
|
197
|
+
elif self.fea_dist_method == 'Jensen':
|
|
198
|
+
corr = squareform(pdist(np.transpose(data), metric='jensenshannon'))
|
|
199
|
+
corr = np.max(corr) - corr
|
|
200
|
+
corr = corr / np.max(corr)
|
|
201
|
+
elif self.fea_dist_method == 'Geodesic':
|
|
202
|
+
isomap = Isomap(n_components = 3)
|
|
203
|
+
embedding = isomap.fit_transform(np.transpose(data))
|
|
204
|
+
corr = pairwise_distances(embedding, metric = 'euclidean')
|
|
205
|
+
corr = np.max(corr) - corr
|
|
206
|
+
corr = corr / np.max(corr)
|
|
207
|
+
elif self.fea_dist_method == 'Tropical':
|
|
208
|
+
corr = squareform(pdist(np.transpose(data), metric= tropical_distance))
|
|
209
|
+
corr = np.max(corr) - corr
|
|
210
|
+
corr = corr / np.max(corr)
|
|
190
211
|
|
|
191
212
|
corr = 1 - corr
|
|
192
213
|
corr = np.around(a=corr, decimals=10)
|
|
@@ -156,13 +156,12 @@ class ParamImageMethod(MappingMethod):
|
|
|
156
156
|
Returns:
|
|
157
157
|
imgs_coord: Matrix with pixel values by averaging features values
|
|
158
158
|
"""
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return self._avg_features_by_pixels(x)
|
|
159
|
+
if self._group_method == constants.avg_option:
|
|
160
|
+
return self._avg_features_by_pixels(x)
|
|
161
|
+
elif self._group_method == constants.relevance_option:
|
|
162
|
+
return self._rev_features_by_pixels(x)
|
|
163
|
+
else:
|
|
164
|
+
return self._avg_features_by_pixels(x)
|
|
166
165
|
|
|
167
166
|
|
|
168
167
|
def _avg_features_by_pixels(self,x):
|
|
@@ -180,23 +179,19 @@ class ParamImageMethod(MappingMethod):
|
|
|
180
179
|
|
|
181
180
|
def _rev_features_by_pixels(self,x):
|
|
182
181
|
"""
|
|
183
|
-
Calculate the pixel values by weighted
|
|
182
|
+
Calculate the pixel values by relevance weighted average of the features values
|
|
184
183
|
Args:
|
|
185
184
|
x:Dataset
|
|
186
185
|
|
|
187
186
|
Returns:
|
|
188
|
-
|
|
187
|
+
pixel_values: Dataframe with pixel values calculated and its positions
|
|
189
188
|
"""
|
|
190
|
-
|
|
191
189
|
features_info=np.hstack((self._features_positions, self._features_relevance))
|
|
192
190
|
features_dot_rev=(x.T)*(features_info[:,2].reshape(-1,1))
|
|
193
191
|
rev_sum = (pd.DataFrame(features_info).groupby([0, 1], as_index=False).transform('sum')).to_numpy()
|
|
194
192
|
features_rev=features_dot_rev/rev_sum
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
pixels_values=pixels_sum[:,2:]/rev_count[:,2].reshape(-1,1)
|
|
198
|
-
imgs_coord=pd.DataFrame(np.hstack((pixels_sum[:,:2], pixels_values)))
|
|
199
|
-
return imgs_coord
|
|
193
|
+
pixels_values=(pd.DataFrame(np.hstack((self._features_positions, features_rev))).groupby([0, 1], as_index=False).sum())
|
|
194
|
+
return pixels_values
|
|
200
195
|
|
|
201
196
|
|
|
202
197
|
def _create_images(self,imgs_coord,y):
|