Skip to content

TruncatedSVD.transform does not check if fitted #16806

@lorentzenchr

Description

@lorentzenchr

Describe the bug

TruncatedSVD.transform does not call check_is_fitted(self).

Steps/Code to Reproduce

numpy as np
from sklearn.decomposition import TruncatedSVD

tsvd = TruncatedSVD()
X = np.arange(6).reshape((3,2))
tsvd.transform(X)

Expected Results

NotFittedError

Actual Results

AttributeError: 'TruncatedSVD' object has no attribute 'components_'

Further Notes

Is there a reason, why TruncatedSVD.transform calls X = check_array(X, accept_sparse='csr'), i.e. converts to CSR-format?

Versions

sklearn: 0.23.dev0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions