bd2kccd / py-causal

Other
204 stars 50 forks source link

Issue when running the given examples by my own data #98

Open chengweiclarence opened 3 years ago

chengweiclarence commented 3 years ago

Hi! When running "Calling Directly Py-Causal TsGFCI Continuous Example.ipynb", an error has occurred:

JavaException                             Traceback (most recent call last)
<ipython-input-19-98e1ee2644e7> in <module>
----> 1 tetradGraph = tsgfci.search()
      2 tetradGraph

c:\users\sx-liang\appdata\local\programs\python\python37\lib\site-packages\javabridge\wrappers.py in <lambda>(*args)
     67             if name not in methods:
     68                 methods[name] = []
---> 69                 fn = lambda naame=name: lambda *args: self.__call(naame, *args)
     70                 fn = fn()
     71                 fn.__doc__ = J.to_string(jmethod)

c:\users\sx-liang\appdata\local\programs\python\python37\lib\site-packages\javabridge\wrappers.py in __call(self, method_name, *args)
    153             rsig = sig(rtype)
    154             msig = "(%s)%s" % (args_sig, rsig)
--> 155             result =  J.call(self.o, method_name, msig, *cargs)
    156             if isinstance(result, J.JB_Object):
    157                 result = JWrapper(result)

c:\users\sx-liang\appdata\local\programs\python\python37\lib\site-packages\javabridge\jutil.py in call(o, method_name, sig, *args)
    890     ret_sig = sig[sig.find(')')+1:]
    891     nice_args = get_nice_args(args, args_sig)
--> 892     result = fn(*nice_args)
    893     x = env.exception_occurred()
    894     if x is not None:

c:\users\sx-liang\appdata\local\programs\python\python37\lib\site-packages\javabridge\jutil.py in fn(*args)
    857             x = env.exception_occurred()
    858             if x is not None:
--> 859                 raise JavaException(x)
    860             return result
    861     else:

JavaException: Index -1 out of bounds for length 0

My data is attached, and these data could be run in KCI test.

Could you help me fix it? Thanks in advance!

Regression_uniform1_X.txt

jdramsey commented 3 years ago

Sorry, PyCausal is not my code, but just to be clear on the problem. you have four columns in your data and you're running TsGFCI--what are the time steps? If I just take the data you have an in the interface run KCI I get an answer. Of course GFCI requires both a test and a score--I assume you're using KCI for the test, but what are you using for the score? For the "TS" part you need to have a time series--you could convert you data to a time series; I don't know if it automatically does this for you. You'd have to get some other input on that. In the interface, I can convert your non-time-lag data to time lag data and run TSFCI instead of TSGFCI with the KCI test (not specifying a score that is) and I get an answer.

Is any of this helping?

chengweiclarence commented 3 years ago

Sorry, PyCausal is not my code, but just to be clear on the problem. you have four columns in your data and you're running TsGFCI--what are the time steps? If I just take the data you have an in the interface run KCI I get an answer. Of course GFCI requires both a test and a score--I assume you're using KCI for the test, but what are you using for the score? For the "TS" part you need to have a time series--you could convert you data to a time series; I don't know if it automatically does this for you. You'd have to get some other input on that. In the interface, I can convert your non-time-lag data to time lag data and run TSFCI instead of TSGFCI with the KCI test (not specifying a score that is) and I get an answer.

Is any of this helping?

Hi! I use IndTestFisherZ for the test, and SemBicScore for the score, which are all the same as the given example. The example program could be run with the official data "charity.txt", but not work with my own data.

jdramsey commented 3 years ago

Sad. OK, if no one else chime in I'll make a go of it, though I'm rather busy these few days with paper reviewing and such. Like I said, the only part that's my code is the algorithm, which seems to be working, not the pycausal part, but I'll give it a shot.

jdramsey commented 3 years ago

Could you send your pycausal command? That might help.

chengweiclarence commented 3 years ago

Sad. OK, if no one else chime in I'll make a go of it, though I'm rather busy these few days with paper reviewing and such. Like I said, the only part that's my code is the algorithm, which seems to be working, not the pycausal part, but I'll give it a shot.

Could you send your pycausal command? That might help.

I see. Thanks for taking time out of your busy schedule. Take your time.

The command is attached.

Calling Directly Py-Causal TsGFCI Continuous Example-realdata.zip