[Python] Inspect all probabilities of BERTopic model

Discussão em 'Python' iniciado por Stack, Dezembro 20, 2024.

  1. Stack

    Stack Membro Participativo

    Say I build a BERTopic model using

    from bertopic import BERTopic
    topic_model = BERTopic(n_gram_range=(1, 1), nr_topics=20)
    topics, probs = topic_model.fit_transform(docs)


    Inspecting probs gives me just a single value for each item in docs.

    probs
    array([0.51914467, 0. , 0. , ..., 1. , 1. ,
    1. ])


    I would like the entire probability vector across all topics (so in this case, I want a vector of 20 probabilities for each item in docs). In other words, if I have N items in docs and K topics, I would like an NxK output.

    Continue reading...

Compartilhe esta Página