Skip to content

Commit d486643

Browse files
authored
Fix implementation of BDeu score
Fix calculation of vm to use the number of columns (number of variables) instead of rows (number of samples). Signed-off-by: Zhou Jiayang <[email protected]>
1 parent b4f064f commit d486643

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

causallearn/score/LocalScoreFunction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def local_score_BDeu(Data: ndarray, i: int, PAi: List[int], parameters=None) ->
148148

149149
BDeu_score = 0
150150
# first term
151-
vm = Data.shape[0] - 1
151+
vm = Data.shape[1] - 1
152152
BDeu_score += len(PAi) * np.log(structure_prior / vm) + (vm - len(PAi)) * np.log(
153153
1 - (structure_prior / vm)
154154
)

0 commit comments

Comments
 (0)