Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/modules/array_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ Estimators and other tools in scikit-learn that support Array API compatible inp
Estimators
----------

- :class:`decomposition.PCA` (with `svd_solver="full"`,
`svd_solver="randomized"` and `power_iteration_normalizer="QR"`)
- :class:`decomposition.PCA` (with `svd_solver="full"`, `svd_solver="covariance_eigh"`, or
`svd_solver="randomized"` (`svd_solver="randomized"` only if `power_iteration_normalizer="QR"`))
- :class:`linear_model.Ridge` (with `solver="svd"`)
- :class:`discriminant_analysis.LinearDiscriminantAnalysis` (with `solver="svd"`)
- :class:`preprocessing.Binarizer`
Expand Down
6 changes: 3 additions & 3 deletions sklearn/decomposition/_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,9 +840,9 @@ def score(self, X, y=None):
def __sklearn_tags__(self):
tags = super().__sklearn_tags__()
tags.transformer_tags.preserves_dtype = ["float64", "float32"]
tags.array_api_support = (
self.svd_solver in ["full", "randomized"]
and self.power_iteration_normalizer == "QR"
solver = getattr(self, "_fit_svd_solver", self.svd_solver)
tags.array_api_support = solver not in ["arpack", "randomized"] or (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

I would keep a whitelist here because for now array API is available in a few cases. It also makes it easier to check that the documentation and the code match.

If the documentation is correct I would expect something like this?

tags.array_api_support = solver in ["full", "covariance_eigh"] or (solver == "randomized" and self.power_iteration_normalizer == "QR")

solver == "randomized" and self.power_iteration_normalizer == "QR"
)
tags.input_tags.sparse = self.svd_solver in (
"auto",
Expand Down
Loading