Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe a mistake in reliefF.py #73

Open
agnes-yang opened this issue Aug 22, 2022 · 1 comment
Open

Maybe a mistake in reliefF.py #73

agnes-yang opened this issue Aug 22, 2022 · 1 comment

Comments

@agnes-yang
Copy link

agnes-yang commented Aug 22, 2022

In https://github.com/jundongl/scikit-feature/blob/master/skfeature/function/similarity_based/reliefF.py

In the Algorithm Relief-F

image ( 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
@agnes-yang agnes-yang changed the title Maybe a mistake' Maybe a mistake in reliefF.py Aug 22, 2022
@daiguaygc
Copy link

I think you are right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants