mifs icon indicating copy to clipboard operation
mifs copied to clipboard

HELP!! All-NaN slice encountered

Open kroscek opened this issue 7 years ago • 13 comments

Using continuous variable, here I encountered error that return NaN slice.

File "", line 1, in feat_selector.fit(X_train, y_train)

File "/home/lemma/miniconda2/lib/python2.7/site-packages/mifs-0.0.1.dev0-py2.7.egg/mifs/mifs.py", line 149, in fit return self._fit(X, y) File "/home/lemma/miniconda2/lib/python2.7/site-packages/mifs-0.0.1.dev0-py2.7.egg/mifs/mifs.py", line 223, in _fit S, F = self._add_remove(S, F, bn.nanargmax(xy_MI))

ValueError: All-NaN slice encountered. My data looks like: image

Not sure what's going on, although the code examples provided was running perfectly.

kroscek avatar Sep 13 '17 09:09 kroscek

I also encountered same problem when choosing JMI option. can anyone help?

bnder321 avatar Oct 05 '17 10:10 bnder321

Can you please try the latest version of the code and report back if you still encounter the bug? Thanks!

danielhomola avatar Feb 18 '18 19:02 danielhomola

Hi, I am encountering this same bug in a newly installed version, under both Python 3.6.2 and 2.7.13 Any suggestions for how I might troubleshoot? Thanks!

vafisher avatar Apr 02 '18 21:04 vafisher

I am getting the same error under python 3.6.3 and the last version of mifs, what possibly i am doing wrong? Thanks

doomers avatar Apr 08 '18 01:04 doomers

I am also receiving the same error with the latest version of mifs, and it appears that the xy_MI matrix is being filled in with NaNs, because the MI values from the _mi_cc function are all negative. Any help to fix this would be much appreciated, thank you!

bioinfoMMS avatar May 03 '18 14:05 bioinfoMMS

^ Likewise, also working with continuous target variable.

Most likely an error with the following source gist: https://gist.github.com/GaelVaroquaux/ead9898bd3c973c40429

imranahmed96 avatar Oct 23 '18 13:10 imranahmed96

Anyone has some time to actually submit a pr for this? I don't have time to look into this..

danielhomola avatar Oct 23 '18 15:10 danielhomola

My guess is as follows:

return (d*np.mean(np.log(r + np.finfo(X.dtype).eps)) + np.log(volume_unit_ball) + psi(n) - psi(k))

If r array values are < 1 (which is likely if X is high dimensional and the inputs are sparse) then this value above could return a negative number). This may be completely wrong though...

imranahmed96 avatar Oct 23 '18 20:10 imranahmed96

I have the same problem. Can someone tell me what to do?

bhpiamnothing avatar May 29 '20 06:05 bhpiamnothing

我也有同样的问题。有人可以告诉我该怎么做吗?

Do you have solved this problem?Thanks

Icebreaker001 avatar Sep 21 '20 07:09 Icebreaker001

I use a replace method to solve this problem

vectorArray=np.concatenate(vectorList,axis=0)#your array whereNan = np.where(np.isnan(np.sum(vectorArray, axis=0)))#find where nan vectorArray[np.isnan(vectorArray)] = 0 #replace the nan vectorResult=np.nanargmax(vectorArray,axis=0).astype(np.float)#do something vectorResult[whereNan] = np.nan #replace the nan again

Jiang2019Code avatar Nov 27 '20 14:11 Jiang2019Code

Same issue, latest version of mids and sklearn, discrete (0/1) target. Input features are a mix of continous and discrete, after scaling and nan imputation. Happens when using any of the criterions ("JMI", "JMIM", MRMR)

ddofer avatar Jul 08 '21 09:07 ddofer

I think this problem come from the calculation of mutual information, which this part may original from: https://github.com/mutualinfo/mutual_info/blob/main/mutual_info/mutual_info.py replace the relative function will sovle this problem.

callmedrcom avatar Nov 12 '22 02:11 callmedrcom