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.
Files changed (129) hide show
  1. {tintolib-1.2.1 → tintolib-1.3.0}/.gitignore +5 -3
  2. {tintolib-1.2.1 → tintolib-1.3.0}/PKG-INFO +46 -20
  3. {tintolib-1.2.1 → tintolib-1.3.0}/README.md +14 -6
  4. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/clusters.py +213 -16
  5. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/deepInsight.py +21 -11
  6. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/fotomics.py +12 -13
  7. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/igtd.py +22 -1
  8. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/paramImageMethod.py +10 -15
  9. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/refined.py +15 -4
  10. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/supertml.py +4 -1
  11. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/assigner.py +23 -19
  12. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/geometry.py +6 -1
  13. tintolib-1.3.0/pyproject.toml +72 -0
  14. tintolib-1.2.1/CITATION.cff +0 -39
  15. tintolib-1.2.1/Dataset/Multiclass/iris.csv +0 -151
  16. tintolib-1.2.1/Dataset/Regression/boston.csv +0 -507
  17. tintolib-1.2.1/Gemfile +0 -5
  18. tintolib-1.2.1/Gemfile.lock +0 -283
  19. tintolib-1.2.1/Papers Accepted/IEEE_JSTSP-TINTO_Hybrid_Neural_Networks.pdf +0 -0
  20. tintolib-1.2.1/Papers Accepted/INFUS-TINTO Use Case.pdf +0 -0
  21. tintolib-1.2.1/Papers Accepted/SoftwareX-TINTO Method.pdf +0 -0
  22. tintolib-1.2.1/Papers Accepted/SoftwareX-TINTOlib Library.pdf +16 -6686
  23. tintolib-1.2.1/Papers Accepted/TINTOlib-Benchmark-INFFUS.pdf +62 -21804
  24. tintolib-1.2.1/docs/.sass-cache/0bdba15b6d9b14ad176ecccceec543b5723d4a16/minima.scssc +0 -0
  25. tintolib-1.2.1/docs/.sass-cache/612f965de465c2fcff7de7ff3d41a706b9cd3d77/_base.scssc +0 -0
  26. tintolib-1.2.1/docs/.sass-cache/612f965de465c2fcff7de7ff3d41a706b9cd3d77/_layout.scssc +0 -0
  27. tintolib-1.2.1/docs/.sass-cache/612f965de465c2fcff7de7ff3d41a706b9cd3d77/_syntax-highlighting.scssc +0 -0
  28. tintolib-1.2.1/docs/.sass-cache/7995130582743275bf9ef216581ba1f64be550d0/_base.scssc +0 -0
  29. tintolib-1.2.1/docs/.sass-cache/7995130582743275bf9ef216581ba1f64be550d0/_layout.scssc +0 -0
  30. tintolib-1.2.1/docs/.sass-cache/7995130582743275bf9ef216581ba1f64be550d0/_syntax-highlighting.scssc +0 -0
  31. tintolib-1.2.1/docs/.sass-cache/ab63ac6cbbcf8f13c333c99c0c7d195aee5e7671/minima.scssc +0 -0
  32. tintolib-1.2.1/docs/Gemfile.lock +0 -4
  33. tintolib-1.2.1/docs/_config.yml +0 -18
  34. tintolib-1.2.1/docs/_data/datasets/binary/adult_cleaned/dataset.yml +0 -693
  35. tintolib-1.2.1/docs/_data/datasets/binary/bioresponse/dataset.yml +0 -433
  36. tintolib-1.2.1/docs/_data/datasets/binary/credit-approval/dataset.yml +0 -693
  37. tintolib-1.2.1/docs/_data/datasets/binary/dengue_chikunguya_bin/dataset.yml +0 -693
  38. tintolib-1.2.1/docs/_data/datasets/binary/nomao/dataset.yml +0 -693
  39. tintolib-1.2.1/docs/_data/datasets/binary/preprocessed_heloc/dataset.yml +0 -680
  40. tintolib-1.2.1/docs/_data/datasets/binary/qsar-biodeg/dataset.yml +0 -693
  41. tintolib-1.2.1/docs/_data/datasets/binary/sick_cleaned/dataset.yml +0 -693
  42. tintolib-1.2.1/docs/_data/datasets/multiclass/cmc/dataset.yml +0 -672
  43. tintolib-1.2.1/docs/_data/datasets/multiclass/cnae-9/dataset.yml +0 -479
  44. tintolib-1.2.1/docs/_data/datasets/multiclass/connect-4/dataset.yml +0 -661
  45. tintolib-1.2.1/docs/_data/datasets/multiclass/covtype/dataset.yml +0 -290
  46. tintolib-1.2.1/docs/_data/datasets/multiclass/dna/dataset.yml +0 -414
  47. tintolib-1.2.1/docs/_data/datasets/multiclass/gas-drift/dataset.yml +0 -496
  48. tintolib-1.2.1/docs/_data/datasets/multiclass/isolet/dataset.yml +0 -420
  49. tintolib-1.2.1/docs/_data/datasets/multiclass/mfeat-fourier/dataset.yml +0 -179
  50. tintolib-1.2.1/docs/_data/datasets/regression/boston/dataset.yml +0 -545
  51. tintolib-1.2.1/docs/_data/datasets/regression/california_housing/dataset.yml +0 -545
  52. tintolib-1.2.1/docs/_data/datasets/regression/geographical_origin_of_music/dataset.yml +0 -545
  53. tintolib-1.2.1/docs/_data/datasets/regression/geographical_origin_of_music/dataset_original.yml +0 -547
  54. tintolib-1.2.1/docs/_data/datasets/regression/health_insurance/dataset.yml +0 -441
  55. tintolib-1.2.1/docs/_data/datasets/regression/pumadyn32nh/dataset.yml +0 -545
  56. tintolib-1.2.1/docs/_data/datasets/regression/student_performance_por/dataset.yml +0 -545
  57. tintolib-1.2.1/docs/_data/datasets/regression/superconductivity/dataset.yml +0 -351
  58. tintolib-1.2.1/docs/_data/quick_check/binary.yml +0 -216
  59. tintolib-1.2.1/docs/_data/quick_check/multiclass.yml +0 -216
  60. tintolib-1.2.1/docs/_data/quick_check/regression.yml +0 -189
  61. tintolib-1.2.1/docs/_includes/gallery.html +0 -0
  62. tintolib-1.2.1/docs/_includes/mini-table.html +0 -0
  63. tintolib-1.2.1/docs/_includes/two-col.html +0 -0
  64. tintolib-1.2.1/docs/_site/assets/css/custom.scss +0 -15
  65. tintolib-1.2.1/docs/_site/assets/images/binary/dataset-4.png +0 -0
  66. tintolib-1.2.1/docs/_site/assets/images/multiclass/dataset-3.png +0 -0
  67. tintolib-1.2.1/docs/_site/assets/images/regression/dataset-1.png +0 -0
  68. tintolib-1.2.1/docs/_site/assets/images/regression/dataset-2.png +0 -0
  69. tintolib-1.2.1/docs/_site/assets/main.css +0 -1
  70. tintolib-1.2.1/docs/_site/assets/minima-social-icons.svg +0 -33
  71. tintolib-1.2.1/docs/_site/binary.html +0 -55904
  72. tintolib-1.2.1/docs/_site/feed.xml +0 -1
  73. tintolib-1.2.1/docs/_site/index.html +0 -116
  74. tintolib-1.2.1/docs/_site/multiclass.html +0 -37261
  75. tintolib-1.2.1/docs/_site/regression.html +0 -37669
  76. tintolib-1.2.1/docs/assets/css/custom.scss +0 -15
  77. tintolib-1.2.1/docs/assets/images/binary/dataset-4.png +0 -0
  78. tintolib-1.2.1/docs/assets/images/multiclass/dataset-3.png +0 -0
  79. tintolib-1.2.1/docs/assets/images/regression/dataset-1.png +0 -0
  80. tintolib-1.2.1/docs/assets/images/regression/dataset-2.png +0 -0
  81. tintolib-1.2.1/docs/assets/main.scss +0 -22
  82. tintolib-1.2.1/docs/binary.md +0 -306
  83. tintolib-1.2.1/docs/index.md +0 -33
  84. tintolib-1.2.1/docs/multiclass.md +0 -303
  85. tintolib-1.2.1/docs/regression.md +0 -298
  86. tintolib-1.2.1/examples/Pytorch_Regression-ViT.ipynb +0 -2905
  87. tintolib-1.2.1/examples/Pytorch_Regression-ViT.py +0 -666
  88. tintolib-1.2.1/examples/Pytorch_Regression_HyViT.ipynb +0 -2073
  89. tintolib-1.2.1/examples/TINTOlib-example.ipynb +0 -626
  90. tintolib-1.2.1/examples/Tensorflow_Classification_CNN.ipynb +0 -2421
  91. tintolib-1.2.1/examples/Tensorlflow_Multiclass_HyCNN.ipynb +0 -2385
  92. tintolib-1.2.1/examples/vit_pytorch/vit.py +0 -127
  93. tintolib-1.2.1/imgs/HybridViT.png +0 -0
  94. tintolib-1.2.1/imgs/Tabular-to-image-CNN.jpg +0 -0
  95. tintolib-1.2.1/imgs/blurring.png +0 -0
  96. tintolib-1.2.1/imgs/characteristic.png +0 -0
  97. tintolib-1.2.1/imgs/cnn.png +0 -0
  98. tintolib-1.2.1/imgs/hynn.png +0 -0
  99. tintolib-1.2.1/imgs/hynn_cla.png +0 -0
  100. tintolib-1.2.1/imgs/logo-oeg.png +0 -0
  101. tintolib-1.2.1/imgs/logo-uclm.png +0 -0
  102. tintolib-1.2.1/imgs/logo-uned-.jpg +0 -0
  103. tintolib-1.2.1/imgs/logo-upm.png +0 -0
  104. tintolib-1.2.1/imgs/logo.svg +0 -8
  105. tintolib-1.2.1/imgs/vit.png +0 -0
  106. tintolib-1.2.1/pyproject.toml +0 -42
  107. tintolib-1.2.1/requirements-example.txt +0 -14
  108. tintolib-1.2.1/requirements.txt +0 -10
  109. tintolib-1.2.1/scripts/generate_quick_check.py +0 -141
  110. tintolib-1.2.1/video/TINTOlib-video-En.mp4 +0 -0
  111. tintolib-1.2.1/video/TINTOlib-video-Es.mp4 +0 -0
  112. {tintolib-1.2.1 → tintolib-1.3.0}/LICENSE +0 -0
  113. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/__init__.py +0 -0
  114. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/abstractImageMethod.py +0 -0
  115. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/barGraph.py +0 -0
  116. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/base.py +0 -0
  117. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/bie.py +0 -0
  118. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/combination.py +0 -0
  119. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/distanceMatrix.py +0 -0
  120. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/featureWrap.py +0 -0
  121. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/mappingMethod.py +0 -0
  122. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/tinto.py +0 -0
  123. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/CustomTransformer.py +0 -0
  124. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/LogScaler.py +0 -0
  125. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/Toolbox.py +0 -0
  126. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/config.py +0 -0
  127. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/constants.py +0 -0
  128. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/mpiHill_UF.py +0 -0
  129. {tintolib-1.2.1 → tintolib-1.3.0}/TINTOlib/utils/paraHill.py +0 -0
@@ -1,12 +1,14 @@
1
- **/__pycache__
2
- =======
3
- #Misc
1
+ # Misc
2
+ .DS_Store
4
3
  HyNNImages/
4
+ SyntheticImages/
5
5
  logs/
6
6
  data/
7
7
  scripts_logs/
8
+ objs.pkl
8
9
 
9
10
  # Byte-compiled / optimized / DLL files
11
+ **/__pycache__/
10
12
  __pycache__/
11
13
  *.py[cod]
12
14
  *$py.class
@@ -1,9 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TINTOlib
3
- Version: 1.2.1
3
+ Version: 1.3.0
4
4
  Summary: Converting tabular data into images
5
- Project-URL: Homepage, https://github.com/oeg-upm/TINTOlib-Documentation
6
- 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>, SalvadorMartinez <salvador.martinez.moreno@gmail.com>
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
- Requires-Python: >=3.8
213
- Requires-Dist: asymmetric-greedy-search==0.1.0
214
- Requires-Dist: bitstring==4.3.0
215
- Requires-Dist: matplotlib==3.9.4
216
- Requires-Dist: numba==0.62.0
217
- Requires-Dist: numpy==1.26.4
218
- Requires-Dist: opencv-python==4.11.0.86
219
- Requires-Dist: pandas==2.2.3
220
- Requires-Dist: scikit-learn==1.6.1
221
- Requires-Dist: scipy==1.15.0
222
- Requires-Dist: tqdm==4.67.1
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
  [![GitHub Pages](https://img.shields.io/badge/GitHub%20Pages-View%20Documentation-brightgreen?logo=github)](https://oeg-upm.github.io/TINTOlib/)
228
246
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](https://github.com/oeg-upm/TINTOlib-Documentation/blob/main/LICENSE)
229
- [![Python Version](https://shields.io/badge/python-3.8+-blue)](https://pypi.python.org/pypi/)
247
+ [![Python Version](https://shields.io/badge/python-3.9+-blue)](https://pypi.python.org/pypi/)
230
248
  [![Documentation Status](https://readthedocs.org/projects/morph-kgc/badge/?version=latest)](https://tintolib.readthedocs.io/en/latest/)
231
249
  [![Open In Colab-CNN](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/oeg-upm/TINTOlib-Crash_Course/blob/main/Notebooks/Challenge/Regression_CNN.ipynb)
232
250
  [![Open In Colab-CNN+MLP](https://colab.research.google.com/assets/colab-badge.svg)](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.8+**
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 mpi4py
395
+ pip install "TINTOlib[refined]"
378
396
  ```
379
397
  - **MacOS / Windows:** Direct installation is usually supported:
380
398
 
381
399
  ```bash
382
- pip install mpi4py
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 listing the **core dependencies** required to use TINTOlib. You can directly run the **TINTOlib-example.ipynb** notebook located in the examples/ folder using the dependencies listed in `requirements.txt`.
414
- - **mpi4py** is only required if you use the **REFINED** method; see the [platform-specific notes](#platform-specific-notes).
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
  [![GitHub Pages](https://img.shields.io/badge/GitHub%20Pages-View%20Documentation-brightgreen?logo=github)](https://oeg-upm.github.io/TINTOlib/)
4
4
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](https://github.com/oeg-upm/TINTOlib-Documentation/blob/main/LICENSE)
5
- [![Python Version](https://shields.io/badge/python-3.8+-blue)](https://pypi.python.org/pypi/)
5
+ [![Python Version](https://shields.io/badge/python-3.9+-blue)](https://pypi.python.org/pypi/)
6
6
  [![Documentation Status](https://readthedocs.org/projects/morph-kgc/badge/?version=latest)](https://tintolib.readthedocs.io/en/latest/)
7
7
  [![Open In Colab-CNN](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/oeg-upm/TINTOlib-Crash_Course/blob/main/Notebooks/Challenge/Regression_CNN.ipynb)
8
8
  [![Open In Colab-CNN+MLP](https://colab.research.google.com/assets/colab-badge.svg)](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.8+**
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 mpi4py
153
+ pip install "TINTOlib[refined]"
154
154
  ```
155
155
  - **MacOS / Windows:** Direct installation is usually supported:
156
156
 
157
157
  ```bash
158
- pip install mpi4py
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 listing the **core dependencies** required to use TINTOlib. You can directly run the **TINTOlib-example.ipynb** notebook located in the examples/ folder using the dependencies listed in `requirements.txt`.
190
- - **mpi4py** is only required if you use the **REFINED** method; see the [platform-specific notes](#platform-specific-notes).
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 = default_n_clusters,
138
- random_seed=default_random_seed,
139
- n_init = default_n_init,
140
- max_iter = default_max_iter,
141
- algorithmMethod = default_algorithmMethod,
142
- covariance_type = default_covariance_type,
143
- ensamMethod = default_ensamMethod,
144
- bandwidth = default_bandwidth,
145
- kernel = default_kernel,
146
- metric=default_metric,
147
- RBFKmeans=default_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 (algorithm=="kde" or algorithm=="aggloKNN") and (n_clusters=="auto" or isinstance(n_clusters, list)):
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
- match self.__algorithm_rd:
100
- case constants.pca_algorithm:
101
- return PCA(n_components=2,random_state=self._random_seed).fit_transform(x)
102
- case constants.tsne_algorithm:
103
- return TSNE(n_components=2,metric='cosine',random_state=self._random_seed,perplexity=self._image_dim).fit_transform(x)
104
- case constants.kpca_algorithm:
105
- return KernelPCA(n_components=2,kernel='rbf',random_state=self._random_seed).fit_transform(x)
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
- match self.__outliers_treatment:
144
- case constants.avg_option:
145
- subs = np.tile(np.mean(x, axis=0), (x.shape[0], 1)).T
146
- x_t = np.where(x_t >= lower_limits, x_t, subs)
147
- x_t = np.where(x_t <= upper_limits, x_t, subs)
148
- case constants.max_min_option:
149
- max = np.tile(lower_limits.T, (x.shape[0], 1)).T
150
- min = np.tile(upper_limits.T, (x.shape[0], 1)).T
151
- x_t = np.where(x_t >= lower_limits, x_t, max)
152
- x_t = np.where(x_t <= upper_limits, x_t, min)
153
- case constants.zero_option:
154
- x_t = np.where(x_t >= lower_limits, x_t, 0)
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
- match self._group_method:
160
- case constants.avg_option:
161
- return self._avg_features_by_pixels(x)
162
- case constants.relevance_option:
163
- return self._rev_features_by_pixels(x)
164
- case _:
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 sum of the value of each feature and its relevance
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
- pixels_sum=(pd.DataFrame(np.hstack((self._features_positions, features_rev))).groupby([0, 1], as_index=False).sum()).to_numpy()
196
- rev_count = (pd.DataFrame(features_info).groupby([0, 1], as_index=False).count()).to_numpy()
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):