rfeinman / GNS-Modeling

Generative Neuro-Symbolic (GNS) Modeling (Feinman & Lake, 2021)
26 stars 10 forks source link

Unable to run experiments due to MATLAB code with error "matlab.engine.MatlabExecutionError: Undefined function 'generate_random_parses_RF' for input arguments of type 'int64'." #2

Closed bofei5675 closed 1 year ago

bofei5675 commented 1 year ago

Thanks for this amazing work.

I tried to run the classification experiment. I firstly followed BPL repo and download the raw MATLAB code. I was able to reproduce figure and experient by that code. Then, I download code from this repo and pyBPL. Alfter following README, I tried to run the code without slurm cluster.

For example I did something like

from get_base_parses import get_base_parses
from pybpl.matlab.bottomup.generate_random_parses import eng

def main():
    print(eng)
    parser = get_base_parses(1, reverse=False)

if __name__ == '__main__':
    main()

I found the engine was created successfully and the code failed at

 S_walks = eng.generate_random_parses_RF(I, seed, max_ntrials, max_nwalk, max_nstroke, nwalk_det)

with warning and errors like:

Unrecognized function or variable 'generate_random_parses_RF'.
Traceback (most recent call last):
...
matlab.engine.MatlabExecutionError: Undefined function 'generate_random_parses_RF' for input arguments of type 'int64'..

I did some effort to play with the environment variable BPL_PATH:

# raw BPL Path
export BPL_PATH=~/Project/MATLAB/BPL
# raw BPL with bottomup subfolder
export BPL_PATH=~/Project/MATLAB/BPL/bottomup

None of them works. I'm using trial version of MATLAB R2023a. Please kindly advise how I fix this.