mljar / mljar-supervised

Python package for AutoML on Tabular Data with Feature Engineering, Hyper-Parameters Tuning, Explanations and Automatic Documentation
https://mljar.com
MIT License
2.98k stars 394 forks source link

'TfidfVectorizer' object has no attribute 'get_feature_names_out' #494

Open leahmcguire opened 2 years ago

leahmcguire commented 2 years ago

'TfidfVectorizer' object has no attribute 'get_feature_names_out' Traceback (most recent call last): File "/Users/lmcguire/.pyenv/versions/3.8.11/envs/machine-learning/lib/python3.8/site-packages/supervised/base_automl.py", line 1084, in _fit trained = self.train_model(params) File "/Users/lmcguire/.pyenv/versions/3.8.11/envs/machine-learning/lib/python3.8/site-packages/supervised/base_automl.py", line 371, in train_model mf.train(results_path, model_subpath) File "/Users/lmcguire/.pyenv/versions/3.8.11/envs/machine-learning/lib/python3.8/site-packages/supervised/model_framework.py", line 184, in train X_train, y_train, sample_weight = self.preprocessings[ File "/Users/lmcguire/.pyenv/versions/3.8.11/envs/machine-learning/lib/python3.8/site-packages/supervised/preprocessing/preprocessing.py", line 165, in fit_and_transform t.fit(X_train, col) File "/Users/lmcguire/.pyenv/versions/3.8.11/envs/machine-learning/lib/python3.8/site-packages/supervised/preprocessing/text_transformer.py", line 27, in fit for f in list(self._vectorizer.get_feature_names_out()): AttributeError: 'TfidfVectorizer' object has no attribute 'get_feature_names_out'

pplonski commented 2 years ago

Thank you for reporting. Could you please provide minimal example to reproduce the issue?

leahmcguire commented 2 years ago

I cannot share the data that produced this error - however I suspect that any set of features that triggers the use of the TfidfVectorizer will produce this error.

pplonski commented 2 years ago

@leahmcguire what version of sklearn are you using? Can you try to upgrade sklearn version:

pip install -U scikit-learn
jkozuchowska commented 2 years ago

Hi, I've encountered the same problem while trying to run the Titanic example (using the data provided in tests/data/Titanic directory and code given in examples/notebooks/Titanic.ipynb). I'm using sklearn version 0.24.2.

pplonski commented 2 years ago

@jkozuchowska can you upgrade the sklearn? with pip install -U scikit-learn

pplonski commented 2 years ago

@MaciekEO we should update the scikit-learn minimum version in requirements.txt.

sayalijadhao19 commented 3 months ago

@leahmcguire what version of sklearn are you using? Can you try to upgrade sklearn version:

pip install -U scikit-learn

THIS WORKS!