Skip to content

Commit 2a072b5

Browse files
committed
fix: handle residuals array is empty. It means that the least squares problem does not have a unique solution or has no degrees of freedom left to compute residuals.
Signed-off-by: Endre Moen <[email protected]>
1 parent 5105a3e commit 2a072b5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

causallearn/search/ScoreBased/ExactSearch.py

+2
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)