Skip to content

Commit 55342be

Browse files
committed
now raise error when covariance type other than diag is passed to GMM (instead of warning and mutating like currently done)
1 parent c1263dd commit 55342be

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

pyvisim/clustering/gmm.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Gaussian Mixture Model used by the Fisher Vector encoder."""
22

3-
import warnings
43
from typing import Any
54

65
import numpy as np
@@ -40,12 +39,10 @@ def __init__(self, n_components: int = 256, **gmm_params: Any) -> None:
4039

4140
def _validate_sklearn_model(self) -> None:
4241
if self._model.covariance_type != "diag":
43-
warnings.warn(
44-
"Attribute 'covariance_type' of the underlying GaussianMixture is "
45-
"set to 'diag' because training will take too long otherwise.",
46-
stacklevel=2,
42+
raise ValueError(
43+
f"{type(self).__name__} only supports covariance_type='diag', "
44+
f"got {self._model.covariance_type!r}."
4745
)
48-
self._model.covariance_type = "diag"
4946

5047
@property
5148
def n_clusters(self) -> int:

0 commit comments

Comments
 (0)