lcmd-epfl / Q-stack

Stack of codes for dedicated pre- and post-processing tasks for Quantum Machine Learning (QML)
MIT License
13 stars 5 forks source link

test break after 28a16ce #61

Closed briling closed 3 weeks ago

briling commented 3 weeks ago

I've installed with pip install qstack[all] git+https://github.com/lcmd-epfl/Q-stack into a fresh python 3.9 environment and test_global.py fails

>>> numpy.__version__
'1.26.4'

The "old" version is '1.21.2'

briling commented 3 weeks ago
(qstack-test) > python test_global.py
{'H': 2, 'O': 1} 3
Computing global kernel elements:
[Traceback (most recent call last):
  File "/home/xe/GIT/Q-stack/tests/test_global.py", line 38, in <module>
    test_avg_kernel()
  File "/home/xe/GIT/Q-stack/tests/test_global.py", line 11, in test_avg_kernel
    K = kernel.kernel(mols, akernel='L', gkernel='avg', sigma=1.0)
  File "/home/xe/SOFT/miniconda3/envs/qstack-test/lib/python3.9/site-packages/qstack/regression/kernel.py", line 24, in kernel
    K = kernel(X, Y, 1.0/sigma)
  File "/home/xe/SOFT/miniconda3/envs/qstack-test/lib/python3.9/site-packages/qstack/regression/kernel_utils.py", line 288, in <lambda>
    return lambda x, y, s: get_global_K(x, y, s, local_kernel, global_kernel, options)
  File "/home/xe/SOFT/miniconda3/envs/qstack-test/lib/python3.9/site-packages/qstack/regression/kernel_utils.py", line 168, in get_global_K
    if X[0] == Y[0]:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
briling commented 3 weeks ago

we can either change X[0] == Y[0] to np.all(X==Y) (also because X[0] == Y[0] does not mean that X is Y) or change the arguments to X, Y=None

YAY-C commented 3 weeks ago

closed by #63