Skip to content

Conversation

thomasjpfan
Copy link
Member

Reference Issues/PRs

Address a part of #21308

What does this implement/fix? Explain your changes.

This PR add get_feature_names_out to cross_decomposition estimators.

@thomasjpfan thomasjpfan changed the title API Adds get_feature_names_out for cross_decomposition ENH Adds get_feature_names_out for cross_decomposition Jan 3, 2022
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!

[f"{class_name_lower}{i}" for i in range(est.x_weights_.shape[1])],
dtype=object,
)
assert_array_equal(names_out, expected_names_out)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe those tests could be extended to also assert that est.transform(X[:1]).shape[1] == expected_names_out.shape[0].

Copy link
Member Author

Choose a reason for hiding this comment

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

The proposed check is in the common tests:

assert (
len(feature_names_out) == n_features_out
), f"Expected {n_features_out} feature names, got {len(feature_names_out)}"

Copy link
Member

Choose a reason for hiding this comment

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

Actually this is already tested in the common test.

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

I solved the conflicts and I will merge once the CIs are green.

@glemaitre glemaitre merged commit 6c2718b into scikit-learn:main Jan 4, 2022
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