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

Use a unique function check_function #285

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

qbarthelemy
Copy link
Member

Many functions check the function name, but each one has its own function: _check_ajd_function, _check_cov_est_function, _check_distance_function, _check_mean_functions, etc.

This PR:

  • uses a single function for ajd, covariance, distance and mean,
  • uses it for geodesic, kernel, and tangent_space,
  • and completes tests.

@qbarthelemy qbarthelemy requested a review from gcattan March 8, 2024 12:40
Copy link
Collaborator

@gcattan gcattan left a comment

Choose a reason for hiding this comment

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

Nice job @qbarthelemy! A few minor comments.

Do we need to update api.rst?

tests/test_utils_utils.py Show resolved Hide resolved
pyriemann/utils/utils.py Show resolved Hide resolved
Comment on lines 383 to +384
# NOT IN API
def transport(Covs, Cref, metric='riemann'):
def transport(Covs, Cref, metric="riemann"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it be private:
def _transport

Copy link
Member Author

Choose a reason for hiding this comment

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

It’s true that it’s an orphan function.
At one time we were planning to create a utils.transport module, @plcrodrigues

pyriemann/utils/tangentspace.py Show resolved Hide resolved
@qbarthelemy
Copy link
Member Author

Do we need to update api.rst?

The other utils.utils functions are not in the API, so I don't think so.
Which function of utils.utils do you need for pyRiemann-qiskit?

@gcattan
Copy link
Collaborator

gcattan commented Mar 9, 2024

I though we might need check_function and check_metric too in the future. But you are right. May be we can just write the API when we will need it in pyriemann_qiskit.

@qbarthelemy
Copy link
Member Author

qbarthelemy commented Mar 11, 2024

@agramfort , what is your advice about utils.utils?

Do we add them to the API?
also, do we rename utils.utils into utils.check?

Copy link
Collaborator

@gcattan gcattan left a comment

Choose a reason for hiding this comment

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

Thx @qbarthelemy! From my perspective, it is all good.
I will let @agramfort and @plcrodrigues comment on the other points, which can also be addressed in follow-up issues (if necessary).

@agramfort
Copy link
Member

@qbarthelemy qbarthelemy merged commit c3cf1d4 into pyRiemann:master Mar 13, 2024
10 checks passed
@qbarthelemy qbarthelemy deleted the utils_check_function branch March 13, 2024 11:41
AmmarMian pushed a commit to AmmarMian/pyRiemann that referenced this pull request Jun 13, 2024
* use a unique function check_function

* complete doc
qbarthelemy added a commit that referenced this pull request Jun 21, 2024
* Basic K-means clustering example on remote-sensing/complex data

* Speed up TimeDelayCovariances (#281)

* complete test for time delay cov

* update whatsnew

* speedup TimeDelayCovariances removing a for loop

* Update pyriemann/estimation.py

Co-authored-by: Alexandre Gramfort <[email protected]>

---------

Co-authored-by: Alexandre Gramfort <[email protected]>

* clean imports in examples

* improve equations (#282)

* Remove warnings from examples and tests (#283)

* remove warnings from examples and tests

* correct flake8

* remove useless checks because requirements are sklearn version sup to 0.24

* remove useless imports

* Use a unique function check_metric (#284)

* improve checking of metric arguments

* improve checking of metric arguments bis

* improve error messages

* last modifs

* apply code review remarks

* Enhance ajd module (#238)

* Enhance ajd module

* correct whatsnew

* improve code

* complete refs

* mean ale supporting hpd matrices

* remove support of hpd matrices for ajd_pham

* last modifs

* update version number

* modify n_iter_max of ajd_pham

* apply suggestions from code review

Co-authored-by: Vasco Schiavo <[email protected]>

* correct

---------

Co-authored-by: Vasco Schiavo <[email protected]>

* Use a unique function check_function (#285)

* use a unique function check_function

* complete doc

* sort imports in tests

* Correct example on covariance estimation (#286)

* change range of window lengths

* improve imports in examples

* remove useless imports

* add blank line

* small improvements

* Improve viz module (#287)

* improve viz module

* move plot_cov_ellipse into viz module

* add plot_bihist in viz

* add reference

* garantee to have 0.5 value in bin edges

* add matplotlib in requirements

* complete whatsnew

* correct indentation

* add plot_scatter

Co-authored-by: gcattan <[email protected]>

* correct flake8

* ensure to draw line y=x

---------

Co-authored-by: gcattan <[email protected]>

* Improve conftest (#289)

* Add class CrossSpectra (#288)

* add class cross spectra

* complete whatsnew

* correct typo

* improve doc

* Create pypi-publish.yml (#290)

* prepare release 0.6 (#291)

* update release and year

* Add LLE kernel option (#293)

* Add kernel option and tests

* Update whatsnew.rst

* Update whatsnew.rst

* Apply suggestions from code review

Co-authored-by: Quentin Barthélemy <[email protected]>

* lint

* improve whatsnew

* Apply suggestions from code review

Co-authored-by: Quentin Barthélemy <[email protected]>

* linting

* add none kernel test

* might needed for flake8

* Update embedding.py

* Delete .idea/workspace.xml

* Update test_embedding.py

* Update test_embedding.py

* Apply suggestions from code review

Co-authored-by: Quentin Barthélemy <[email protected]>

* change error

* linting

---------

Co-authored-by: Quentin Barthélemy <[email protected]>

* Adding Euclidean Alignment as implemented in the paper

* Organizing code

* Organizing code

* resolving comments

* Adapting TLCenter

* simplify code and complete doc

* deleting 'euclidean.py' file

* fixing flake8 errors

* updating whatsnew file

* move contrib to version 0.7 in whatsnew

* remove warnings from test_embedding

* Update testing.yml (#294)

* Update testing.yml

* Update testing.yml

* Fix LLE warning mistake (#295)

* Improve clustering module (#296)

* improve clustering module

* correct tests

* improve clustering

* Update pyriemann/clustering.py

Co-authored-by: Alexandre Gramfort <[email protected]>

* improve doc

* improve doc again

---------

Co-authored-by: Alexandre Gramfort <[email protected]>

* Improve classification module (#297)

* improve classification module

* correct indentation

* improve indentations for SVC

* correct indentation again

* imrpove regression module (#300)

* improve tests (#301)

* Enhance ajd_pham to process HPD matrices (#299)

* enhance ajd_pham to process HPD matrices

* update mean_ale doc and test to process HPD matrices

* complete whatsnew

* Add partial_fit function to Whitening for online applications (#277)

* Add functionality to whiten covariance matrices in online applications

* add partial_fit

* complete whatsnew

* update version added

* Changes to partial_fit to get it working in online applications

* fix errors, simplify code and allow dimension reduction

* improve whatsnew

---------

Co-authored-by: qbarthelemy <[email protected]>

* improve tangentspace module (#304)

* Improve channelselection module (#303)

* improve channelselection module

* Update pyriemann/channelselection.py

Co-authored-by: gcattan <[email protected]>

* last modifs

---------

Co-authored-by: gcattan <[email protected]>

* Improve embedding module (#302)

* improve embedding module

* Update pyriemann/embedding.py

Co-authored-by: gcattan <[email protected]>

* remove np.dot

* simplify code for _get_affinity_matrix

---------

Co-authored-by: gcattan <[email protected]>

* Add get_weights (#305)

* add get_weights

* complete whatsnew

* fix blank line

* replace is_weight by use_weight

* change extension of readme file

* Refactored code and more in the pyRiemann style

* Whatsnew remote sensing

* small modifs on code

* small fix on estimator + new strategy to visualize results in remote sensing examples

* Flake8

* small modifs

* PCA from sklearn

* Better image processing API

* transform pca_image into a private function

* improve code and doc

* Removed redundant RemoveMeanImage

---------

Co-authored-by: Quentin Barthélemy <[email protected]>
Co-authored-by: Alexandre Gramfort <[email protected]>
Co-authored-by: Vasco Schiavo <[email protected]>
Co-authored-by: gcattan <[email protected]>
Co-authored-by: Gabriel Wagner vom Berg <[email protected]>
Co-authored-by: brunalopes <[email protected]>
Co-authored-by: Brent Gaisford <[email protected]>
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.

4 participants