cmu-phil / py-tetrad

Makes algorithms/code in Tetrad available in Python via JPype
MIT License
59 stars 11 forks source link

AttributeError: 'NoneType' object has no attribute 'toString' #20

Closed lkpopo closed 6 months ago

lkpopo commented 7 months ago

when I run" python run_continuous.py" , there are errors:

There were no stable models.

Traceback (most recent call last): File "F:\C\Paper\因果推断\Code\py-tetrad\pytetrad\run_continuous.py", line 92, in print(search.get_string()) File "F:\C\Paper\因果推断\Code\py-tetrad\pytetrad\tools\TetradSearch.py", line 562, in get_string return lang.String @ self.java.toString() AttributeError: 'NoneType' object has no attribute 'toString'

lkpopo commented 7 months ago

image

jdramsey commented 7 months ago

Oh interesting, I hadn't noticed that. One problem is that LiNG-D here is being given linear Gaussian data as input, which is outside its assumptions, so its output should probably be ignored. Let me double check later today that if I give it linear non-gaussian data for a slmple model it comes back with an answer.

jdramsey commented 7 months ago

Actually, let me spend some time working on run_continuous.py for a bit in general.

jdramsey commented 7 months ago

OK, try doing a git pull and re-running it. LiNG-D just found no stable models for that example is all, so it returned null. So I just checked for that in the Python code:

print('ICA-LiNG-D') search.run_ica_lingd(threshold_b=0.4, threshold_spine=0) graph = search.get_java() if (graph != None): print(graph)

Thanks for pointing that out!

jdramsey commented 6 months ago

By the way, as I was pointing out to someone else, I did some more updates to the LiNG-D interface in response to further user comments:

https://github.com/cmu-phil/py-tetrad/issues/22

jdramsey commented 6 months ago

This should be fixed now. I'll close it. if you still are having problems, let me know. :)