@@ -49,9 +49,9 @@ def _likelihoods(cls, real_data, synthetic_data, metadata=None, structure=None):
49
49
probabilities = []
50
50
for _ , row in synthetic_data [fields ].iterrows ():
51
51
try :
52
- probabilities .append (bn .probability ([row .to_numpy ()]))
52
+ probabilities .append (torch . tensor ( bn .probability ([row .to_numpy ()]) ))
53
53
except ValueError :
54
- probabilities .append (0 )
54
+ probabilities .append (torch . tensor ( 0 ) )
55
55
56
56
return np .asarray (probabilities )
57
57
@@ -125,7 +125,7 @@ def compute(cls, real_data, synthetic_data, metadata=None, structure=None):
125
125
float:
126
126
Mean of the probabilities returned by the Bayesian Network.
127
127
"""
128
- return np .mean (cls ._likelihoods (real_data , synthetic_data , metadata , structure ))
128
+ return np .mean (cls ._likelihoods (real_data , synthetic_data , metadata , structure )). item ()
129
129
130
130
131
131
class BNLogLikelihood (BNLikelihoodBase ):
@@ -199,7 +199,7 @@ def compute(cls, real_data, synthetic_data, metadata=None, structure=None):
199
199
"""
200
200
likelihoods = cls ._likelihoods (real_data , synthetic_data , metadata , structure )
201
201
likelihoods [np .where (likelihoods == 0 )] = 1e-8
202
- return np .mean (np .log (likelihoods ))
202
+ return np .mean (np .log (likelihoods )). item ()
203
203
204
204
@classmethod
205
205
def normalize (cls , raw_score ):
0 commit comments