hoxo-m / densratio_py

A Python Package for Density Ratio Estimation
https://github.com/hoxo-m/densratio_py
Other
127 stars 30 forks source link

tests.test_RuLSIF::test_alphadensratio_2d fails #17

Open mierzejk opened 1 year ago

mierzejk commented 1 year ago

As of 5757f365e0c68666c50e2d3f2dc46e72a0e85b2a, when compute_kernel_Gaussian function is executed with numba (both cpu and parallel as the set_compute_kernel_target target argument), the tests.test_RuLSIF::test_alphadensratio_2d test fails with the following error:

ValueError: _compute_kernel_Gaussian: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (m, p),(p),()->(m) (size 2 is different from 1)

The failure is due to density_ratio being a 2d multivariate estimator, but a 1d linear space is passed as an argument to the compute_density_ratio method. Unlike numpy, numba places a strict constraint on operand dimensions with the guvectorize signature argument; numpy simply broadcasts.