Skip to content

Commit b07c316

Browse files
authored
Merge pull request #211 from emoen/fix/exact_search_bic_is_float
fix: handle residuals array is empty
2 parents 8c72b52 + 2ecc5d3 commit b07c316

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

causallearn/search/ScoreBased/ExactSearch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,8 @@ def bic_score_node(X, i, structure):
365365
b=X[:, i],
366366
rcond=None)
367367
bic = n * np.log(residual / n) + len(structure) * np.log(n)
368+
if bic.size == 0:
369+
return NEGINF # Return negative infinity if bic is empty
368370
return bic.item()
369371

370372

0 commit comments

Comments
 (0)