Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the coverage of the tests and fix some minor bugs #64

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

lionelkusch
Copy link
Collaborator

I added in this pull request some simple tests (raise exceptions, used some options ...)

The aim of this pull request is to increase the coverage before starting to make a lot of modifications to the library.
The new tests are simple due to my lack of knowledge of the details of the different methods.

I don't take the time to format and comment on the additional tests; I will do it when I will reformat each method.

@lionelkusch
Copy link
Collaborator Author

Tis pull request is complementary to the pull request on the estimators #58 and #59 for having coverage close to 99%.
There still have a few lines of the code, which have not been tested.
The most important part will be in hidimstat/stat_coef_diff.py because there weren't any tests associated with it. If you have a suggestion, please share it with us.

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 99.48454% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.19%. Comparing base (7571832) to head (f7e3f26).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hidimstat/utils.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
+ Coverage   77.11%   80.19%   +3.07%     
==========================================
  Files          46       45       -1     
  Lines        2465     2621     +156     
==========================================
+ Hits         1901     2102     +201     
+ Misses        564      519      -45     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for taking care of that, this is super important.
Please take care of the syntax aspects.
How much does test time increase with this PR ? We need to be careful to keep it limited.

@@ -41,11 +43,18 @@ def multivariate_1D_simulation(

seed : int
Seed used for generating design matrix and noise.

nb_group : int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nb_group : int
n_groups : int

@@ -16,6 +16,8 @@ def multivariate_1D_simulation(
rho=0.0,
shuffle=True,
seed=0,
nb_group=0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nb_group=0,
n_groups=0,

result_th_screen_bad = dcrt_zero(
X,
y,
screening_threshold = 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
screening_threshold = 0,
screening_threshold=0,

mu, Sigma = _estimate_distribution(X, cov_estimator="graph_lasso")

def test_estimate_distribution_lasso():
SEED = 42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capitalized variables are global in a module (constants), so it does not make sense to define such a variable in a function.

@lionelkusch
Copy link
Collaborator Author

How much does test time increase with this PR ? We need to be careful to keep it limited.

The time for the tests is still less than 5 min, as you can see in the report below.
The longest tests will be for the estimator (#57), going until 8 min for all tests. I suppose that is still good and the tests for the estimators can be run only when the estimators files are modified.

@bthirion
Copy link
Contributor

8min is still fine, but we must be super careful here, because these numbers increase steadily.
The best way to do it is to identify which tests take the largest amount of time and see how to lower it.
But this is obviously not a priority for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants