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

Skip to content

Sequential forward selection - unsupervised fit_transform bug #19538

@PaVim96

Description

@PaVim96

Describe the bug

When trying to use Sequential Forward Selection in a unsupervised setting with no target labels y an error results when trying to follow the documentation

Example:

from sklearn.feature_selection import SequentialFeatureSelector as SFS
from sklearn.cluster import KMeans

data = np.array([[1,1,1,1,1], [2,2,2,2,2], [3,3,3,3,3], [4,4,4,4,4], [5,5,5,5,5], [6,6,6,6,6]])
model = KMeans(3)
sfs = SFS(model, n_features_to_select=3)
data = sfs.fit_transform(data)

Expected Results

data should be in new shape -> data.shape == (6,3)

Actual Results

TypeError: fit() missing 1 required positional argument: 'y'

Versions

System:
python: 3.8.3 (default, Jul 2 2020, 16:21:59) [GCC 7.3.0]
executable: /home/USERNAME/anaconda3/bin/python3
machine: Linux-5.8.0-43-generic-x86_64-with-glibc2.10

Python dependencies:
pip: 21.0.1
setuptools: 46.4.0
sklearn: 0.24.1
numpy: 1.19.2
scipy: 1.5.4
Cython: 0.29.21
pandas: 1.1.4
matplotlib: 3.3.4
joblib: 0.17.0
threadpoolctl: 2.1.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions