Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

train the example file error #53

Open
ghost opened this issue Jan 12, 2024 · 0 comments
Open

train the example file error #53

ghost opened this issue Jan 12, 2024 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 12, 2024

use rca.py to train example file called example.csv
In the rca.py

  import dataset 
  df = dataset.load_data('data', 'example.csv')
    engine = RCAEngine()
    engine.build_causal_graph(
        df=df,
        run_pdag2dag=True,
        max_num_points=5000000,
        verbose=True
    )
    bn = engine.train_bayesian_network(dfs=[df])
    bn.print_probabilities()

error in the engine.train_bayesian_network statement:

Traceback (most recent call last):
  File "C:/PyCharm Community Edition 2022.2.1/plugins/python-ce/helpers/pydev/pydevd.py", line 1496, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\PyCharm Community Edition 2022.2.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/1000260871/Desktop/root cause analysis/PyRCA-main/pyrca/applications/example/rca.py", line 286, in <module>
    bn = engine.train_bayesian_network(dfs=[df])
  File "C:/Users/1000260871/Desktop/root cause analysis/PyRCA-main/pyrca/applications/example/rca.py", line 152, in train_bayesian_network
    bayesian_network.train(dfs=dfs)
  File "C:\python\lib\site-packages\pyrca\analyzers\bayesian.py", line 132, in train
    self._refine_parameters(lower_bound=0.01)
  File "C:\python\lib\site-packages\pyrca\analyzers\bayesian.py", line 138, in _refine_parameters
    assert cpd.values.shape[0] == 2, f"The cardinality of the variable {cpd.variable} should be = 2."
AssertionError: The cardinality of the variable conn_pool should be = 2.

I checked the cpp.values, it is array([1.])

why it happens? I didn't change anything for example.csv file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants