dadapy 0.2.0__tar.gz → 0.3.1__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 (47) hide show
  1. {dadapy-0.2.0 → dadapy-0.3.1}/PKG-INFO +52 -16
  2. {dadapy-0.2.0 → dadapy-0.3.1}/README.md +42 -15
  3. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/__init__.py +5 -0
  4. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_cython/cython_clustering.c +12747 -8438
  5. dadapy-0.3.1/dadapy/_cython/cython_clustering_v2.c +18424 -0
  6. dadapy-0.3.1/dadapy/_cython/cython_density.c +11695 -0
  7. dadapy-0.3.1/dadapy/_cython/cython_differentiable_imbalance.c +33695 -0
  8. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_cython/cython_distances.c +24239 -17920
  9. dadapy-0.3.1/dadapy/_cython/cython_grads.c +39775 -0
  10. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_cython/cython_maximum_likelihood_opt.c +7216 -3973
  11. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_cython/cython_maximum_likelihood_opt_full.c +7920 -3984
  12. dadapy-0.3.1/dadapy/_cython/cython_overlap.c +29918 -0
  13. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_utils/density_estimation.py +11 -149
  14. dadapy-0.3.1/dadapy/_utils/differentiable_imbalance.py +957 -0
  15. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_utils/discrete_functions.py +0 -2
  16. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_utils/id_estimation.py +70 -14
  17. dadapy-0.3.1/dadapy/_utils/metric_comparisons.py +205 -0
  18. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_utils/utils.py +20 -22
  19. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/base.py +28 -19
  20. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/clustering.py +12 -2
  21. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/data.py +60 -40
  22. dadapy-0.3.1/dadapy/data_sets.py +102 -0
  23. dadapy-0.3.1/dadapy/density_advanced.py +437 -0
  24. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/density_estimation.py +29 -63
  25. dadapy-0.3.1/dadapy/feature_weighting.py +764 -0
  26. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/id_discrete.py +126 -347
  27. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/id_estimation.py +163 -113
  28. dadapy-0.3.1/dadapy/kstar.py +125 -0
  29. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/metric_comparisons.py +543 -109
  30. dadapy-0.3.1/dadapy/neigh_graph.py +312 -0
  31. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/plot.py +7 -7
  32. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy.egg-info/PKG-INFO +52 -16
  33. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy.egg-info/SOURCES.txt +9 -0
  34. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy.egg-info/requires.txt +2 -1
  35. {dadapy-0.2.0 → dadapy-0.3.1}/pyproject.toml +6 -3
  36. {dadapy-0.2.0 → dadapy-0.3.1}/setup.py +45 -10
  37. dadapy-0.2.0/dadapy/_cython/cython_clustering_v2.c +0 -14088
  38. dadapy-0.2.0/dadapy/_cython/cython_density.c +0 -7683
  39. dadapy-0.2.0/dadapy/_utils/metric_comparisons.py +0 -77
  40. {dadapy-0.2.0 → dadapy-0.3.1}/LICENSE +0 -0
  41. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_utils/__init__.py +0 -0
  42. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_utils/discrete_volumes/L_coefficients_exact.dat +0 -0
  43. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_utils/discrete_volumes/L_coefficients_float.dat +0 -0
  44. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy/_utils/discrete_volumes/V_exact.dat +0 -0
  45. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy.egg-info/dependency_links.txt +0 -0
  46. {dadapy-0.2.0 → dadapy-0.3.1}/dadapy.egg-info/top_level.txt +0 -0
  47. {dadapy-0.2.0 → dadapy-0.3.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dadapy
3
- Version: 0.2.0
3
+ Version: 0.3.1
4
4
  Summary: Distance-based Analysis of DAta-manifolds in python
5
5
  Author: DADApy author
6
6
  License: Apache License
@@ -209,7 +209,16 @@ Project-URL: documentation, https://dadapy.readthedocs.io/
209
209
  Project-URL: repository, https://github.com/sissa-data-science/DADApy
210
210
  Requires-Python: >=3.7
211
211
  Description-Content-Type: text/markdown
212
+ Requires-Dist: numpy<2.0
213
+ Requires-Dist: scipy
214
+ Requires-Dist: scikit-learn
215
+ Requires-Dist: matplotlib
216
+ Requires-Dist: seaborn
212
217
  Provides-Extra: dev
218
+ Requires-Dist: tox; extra == "dev"
219
+ Requires-Dist: black; extra == "dev"
220
+ Requires-Dist: isort; extra == "dev"
221
+ Requires-Dist: pytest; extra == "dev"
213
222
 
214
223
  <img src="https://raw.githubusercontent.com/sissa-data-science/DADApy/master/logo/logo_1_horizontal_transparent_v2.png" width="500">
215
224
 
@@ -220,7 +229,7 @@ Provides-Extra: dev
220
229
  ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sissa-data-science/dadapy/lint.yml?label=lint)
221
230
  ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sissa-data-science/dadapy/lint.yml?label=docs)
222
231
 
223
- DADApy is a Python package for the characterisation of manifolds in high dimensional spaces.
232
+ DADApy is a Python package for the characterization of manifolds in high-dimensional spaces.
224
233
 
225
234
 
226
235
  # Homepage
@@ -236,20 +245,32 @@ from dadapy.data import Data
236
245
  # Generate a simple 3D gaussian dataset
237
246
  X = np.random.normal(0, 1, (1000, 3))
238
247
 
239
- # initialise the "Data" class with the set of coordinates
248
+ # initialize the "Data" class with the set of coordinates
240
249
  data = Data(X)
241
250
 
242
- # compute distances up to the 100th nearest neighbour
251
+ # compute distances up to the 100th nearest neighbor
243
252
  data.compute_distances(maxk=100)
244
253
 
245
254
  # compute the intrinsic dimension using 2nn estimator
246
- data.compute_id_2NN()
255
+ id, id_error, id_distance = data.compute_id_2NN()
256
+
257
+ # compute the intrinsic dimension up to the 64th nearest neighbors using Gride
258
+ id_list, id_error_list, id_distance_list = data.return_id_scaling_gride(range_max=64)
247
259
 
248
260
  # compute the density using PAk, a point adaptive kNN estimator
249
- data.compute_density_PAk()
261
+ log_den, log_den_error = data.compute_density_PAk()
250
262
 
251
263
  # find the peaks of the density profile through the ADP algorithm
252
- data.compute_clustering_ADP()
264
+ cluster_assignment = data.compute_clustering_ADP()
265
+
266
+ # compute the neighborhood overlap with another dataset
267
+ X2 = np.random.normal(0, 1, (1000, 5))
268
+ overlap_x2 = data.return_data_overlap(X2)
269
+
270
+ # compute the neighborhood overlap with a set of labels
271
+ labels = np.repeat(np.arange(10), 100)
272
+ overlap_labels = data.return_label_overlap(labels)
273
+
253
274
  ```
254
275
 
255
276
  # Currently implemented algorithms
@@ -260,12 +281,16 @@ data.compute_clustering_ADP()
260
281
  > Facco et al., *Scientific Reports* (2017)
261
282
  - Gride estimator
262
283
  > Denti et al., *Scientific Reports* (2022)
284
+ - I3D estimator (for both continuous and discrete spaces)
285
+ > Macocco et al., *Physical Review Letters* (2023)
263
286
  - Density estimators
264
287
  -
265
288
  - kNN estimator
266
- - k*NN estimator (kNN with adaptive choice of k)
289
+ - k*NN estimator (kNN with an adaptive choice of k)
267
290
  - PAk estimator
268
291
  > Rodriguez et al., *JCTC* (2018)
292
+ - BMTI estimator
293
+ > Carli et al., *in preparation*
269
294
 
270
295
  - Density peaks clustering methods
271
296
  -
@@ -283,27 +308,38 @@ data.compute_clustering_ADP()
283
308
  - Information imbalance
284
309
  > Glielmo et al., *PNAS Nexus* (2022)
285
310
 
311
+ - Feature selection and weighting tool
312
+ -
313
+ - Differentiable Information Imbalance
314
+
286
315
 
287
316
  # Installation
288
- The package is compatible with Python >= 3.7 (tested on 3.7, 3.8 and 3.9). We currently only support Unix-based systems, including Linux and macOS.
289
- For Windows-machines we suggest using the [Windows Subsystem for Linux (WSL)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).
317
+ The package is compatible with the Python versions 3.7, 3.8, 3.9, 3.10, 3.11, and 3.12. We currently only support Unix-based systems, including Linux and macOS.
318
+ For Windows machines, we suggest using the [Windows Subsystem for Linux (WSL)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).
290
319
 
291
- The package requires `numpy`, `scipy` and `scikit-learn`, and `matplotlib` for the visualisations.
320
+ The package requires `numpy`, `scipy` and `scikit-learn`, and `matplotlib` for the visualizations.
292
321
 
293
- The package contains Cython-generated C extensions that are automatically compiled during install.
322
+ The package contains Cython-generated C extensions that are automatically compiled during installation.
294
323
 
295
- The latest release is available through pip
324
+ The latest release is available through pip:
296
325
 
297
326
  ```sh
298
327
  pip install dadapy
299
328
  ```
300
329
 
301
- To install the latest development version, clone the source code from github
302
- and install it with pip as follows
330
+ To install the latest development version, clone the source code from GitHub
331
+ and install it with pip as follows:
332
+
333
+ ```sh
334
+ pip install git+https://github.com/sissa-data-science/DADApy
335
+ ```
336
+
337
+ Alternatively, if you'd like to modify the implementation of some function locally you can download the repository and install the package with:
303
338
 
304
339
  ```sh
305
340
  git clone https://github.com/sissa-data-science/DADApy.git
306
341
  cd DADApy
342
+ python setup.py build_ext --inplace
307
343
  pip install .
308
344
  ```
309
345
 
@@ -311,7 +347,7 @@ pip install .
311
347
 
312
348
  A description of the package is available [here](https://www.sciencedirect.com/science/article/pii/S2666389922002070).
313
349
 
314
- Please consider citing it if you found this package useful for your research
350
+ Please consider citing it if you found this package useful for your research:
315
351
 
316
352
  ```bib
317
353
  @article{dadapy,
@@ -7,7 +7,7 @@
7
7
  ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sissa-data-science/dadapy/lint.yml?label=lint)
8
8
  ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sissa-data-science/dadapy/lint.yml?label=docs)
9
9
 
10
- DADApy is a Python package for the characterisation of manifolds in high dimensional spaces.
10
+ DADApy is a Python package for the characterization of manifolds in high-dimensional spaces.
11
11
 
12
12
 
13
13
  # Homepage
@@ -23,20 +23,32 @@ from dadapy.data import Data
23
23
  # Generate a simple 3D gaussian dataset
24
24
  X = np.random.normal(0, 1, (1000, 3))
25
25
 
26
- # initialise the "Data" class with the set of coordinates
26
+ # initialize the "Data" class with the set of coordinates
27
27
  data = Data(X)
28
28
 
29
- # compute distances up to the 100th nearest neighbour
29
+ # compute distances up to the 100th nearest neighbor
30
30
  data.compute_distances(maxk=100)
31
31
 
32
32
  # compute the intrinsic dimension using 2nn estimator
33
- data.compute_id_2NN()
33
+ id, id_error, id_distance = data.compute_id_2NN()
34
+
35
+ # compute the intrinsic dimension up to the 64th nearest neighbors using Gride
36
+ id_list, id_error_list, id_distance_list = data.return_id_scaling_gride(range_max=64)
34
37
 
35
38
  # compute the density using PAk, a point adaptive kNN estimator
36
- data.compute_density_PAk()
39
+ log_den, log_den_error = data.compute_density_PAk()
37
40
 
38
41
  # find the peaks of the density profile through the ADP algorithm
39
- data.compute_clustering_ADP()
42
+ cluster_assignment = data.compute_clustering_ADP()
43
+
44
+ # compute the neighborhood overlap with another dataset
45
+ X2 = np.random.normal(0, 1, (1000, 5))
46
+ overlap_x2 = data.return_data_overlap(X2)
47
+
48
+ # compute the neighborhood overlap with a set of labels
49
+ labels = np.repeat(np.arange(10), 100)
50
+ overlap_labels = data.return_label_overlap(labels)
51
+
40
52
  ```
41
53
 
42
54
  # Currently implemented algorithms
@@ -47,12 +59,16 @@ data.compute_clustering_ADP()
47
59
  > Facco et al., *Scientific Reports* (2017)
48
60
  - Gride estimator
49
61
  > Denti et al., *Scientific Reports* (2022)
62
+ - I3D estimator (for both continuous and discrete spaces)
63
+ > Macocco et al., *Physical Review Letters* (2023)
50
64
  - Density estimators
51
65
  -
52
66
  - kNN estimator
53
- - k*NN estimator (kNN with adaptive choice of k)
67
+ - k*NN estimator (kNN with an adaptive choice of k)
54
68
  - PAk estimator
55
69
  > Rodriguez et al., *JCTC* (2018)
70
+ - BMTI estimator
71
+ > Carli et al., *in preparation*
56
72
 
57
73
  - Density peaks clustering methods
58
74
  -
@@ -70,27 +86,38 @@ data.compute_clustering_ADP()
70
86
  - Information imbalance
71
87
  > Glielmo et al., *PNAS Nexus* (2022)
72
88
 
89
+ - Feature selection and weighting tool
90
+ -
91
+ - Differentiable Information Imbalance
92
+
73
93
 
74
94
  # Installation
75
- The package is compatible with Python >= 3.7 (tested on 3.7, 3.8 and 3.9). We currently only support Unix-based systems, including Linux and macOS.
76
- For Windows-machines we suggest using the [Windows Subsystem for Linux (WSL)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).
95
+ The package is compatible with the Python versions 3.7, 3.8, 3.9, 3.10, 3.11, and 3.12. We currently only support Unix-based systems, including Linux and macOS.
96
+ For Windows machines, we suggest using the [Windows Subsystem for Linux (WSL)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).
77
97
 
78
- The package requires `numpy`, `scipy` and `scikit-learn`, and `matplotlib` for the visualisations.
98
+ The package requires `numpy`, `scipy` and `scikit-learn`, and `matplotlib` for the visualizations.
79
99
 
80
- The package contains Cython-generated C extensions that are automatically compiled during install.
100
+ The package contains Cython-generated C extensions that are automatically compiled during installation.
81
101
 
82
- The latest release is available through pip
102
+ The latest release is available through pip:
83
103
 
84
104
  ```sh
85
105
  pip install dadapy
86
106
  ```
87
107
 
88
- To install the latest development version, clone the source code from github
89
- and install it with pip as follows
108
+ To install the latest development version, clone the source code from GitHub
109
+ and install it with pip as follows:
110
+
111
+ ```sh
112
+ pip install git+https://github.com/sissa-data-science/DADApy
113
+ ```
114
+
115
+ Alternatively, if you'd like to modify the implementation of some function locally you can download the repository and install the package with:
90
116
 
91
117
  ```sh
92
118
  git clone https://github.com/sissa-data-science/DADApy.git
93
119
  cd DADApy
120
+ python setup.py build_ext --inplace
94
121
  pip install .
95
122
  ```
96
123
 
@@ -98,7 +125,7 @@ pip install .
98
125
 
99
126
  A description of the package is available [here](https://www.sciencedirect.com/science/article/pii/S2666389922002070).
100
127
 
101
- Please consider citing it if you found this package useful for your research
128
+ Please consider citing it if you found this package useful for your research:
102
129
 
103
130
  ```bib
104
131
  @article{dadapy,
@@ -2,7 +2,12 @@ from ._utils.utils import *
2
2
  from .base import Base
3
3
  from .clustering import Clustering
4
4
  from .data import Data
5
+ from .data_sets import DataSets
6
+ from .density_advanced import DensityAdvanced
5
7
  from .density_estimation import DensityEstimation
8
+ from .feature_weighting import FeatureWeighting
6
9
  from .id_discrete import *
7
10
  from .id_estimation import IdEstimation
11
+ from .kstar import KStar
8
12
  from .metric_comparisons import MetricComparisons
13
+ from .neigh_graph import NeighGraph