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

Is it possible to get the model scores? #86

Closed
amber0309 opened this issue Aug 6, 2019 · 3 comments
Closed

Is it possible to get the model scores? #86

amber0309 opened this issue Aug 6, 2019 · 3 comments

Comments

@amber0309
Copy link

amber0309 commented Aug 6, 2019

It is displayed in the printed info but I was wondering how I could get it from the tetradrunner() object?

I am running continuous fGES with 'sem-bic-score'. Thanks in advance!

@chirayukong
Copy link
Collaborator

It is possible. I'll come back with the solution.

@chirayukong
Copy link
Collaborator

You should get scores for the whole graph and each of its nodes by the following code:

import pandas as pd
from pycausal import search as s

data_dir = "https://raw.githubusercontent.com/bd2kccd/py-causal/master/data/charity.txt"
df = pd.read_table(data_dir, sep="\t")

tetrad = s.tetradrunner()
tetrad.run(algoId = 'fges', dfs = df, maxDegree = -1, faithfulnessAssumed = True, verbose = True)

graph = tetrad.getTetradGraph()
print('Graph BIC: {}'.format(graph.getAttribute('BIC')))

nodes = graph.getNodes()
for i in range(nodes.size()):
    node = nodes.get(i)
    print('Node {} BIC: {}'.format(node.getName(),node.getAttribute('BIC')))

@amber0309
Copy link
Author

Thanks for your prompt reply!

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