Open agnes-yang opened 2 years ago
In https://github.com/jundongl/scikit-feature/blob/master/skfeature/function/similarity_based/reliefF.py
In the Algorithm Relief-F
( This figure is from https://link.springer.com/article/10.1023/A:1025667309714 )
The equation P(C)/(1-P(Class(Ri))) is in the in the numerator
The variable corresponding to this equation in the code is p_dict as below
p_dict = dict() p_label_idx = float(len(y[y == y[idx]]))/float(n_samples) for label in c: p_label_c = float(len(y[y == label]))/float(n_samples) p_dict[label] = p_label_c/(1-p_label_idx) near_miss[label] = []
So in the code of calculate weight, p_dict should be in the numerator and not the denominator.
The code of
score += near_miss_term[label]/(k*p_dict[label])
should be
score += (near_miss_term[label] * p_dict[label]) / k
I think you are right
In https://github.com/jundongl/scikit-feature/blob/master/skfeature/function/similarity_based/reliefF.py
In the Algorithm Relief-F
( This figure is from https://link.springer.com/article/10.1023/A:1025667309714 )
The equation P(C)/(1-P(Class(Ri))) is in the in the numerator
The variable corresponding to this equation in the code is p_dict as below
So in the code of calculate weight, p_dict should be in the numerator and not the denominator.
The code of
should be