MaartenGr / MaartenGr/Concept

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

Open
#19 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
230
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Trying to run this code on Google Colab and seeing this error now. Simply just trying to use the demo provided in this repo, but now it's throwing the following error:

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[](https://localhost:8080/#) in
3 # Fit the Concept model to the images and vocabulary
4 concept_model = ConceptModel()
----> 5 concepts = concept_model.fit_transform(img_names, docs=selected_nouns)
6
7 # Get the predicted probabilities for each concept cluster for each image

1 frames
[/usr/local/lib/python3.9/dist-packages/concept/_model.py](https://localhost:8080/#) in _extract_textual_representation(self, docs)
400 # Extract vocabulary from the documents
401 self.vectorizer_model.fit(docs)
--> 402 words = self.vectorizer_model.get_feature_names()
403
404 # Embed the documents and extract similarity between concept clusters and words

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the _extract_textual_representation method shown at line 402 of concept/_model.py, where the demo fails while fitting CountVectorizer. Check the current scikit-learn CountVectorizer API and run the repository's demo in Google Colab; done means the demo completes without this AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, scikit-learn
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.