Skip to content

Conversation

thomasjpfan
Copy link
Member

This PR updates the docstring for the output shape of AdditiveChi2Sampler.transform to what is implemented in code:

from sklearn.datasets import load_digits
from sklearn.kernel_approximation import AdditiveChi2Sampler

X, y = load_digits(return_X_y=True)
n_features = X.shape[1]

for sample_steps in range(1, 4):
    
    chi2sampler = AdditiveChi2Sampler(sample_steps=sample_steps)

    # Updated formula
    n_features_out = n_features * (2 * sample_steps - 1)
    X_transformed = chi2sampler.fit_transform(X, y)

    assert X_transformed.shape[1] == n_features_out

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM!

@glemaitre glemaitre merged commit ff85a34 into scikit-learn:main Jan 28, 2022
@glemaitre
Copy link
Member

Thanks @thomasjpfan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants