embedded-topic-model icon indicating copy to clipboard operation
embedded-topic-model copied to clipboard

How could I get the topic embeddings?

Open broboboo opened this issue 1 year ago • 3 comments

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

broboboo avatar Nov 16 '23 11:11 broboboo

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 :)

lfmatosm avatar Nov 25 '23 21:11 lfmatosm

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!

broboboo avatar Dec 17 '23 02:12 broboboo

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

lfmatosm avatar Apr 20 '24 22:04 lfmatosm