Skip to content
Snippets Groups Projects
Commit d702d3d6 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

Fix unsupported numpy array as `out` parameter.

parent e72e3598
Branches
Tags
2 merge requests!42GMM implementation in Python,!40Transition to a pure python implementation
Pipeline #56614 failed
...@@ -667,14 +667,14 @@ class GMMMachine(BaseEstimator): ...@@ -667,14 +667,14 @@ class GMMMachine(BaseEstimator):
# Count of samples [int] # Count of samples [int]
statistics.t += data.shape[0] statistics.t += data.shape[0]
# Responsibilities [array of shape (n_gaussians,)] # Responsibilities [array of shape (n_gaussians,)]
statistics.n += responsibility.sum(axis=-1) statistics.n = statistics.n + responsibility.sum(axis=-1)
# p * x [array of shape (n_gaussians, n_samples, n_features)] # p * x [array of shape (n_gaussians, n_samples, n_features)]
px = np.multiply(responsibility[:, :, None], data[None, :, :]) px = np.multiply(responsibility[:, :, None], data[None, :, :])
# First order stats [array of shape (n_gaussians, n_features)] # First order stats [array of shape (n_gaussians, n_features)]
statistics.sum_px += px.sum(axis=1) statistics.sum_px = statistics.sum_px + px.sum(axis=1)
# Second order stats [array of shape (n_gaussians, n_features)] # Second order stats [array of shape (n_gaussians, n_features)]
pxx = np.multiply(px[:, :, :], data[None, :, :]) pxx = np.multiply(px[:, :, :], data[None, :, :])
statistics.sum_pxx += pxx.sum(axis=1) statistics.sum_pxx = statistics.sum_pxx + pxx.sum(axis=1)
return statistics return statistics
......
...@@ -621,7 +621,7 @@ def test_gmm_ML_2(): ...@@ -621,7 +621,7 @@ def test_gmm_ML_2():
def test_gmm_ML_parallel(): def test_gmm_ML_parallel():
"""Trains a GMMMachine with ML_GMMTrainer; compares to an old reference""" """Trains a GMMMachine with ML_GMMTrainer; compares to a reference"""
ar = da.array(load_array(resource_filename("bob.learn.em", "data/dataNormalized.hdf5"))) ar = da.array(load_array(resource_filename("bob.learn.em", "data/dataNormalized.hdf5")))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment