Skip to content

Zero Shot Topic ordering #2365

Open
Open
@theobouwman

Description

@theobouwman

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Desribe the bug

I predefined the zero shot topic list, but the ordering of the topics is not the same as the list i provided:

zeroshot_topic_list = [
    'Technology & Science',
    'Arts Culture',
    'Business',
    'International',
    'Geo Politics',
    'Health & Wellness',
    'Sports',
    'Opinion & Editorial',
    'Education',
    'Environment',
]

topic_model = BERTopic(
    language='english',
    embedding_model="thenlper/gte-large",
    min_topic_size=15,
    zeroshot_topic_list=zeroshot_topic_list,
    zeroshot_min_similarity=0,
    calculate_probabilities=True,
    representation_model=KeyBERTInspired()
)
topics, props = topic_model.fit_transform(docs)
Image

Reproduction

from bertopic import BERTopic

zeroshot_topic_list = [
    'Technology & Science',
    'Arts Culture',
    'Business',
    'International',
    'Geo Politics',
    'Health & Wellness',
    'Sports',
    'Opinion & Editorial',
    'Education',
    'Environment',
]

topic_model = BERTopic(
    language='english',
    embedding_model="thenlper/gte-large",
    min_topic_size=15,
    zeroshot_topic_list=zeroshot_topic_list,
    zeroshot_min_similarity=0,
    calculate_probabilities=False,
    representation_model=KeyBERTInspired()
)
topics, props = topic_model.fit_transform(docs)

BERTopic Version

0.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions