I'm computing mutual information for several features where one of my datasets has one instance. One instance is because of a specific filtering criterion I used.
I'm using sklearn.feature_selection.mutual_info_classif¶
to calculate MI. I am getting an ValueError
due to this one instance. Anyway, I wanted to quantify this case MI. Therefore I was looking for the definition of MI and searching for ways to quantify this specific case.
Is it 0 ? - meaning just one feature value and label, no information content?
How do we quantify this specific situation? Any suggestions are appreciated.
Example:
X = array([[7., 7., 0., 0., 1., 0., 2., 1., 0.]]) #set of feature values
Y = array([2.]) #label
mi_scores = mutual_info_classif(X, Y,random_state=0)
Something like the above.
Then I'm getting
ValueError: Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required.
mutual_info_classif
is perfectly capable of returning 0, so maybe it would be best if you can provide a reproducible example. This would also clear up whether the singular feature is in the feature matrix or the target vector. $\endgroup$