cmu-phil / py-tetrad

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

Problem launching py-tetrad #15

Closed KarinaKarina6 closed 7 months ago

KarinaKarina6 commented 7 months ago

Hello! I'm programming in Python and want to use py-tetrad to work with Tetrad. According to the README:

  1. I installed the Amazon Corretto JDK
    openjdk version "17.0.9" 2023-10-17 LTS
    OpenJDK Runtime Environment Corretto-17.0.9.8.1 (build 17.0.9+8-LTS)
    OpenJDK 64-Bit Server VM Corretto-17.0.9.8.1 (build 17.0.9+8-LTS, mixed mode, sharing)
  2. I checked echo %JAVA_HOME% C:\Program Files\Amazon Corretto\jdk17.0.9_8
  3. I have Python 3.9 installed
  4. I installed JPype1==1.4.1

After that I tried to run the code in the terminal: python run_discrete.py

And I got the following result:

C:\Users\KShakhyan\OneDrive - ITMO UNIVERSITY\Projects\Tetrad_py_tetrad\py-tetrad\pytetrad>python run_discrete.py
FGES
Traceback (most recent call last):
  File "Fges.java", line 104, in edu.cmu.tetrad.algcomparison.algorithm.oracle.cpdag.Fges.search
Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\KShakhyan\OneDrive - ITMO UNIVERSITY\Projects\Tetrad_py_tetrad\py-tetrad\pytetrad\run_discrete.py", line 27, in <module>
    search.run_fges()
  File "C:\Users\KShakhyan\OneDrive - ITMO UNIVERSITY\Projects\Tetrad_py_tetrad\py-tetrad\pytetrad\tools\TetradSearch.py", line 179, in run_fges
    self.java = alg.search(self.data, self.params)
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Not a continuous data set.

Please tell me what the problem is, what am I doing wrong?

jdramsey commented 7 months ago

Oh did I mess something up? Let me go and run the examples and see if they fail for me now. If so I'll fix them right away.

KarinaKarina6 commented 7 months ago

Well thank you I will wait! There was also a problem with running file "run_continuous.py", but I commented out the lines:

# print('BOSS')
# search.run_boss(num_starts=1, use_bes=True, time_lag=0, use_data_order=True)
# print(search.get_string())
# dag=search.get_dag_java()
# print(dag)

# search.run_boss()
# adj = search.get_graph_to_matrix()

# print(adj)

And the errors stopped.

jdramsey commented 7 months ago

Fixed. The problem was I tried to calculate BIC for a model using a continuous method without first checking to make sure the dataset was continuous! Newbie mistake!

OK, if you do a git pull at the project directory, you will get the changes. There's a change to the tetrad-current.jar that you need to grab.

Sorry about that! Everything's working for me now so I'll be curious if it's all working for you as well.

jdramsey commented 7 months ago

@KarinaKarina6 Were the problems solved for you?

KarinaKarina6 commented 7 months ago

Yes, everything works now, thank you very much! I will be glad to continue studying your package :)