MaartenGr / MaartenGr/BERTopic

`seed_topic_list` throwing error related to inhomogeneous shape after 1 dimensions

Open
#1,814 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

I am using the following code to use `seed_topic_list`

```{python}
embedding_model = 'all-mpnet-base-v2'
word_list = ["Bullion",'market','price','commodity',"precious", "metal",'gilt','carat','aurum','world', 'gold', 'council','mine','mining','bitcoin','forecast','bank','liquidity','ingot','stocks','delivery','settlement','ETF']
word_lists = [[word.lower()] for word in word_list]

model = BERTopic(
verbose=True,
min_topic_size=5,
language="english",
seed_topic_list = word_list,
embedding_model = SentenceTransformer(embedding_model)
)
topics, probs = model.fit_transform(df['news_article'])
```
I am getting the following error!

![Screenshot from 2024-02-16 17-19-37](https://github.com/MaartenGr/BERTopic/assets/78504100/3f616cf3-f790-4718-9aaa-4162426c5c54)

Can somebody tell me, what is the correct way to use `seed_topic_list`?

Contributor guide

Open the contributing guide

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 at the BERTopic constructor's seed_topic_list argument and the subsequent fit_transform call, comparing the supplied word_list with the expected input shape. Use the traceback shown in the issue to identify the failing operation, then verify that the corrected input allows fit_transform to complete successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
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.