Skip to content

Revise tests and numerous fixes#149

Merged
vabor112 merged 37 commits into
mainfrom
improve_tests
Nov 27, 2024
Merged

Revise tests and numerous fixes#149
vabor112 merged 37 commits into
mainfrom
improve_tests

Conversation

@vabor112
Copy link
Copy Markdown
Member

No description provided.

… below.

- Improve lab_extras.take_along_axis
- SpecialOrthogonal/SpecialUnitary fixes for non-numpy backends
- Add str for all spaces
- Hypersphere.num_eigenfunctions refactor to avoid code duplication
- Add num_eigenfunctions caching in WeylAdditionTheorem, similar to how it is done in SphericalHarmonics
…Orthogonal, SpecialUnitary spaces buy introducing the new tests/spaces/test_eigenfunctions_basics.py and more:

- fix a bug in SpecialUnitary under TensorFlow
- add Euclidean Matérn -1/2 -3/2 -5/2 and RBF kernels to geometric_kernels/utils/special_functions.py
…the requested number of eigenpairs exceeds the size of the adjacency matrix. Also, added support of sparray (in addition to spmatrix) in lab_extras/numpy/sparse_extras.py.
…s_basics.py, add tests/spaces/test_eigenvalues.py and tests/spaces/test_basics.py
…ax and tensorflow by removing item assignments and adding explicit casts
…ked in different places throughout the tests
- Implemented some alternative formulas for the heat kernel on `Hyperbolic` and `SymmetricPositiveDefiniteMatrices` for testing, along with the respective tests.
- Revised and refactored the tests for `ProductDiscreteSpectrumSpace` and `ProductGeometricKernel`.
- Changed `params_to_params_list` function to take the number of factors as an explicit parameter. `ProductGeometricKernel` can now take 1-d length scale and nu parameters.
- Rewritten `random` for `Hyperbolic` and `SymmetricPositiveDefiniteMatrices` to actually use the provided random key.
- Moved the implementation of `Hyperbolic.distance` and `Hyperbolic.inner_product` to utils.manifold_utils (the functions `hyperbolic_distance` and `minkowski_inner_product`).
- Moved MaternKarhunenLoeveKernel import inside __init__ in feature_maps/random_phase.py to avoid circular imports.
- Added an informative error message in case `check_function_with_backend` fails because of shape mismatch.
- Added a workaround for a bug in lab (wesselb/lab#21) - it was only an issue for one of the tests and couldn't have affected the main code.
- Moved all kernel formulas from `utils.special_functions` to a new subpackage `utils.kernel_formulas`.
- Updated bib entries for the "Stationary Kernels and Gaussian Processes on Lie Groups and their Homogeneous Spaces" papers which have been recently accepted by JMLR.
…/test_spd.py to speed up tests and make them more robust in the light of numerical instabilities
@vabor112 vabor112 force-pushed the improve_tests branch 2 times, most recently from 412f44b to edf9073 Compare November 18, 2024 11:52
…ctrumSpace` that were arising under torch and tensorflow when you mix complex and real data types. More details below.
@vabor112 vabor112 marked this pull request as ready for review November 19, 2024 19:48
Copy link
Copy Markdown
Collaborator

@stoprightthere stoprightthere left a comment

Choose a reason for hiding this comment

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

I've reviewed roughly 2/3 of the changes. Good job! Check some of my comments out.

Comment thread geometric_kernels/lab_extras/jax/extras.py Outdated
Comment thread geometric_kernels/lab_extras/numpy/extras.py Outdated
Comment thread geometric_kernels/lab_extras/tensorflow/extras.py Outdated
Comment thread geometric_kernels/lab_extras/torch/extras.py Outdated
Comment thread geometric_kernels/spaces/hyperbolic.py
Comment thread tests/sampling/test_samplers.py Outdated
Comment thread tests/sampling/test_samplers.py
Comment thread tests/spaces/test_hyperbolic.py Outdated
Comment thread tests/spaces/test_hyperbolic.py Outdated
Comment thread tests/spaces/test_product_discrete_spectrum_space.py Outdated
Copy link
Copy Markdown
Collaborator

@stoprightthere stoprightthere left a comment

Choose a reason for hiding this comment

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

Thanks! Please take a look at the remaining comments.

X,
X2,
compare_to_result=lambda res, f_out: B.shape(f_out) == res,
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This can't be an issue because you can recursively cast nested dicts/lists:

def apply_recursive(data: Any, func: Callable[[Any], Any]) -> Any:
    if isinstance(data, dict):
        return {key: apply_recursive(value, func) for key, value in data.items()}
    elif isinstance(data, list):
        return [apply_recursive(element, func) for element in data]
    else:
        return func(data)

But a def will do!

Comment thread tests/kernels/test_matern_karhunenloeve_kernel.py
Comment thread tests/spaces/test_circle.py Outdated
Comment thread tests/kernels/test_matern_karhunenloeve_kernel.py Outdated
Comment thread tests/spaces/test_eigenfunctions.py Outdated
Comment thread tests/spaces/test_eigenvalues.py Outdated
Comment thread tests/spaces/test_hyperbolic.py Outdated
Comment thread tests/spaces/test_hypercube_graph.py Outdated
Comment thread tests/spaces/test_hypersphere.py Outdated
Comment thread tests/spaces/test_spd.py Outdated
@vabor112 vabor112 changed the title Improve tests Revise tests and numerous fixes Nov 27, 2024
Copy link
Copy Markdown
Collaborator

@stoprightthere stoprightthere left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM!

@vabor112 vabor112 merged commit 60df9cb into main Nov 27, 2024
@stoprightthere stoprightthere deleted the improve_tests branch March 10, 2026 21:21
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