githubpsyche / pcitpy

The Probabilistic Curve Induction and Testing (P-CIT) toolbox, implemented in Python.
https://githubpsyche.github.io/pcitpy/
Apache License 2.0
0 stars 0 forks source link

`family_of_curves.compute_likelihood` bug #34

Closed githubpsyche closed 4 years ago

githubpsyche commented 4 years ago
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2020.1.3\plugins\python\helpers\pydev\pydevd.py", line 1438, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2020.1.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/gunnj/PCITpy/pcitpy/importance_sampler.py", line 369, in <module>
    test_importance_sampler()
  File "C:/Users/gunnj/PCITpy/pcitpy/importance_sampler.py", line 262, in test_importance_sampler
    importance_sampler(python_data, python_analysis_settings)
  File "C:/Users/gunnj/PCITpy/pcitpy/importance_sampler.py", line 113, in importance_sampler
    ana_opt['distribution'], ana_opt['dist_specific_params'], ana_opt['data_matrix_columns'])
  File "C:\Users\gunnj\PCITpy\pcitpy\family_of_curves.py", line 25, in family_of_curves
    return horz_indpnt_curve(get_info, varargin)
  File "C:\Users\gunnj\PCITpy\pcitpy\family_of_curves.py", line 95, in horz_indpnt_curve
    ix3 = data[cluster_idx[j], predictor_var_column] > x2
ValueError: operands could not be broadcast together with shapes (0,) (50000,) 

From executing importance_sampler.

githubpsyche commented 4 years ago

My test code for compute_likelihood relies on a data file that doesn't exist yet. I suppose I can easily generate it, though? Just run the matlab version up to the first call in matlab's importance_sampler and then bail?

githubpsyche commented 4 years ago

The trouble was that np.where (as well as np.nonzero, a close relative) returns a tuple instead of a vector or array; I have to pull the vector out of that tuple for my code to work.