Skip to content

Commit 298b03e

Browse files
authored
MNT Add tags to GaussianMixture array API and precise them for PCA (scikit-learn#31784)
1 parent f462edd commit 298b03e

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

sklearn/decomposition/_pca.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,10 @@ def score(self, X, y=None):
848848
def __sklearn_tags__(self):
849849
tags = super().__sklearn_tags__()
850850
tags.transformer_tags.preserves_dtype = ["float64", "float32"]
851-
tags.array_api_support = True
851+
tags.array_api_support = (
852+
self.svd_solver in ["full", "randomized"]
853+
and self.power_iteration_normalizer == "QR"
854+
)
852855
tags.input_tags.sparse = self.svd_solver in (
853856
"auto",
854857
"arpack",

sklearn/mixture/_gaussian_mixture.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,3 +992,10 @@ def aic(self, X):
992992
The lower the better.
993993
"""
994994
return -2 * self.score(X) * X.shape[0] + 2 * self._n_parameters()
995+
996+
def __sklearn_tags__(self):
997+
tags = super().__sklearn_tags__()
998+
tags.array_api_support = (
999+
self.init_params in ["random", "random_from_data"] and not self.warm_start
1000+
)
1001+
return tags

0 commit comments

Comments
 (0)