-
Notifications
You must be signed in to change notification settings - Fork 103
Drop Python 2 Support, Modernize NumPy/SciPy APIs #123
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add uv.lock in .gitignore
|
@yuxuan-z19 Thank you for your pull request! I'm very willing to proceed and pull it. Major Please make the kernels work:
Random walk is a very fundamental kernel to approve me have it work while its failing. Minor updates @yuxuan-z19 :
|
|
@ysig @giannisnik I've investigated the failing tests in The issue stems from As a workaround, I suggest applying a positive semi-definite (PSD) correction by shifting the kernel matrix before normalization. Here is the code snippet implementing this approach: epsilon = 1e-12
min_diag = np.min(X_diag)
if min_diag < 0:
shift = abs(min_diag) + epsilon
km += shift * np.eye(km.shape[0])
X_diag = np.diagonal(km)
out = np.outer(X_diag, X_diag)
out[out == 0] = epsilon
res = km / np.sqrt(np.outer(X_diag, X_diag))This ensures the diagonal entries are all positive before computing the normalization denominator. I will add a new test to verify the correctness and stability of kernel values before and after applying the PSD adjustment on the successful tests in the |
|
@yuxuan-z19 Thank you for locating this.
|
Summary
This PR upgrades GraKeL to support Python 3.8 and above, officially dropping Python 2.x compatibility, which has been end-of-life since January 1, 2020.
In addition:
pyproject.tomlto specify minimum Python version and dependenciesCompatibility
Rationale
Runtime Warnings in Tests
During the upgrade, the following test cases raise
RuntimeWarning: invalid value encountered in sqrtordivide:These warnings may stem from:
They may indicate numerical instability or missing input validation in kernels. Review is requested to: