Skip to content

Commit

Permalink
fix: handle residuals array is empty. It means that the least squares…
Browse files Browse the repository at this point in the history
… problem does not have a unique solution or has no degrees of freedom left to compute residuals.

Signed-off-by: Endre Moen <[email protected]>
  • Loading branch information
emoen committed Jan 2, 2025
1 parent 5105a3e commit 2a072b5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions causallearn/search/ScoreBased/ExactSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ def bic_score_node(X, i, structure):
b=X[:, i],
rcond=None)
bic = n * np.log(residual / n) + len(structure) * np.log(n)
if bic.size == 0:
return NEGINF # Return negative infinity if bic is empty
return bic.item()


Expand Down

0 comments on commit 2a072b5

Please sign in to comment.