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

AttributeError: 'PolynomialFeatures' object has no attribute 'get_feature_names' #33

Open
karynaur opened this issue Dec 28, 2024 · 0 comments

Comments

@karynaur
Copy link

Description

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[5], [line 1]
----> [1] metamodel = symbolic_metamodel(model, X_train)
      [3] metamodel.fit(num_iter=10, batch_size=X_train.shape[0], learning_rate=.01)

File ~/projects/BERTerpret/symbolic_metamodeling/pysymbolic/algorithms/symbolic_metamodeling.py:154, in symbolic_metamodel.__init__(self, model, X, mode)
    [152] self.X                = X
    [153] self.X_new            = self.feature_expander.fit_transform(X) 
--> [154] self.X_names          = self.feature_expander.get_feature_names()
    [156] if mode == "classification": 
    [158]     self.Y                = model.predict_proba(self.X)[:, 1]

AttributeError: 'PolynomialFeatures' object has no attribute 'get_feature_names'

How to Reproduce

  1. Go to this notebook
  2. Run all cells up until cell no. 5
  3. The error will appear at metamodel = symbolic_metamodel(model, X_train)

Reason

The class PolynomialFeatures does not contain the function get_feature_names, it has been renamed to get_feature_names_out in scikit-learn==1.6.1

System Information

  • OS: Ubuntu
  • OS Version: Ubuntu 24.04.1 LTS
  • Language Version: Python 3.12.3
  • Package Manager Version: pip 24.0
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

No branches or pull requests

1 participant