MaartenGr / MaartenGr/BERTopic
ValueError: setting an array element with a sequence. Trying guided topic modelling.
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
Get the following error:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
When running the following code (copied straight from docs):
from sklearn.datasets import fetch_20newsgroups
docs = fetch_20newsgroups(
subset="all", remove=("headers", "footers", "quotes")
)["data"]
seed_topic_list = [
["drug", "cancer", "drugs", "doctor"],
["windows", "drive", "dos", "file"],
["space", "launch", "orbit", "lunar"],
]
topic_model = BERTopic(seed_topic_list=seed_topic_list)
topics, probs = topic_model.fit_transform(docs)
python 3.11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the documented Python example with BERTopic and the provided seed_topic_list to reproduce the ValueError. Trace the guided topic modelling path used by fit_transform; done means the example runs successfully without the inhomogeneous-shape error and produces topics and probabilities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100