lfmatosm / embedded-topic-model

A package to run embedded topic modelling with ETM. Adapted from the original at: https://github.com/adjidieng/ETM
MIT License
85 stars 8 forks source link

How could I get the topic embeddings? #28

Open broboboo opened 10 months ago

broboboo commented 10 months ago

Hello! How could I get the topic embeddings, which is mentioned as alpha in the ETM original paper? Thanks and waiting for your response!

lfmatosm commented 9 months ago

Hi @broboboo, how are you? Thanks for your question. Currently, there's no method to retrieve the topic embeddings. They are initially defined here: https://github.com/lfmatosm/embedded-topic-model/blob/71996073d584ec38070dbd62095a021f80bcdb19/embedded_topic_model/models/model.py#L44 I'm currently on a deadline in other projects, but as soon as I can, I will update the package to address this shortcoming. I'm also open for pull requests, so feel free if its your cup of tea :)

broboboo commented 9 months ago

Thanks for your answer! I found i can get the topic embeddings by this: topic_embeddings = etm_instance.model.alphas.weight.detach().cpu().numpy() Is this correct? Thank you!

lfmatosm commented 4 months ago

@broboboo yes, that's correct. Sorry for the delay.