Skip to content
Snippets Groups Projects
Commit efc25e19 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[algorithm] fixed bug in the log-prob computation of SKLGMM: 2D array is expected

parent 4e95fc5f
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,7 @@ class SKLGMM(Algorithm): ...@@ -45,7 +45,7 @@ class SKLGMM(Algorithm):
# The data - "positive class only" # The data - "positive class only"
pos = numpy.array(training_features[0]) pos = numpy.array(training_features[0])
features_dim = pos.shape[1] features_dim = pos.shape[1]
# train # train
self.machine.fit(pos) self.machine.fit(pos)
...@@ -68,7 +68,8 @@ class SKLGMM(Algorithm): ...@@ -68,7 +68,8 @@ class SKLGMM(Algorithm):
""" """
Compute the log-likelihood of the feature Compute the log-likelihood of the feature
""" """
# load # sklearn.mixture.GaussianMixture expects a 2d array (even with one example)
feature = numpy.expand_dims(feature, axis=0)
return self.machine.score_samples(feature) return self.machine.score_samples(feature)
def score(self, toscore): def score(self, toscore):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment