Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix feature_names_in_ attribute for knn_transformer in exercise 4 #110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

OrtizNicola
Copy link

Originally, self.feature_names_in_ was assigned to have the same value as self.estimator.feature_names_in_ but I think this is incorrect because self.estimator is not yet fitted. The fitted estimator is self.estimator_, so self_feature_names_in_ should be equal to self.estimator_.feature_names_in_. (Note the added _)

Attempting to access knn_transformer.feature_names_in_ with the original code, would result in an error stating that the attribute doesn't exist, but with this small change it outputs ['latitude', 'longitude'], which is the excpected output

Originally, self.feature_names_in_ was assigned to have the same value
as self.estimator.feature_names_in_ but I think this is incorrect
because self.estimator is not yet fitted. The fitted estimator is
self.estimator_, so self_feature_names_in_ should be equal to
self.estimator_.feature_names_in_. (Note the added _)

Attempting to access knn_transformer.feature_names_in_ with the
original code, would result in an error stating that the attribute
doesn't exist, but with my change it outputs ['latitude', 'longitude'],
which is the excpected output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant