Skip to content

Python extension #26

@lucianolorenti

Description

@lucianolorenti

In case is anyone interested. I've made a python extension out of this code. It is more or less the same code, except it is wrapped with python-boost. And it avoids all the intermediate files.
You can use it something like this:

import btm
number_of_topics = 2
alpha = 50/2
beta = 0.0005
n_iters = 50000
btm_model = btm.Model(number_of_topics, alpha, beta, n_iters, 3, True)
btm_model.fit(["sentence 1", "sentence 2", "sentence 2"])
pz = btm_model.get_pz()
pw_z = btm_model.get_pw_z( )
vocabulary = btm_model.vocabulary()
b = btm_model.predict(["ANother sentence"], "sum_b")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions