JoeZJH / Labeled-LDA-Python

Implement of L-LDA Model(Labeled Latent Dirichlet Allocation Model) with python
MIT License
121 stars 31 forks source link

Topic Term Matrix #9

Open nabilariefm-hi opened 2 years ago

nabilariefm-hi commented 2 years ago

image Also I want to ask how did you know the order of the topic and term from this topic term matrix? (which one is the label 1,2,3 and words order) Thankyouuu

JoeZJH commented 2 years ago

You can output them in order with the following code: the topic list: print llda_model.topics the term(word) list: print llda_model.terms

nabilariefm-hi commented 2 years ago

aaa i see2 thankyouu again!!

nabilariefm-hi commented 2 years ago

Halo Joe, I really confused with the result, why the beta (topic-word) result same number (probability) for every label (my label is rating 1,2,3,4,5). Do you know why? Should I increase the iteration number? Really appreciate your answer because this is for my undergraduate thesis. Thankyouu fyi : differensial is (5+4) - (1+2) [image: messageImage_1660958430922.jpg]

Nabila Arief Muharomah Undergraduate Student of Engineering Management Bandung Institute of Technology Indonesia

On Sun, Aug 14, 2022 at 6:27 PM Jiahong @.***> wrote:

You can output them in order with the following code: the topic list: print llda_model.topics the term(word) list: print llda_model.terms

— Reply to this email directly, view it on GitHub https://github.com/JoeZJH/Labeled-LDA-Python/issues/9#issuecomment-1214345592, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2JQHIMLSWU6DBUSJUP634DVZDJZTANCNFSM56PU7YEA . You are receiving this because you authored the thread.Message ID: @.***>

nabilariefm-hi commented 2 years ago

Halo Joe, I really confused with the result, why the beta (topic-word) result same number (probability) for every label (my label is rating 1,2,3,4,5). Do you know why? Should I increase the iteration number? Really appreciate your answer because this is for my undergraduate thesis. Thankyouu fyi : differensial is (5+4) - (1+2) messageImage_1660958430922

JoeZJH commented 2 years ago

How many iterations did you use? may be you can try more iterations.

nabilariefm-hi commented 2 years ago

I use 1000 iteration

JoeZJH commented 2 years ago

Probably because you have too little data.

nabilariefm-hi commented 2 years ago

aaah i see2 maybe thats the reason. Also I want to ask which one better I use to train a model? the (1) or (2)?

Training

(1) --> #llda_model.training(iteration=100, log=True) (2) --> #while True: print("iteration %s sampling..." % (llda_model.iteration + 1)) llda_model.training(1) print("after iteration: %s, perplexity: %s" % (llda_model.iteration, llda_model.perplexity())) print("delta beta: %s" % llda_model.delta_beta) if llda_model.is_convergent(method="beta", delta=0.01): break

JoeZJH commented 2 years ago

Both of them will be ok. If you do not know how many iterations it takes for the model to converge, you can use (2) to get a convergent model.

nabilariefm-hi commented 2 years ago

Aaaah I see2 , okee Joe thankyouu so much for all the answer😊

JoeZJH commented 2 years ago

Happy to help!