question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error in convert_graph_int_to_adj_mat

See original GitHub issue

Hello,

I am trying to use Causal Disocvery RL on bnlearn benchmarks. I encounter the error in convert_graph_int_to_adj_mat function.

The input to this function is

[-1903318164   235405414   101482606   495790951   201853294   378349935
 -1634426101 -1718146065   134742090          64   134742086   134742084
   446475107   470616428 -1785775892 -1768316434   201884524   134217728
   201949548 -1903613075   470286702   101187694 -1734505621   503843118
 -2070074547   134217838   513518542   503875886   235405386   445754223
           0      524358   236432367   134742086   134217792   134217792
   503908622]

And the error message follows:

Traceback (most recent call last):
  File "main.py", line 337, in <module>
    main()
  File "main.py", line 285, in main
    graph_batch = convert_graph_int_to_adj_mat(graph_int)
  File "/home/user/Causal_Discovery_RL/src/helpers/analyze_utils.py", line 156, in convert_graph_int_to_adj_mat
    for curr_int in graph_int], dtype=int)
  File "/home/user/Causal_Discovery_RL/src/helpers/analyze_utils.py", line 156, in <listcomp>
    for curr_int in graph_int], dtype=int)
ValueError: invalid literal for int() with base 10: '-'

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
pckennethmacommented, Jan 19, 2022

the issue is fixed by changing np.int32 to int in several places of the codebase. the error is due to the overflow of int32.

0reactions
zhushyucommented, Feb 27, 2022

It turns out that changing the precision cannot deal with the issue when the node size is higher than 64.

Traceback (most recent call last):
  File "main.py", line 344, in <module>
    main()
  File "main.py", line 280, in main
    graph_int, score_min, cyc_min = np.array(ls_kv[0][0], dtype=np.longlong), ls_kv[0][1][1], ls_kv[0][1][-1]
OverflowError: int too big to convert

Sorry for a late reply. A quick fix is to use string, instead of int type, as key. E.g., 000111 is converted to ‘000111‘. We have change this part in internal codes but seemed not to update the github …

Again, sorry for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found