MaartenGr / MaartenGr/BERTopic

AttributeError: 'BERTopic' object has no attribute 'c_tf_idf'

Open
#1,926 3 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'm following the steps in this Issue to test how the meta data influence the prevalence/content of topics

https://github.com/MaartenGr/BERTopic/issues/360

But I get AttributeError: 'BERTopic' object has no attribute 'c_tf_idf' when running

ests = estimate_effect(topic_model=topic_model,
topics=[-1, 0],
metadata=metadata,
docs=enr_df_docs,
probs=probs,
estimator="content ~ score",
y="content")
print([est.summary() for est in ests])

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 with the linked issue 360 and the shown estimate_effect call, then inspect how the BERTopic object is created before that call. Reproduce the AttributeError and trace why c_tf_idf is unavailable; done means the metadata prevalence/content example runs without this error.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.