Description:
Python version: 3.8
numpy version: 1.22.3
ITMO_FS version: 0.3.3
When y.shape and x.shape are different, spearman_correlation fails because of missing "otypes" in np.vectorise.
This happens from np.vectorise - numpy/lib/function_base.py - _get_ufunc_and_otypes() - line 2365
otypes = ''.join([asarray(outputs[_k]).dtype.char for _k in range(nout)])
To Reproduce
Steps to reproduce the behaviour:
- I have X - a numpy array shape (1774, 601) with float and nan values.
- I have y - a numpy array shape (1774, ) with int values 0 and 1 only.
- Just run: spearman_corr(X, y)
Expected behaviour
Returns the scores and doesn't fail.
Desktop (please complete the following information):
Proposed fix:
I solved the issue by simply adding
otypes=[X.dtype]
So line 567 from filters/univariate/measures.py is now:
ranks_X[:, i] = np.vectorize(d.get, otypes=[X.dtype])(X[:, i])