sissa-data-science / DADApy

Distance-based Analysis of DAta-manifolds in python
https://dadapy.readthedocs.io/
Apache License 2.0
99 stars 16 forks source link

Develop causality #90

Closed vdeltatto closed 1 year ago

vdeltatto commented 1 year ago

I re-defined the argument k for the methods of the class MetricComparisons as the order of the farthest neighbour considered, instead of computing the imbalance using only the neighbour of order k. I also added two new methods return_inf_imb_causality and return_inf_imb_causality_target_rank in the MetricComparisons class in order to compute the Imbalance of the causal test (weight*X(t), Y(t)) -> Y(t+tau). Since in this case it is difficult to use a single data set as input of the constructor of MetricComparisons, the data sets X(t), Y(t) and Y(t+tau) are given in input directly to the these additional methods. If you think that it is worth to create a new class for the causality methods, I can do it and give these data sets as input of the class constructor.

In the test folder I added a new npy file to test the functions (in test_information_imbalance.py)

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 60.00% and project coverage change: -0.31 :warning:

Comparison is base (c93d472) 81.40% compared to head (4386d27) 81.10%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #90 +/- ## ========================================== - Coverage 81.40% 81.10% -0.31% ========================================== Files 10 10 Lines 1506 1519 +13 ========================================== + Hits 1226 1232 +6 - Misses 280 287 +7 ``` | [Impacted Files](https://app.codecov.io/gh/sissa-data-science/DADApy/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [dadapy/metric\_comparisons.py](https://app.codecov.io/gh/sissa-data-science/DADApy/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGFkYXB5L21ldHJpY19jb21wYXJpc29ucy5weQ==) | `67.83% <45.45%> (-1.31%)` | :arrow_down: | | [dadapy/\_utils/metric\_comparisons.py](https://app.codecov.io/gh/sissa-data-science/DADApy/pull/90?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-ZGFkYXB5L191dGlscy9tZXRyaWNfY29tcGFyaXNvbnMucHk=) | `90.90% <77.77%> (-4.10%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

AldoGl commented 1 year ago

Hi @vdeltatto, great work! This is indeed a very valuable addition to the package.

Flak8 highlights the following errors

I will suggest some specific code changes to take care of them