Skip to content

Update GIN #87

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
21 changes: 21 additions & 0 deletions causallearn/search/HiddenCausal/GIN/FisherTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import math
from scipy.stats import chi2

def FisherTest(pvals, alpha = 0.01):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def FisherTest(pvals, alpha = 0.01):
def FisherTest(pvals, alpha=0.01):

Fisher_Stat = 0
L = len(pvals)
for i in range(0,L):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for i in range(0,L):
for i in range(0, L):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address this?

if pvals[i] == 0:
TP = 1e-05
else:
TP = pvals[i]

Fisher_Stat = Fisher_Stat - 2*math.log(TP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fisher_Stat = Fisher_Stat - 2*math.log(TP)
Fisher_Stat = Fisher_Stat - 2 * math.log(TP)


Fisher_pval = 1 - chi2.cdf(Fisher_Stat, 2*L)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fisher_pval = 1 - chi2.cdf(Fisher_Stat, 2*L)
Fisher_pval = 1 - chi2.cdf(Fisher_Stat, 2 * L)


if Fisher_pval >alpha:
return True, Fisher_pval
else:
return False, Fisher_pval
Comment on lines +17 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if Fisher_pval >alpha:
return True, Fisher_pval
else:
return False, Fisher_pval
return Fisher_pval > alpha, Fisher_pval


Loading