Code Monkey home page Code Monkey logo

labeled-lda-python's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

labeled-lda-python's Issues

Additional Question

Halo Joe, Thank you again for the coding and your last answer to my question. If you are glad, I want to ask some questions about this code.

  1. What value do you use to evaluate the model? Is that perplexity? What is the meaning of the perplexity in LLDA?
  2. What is the difference between llda.LldaModel, .training, and .inference? Which one did you use to build a model?
  3. How much delta should be input?

Error after some iterations

after iteration: 51, perplexity: 5931.100267564532
delta beta: 5.883340980101
before updating:  
Labeled-LDA Model:
	K = 61
	M = 60120
	T = 130755
	WN = 4029682
	LN = 60120
	alpha = 0.01
	eta = 0.001
	perplexity = 5931.100267564532
	
after updating:  
Labeled-LDA Model:
	K = 61
	M = 60121
	T = 130763
	WN = 4029695
	LN = 60123
	alpha = 0.01
	eta = 0.001
	perplexity = 5931.23254749438
	
iteration 52 sampling...
Traceback (most recent call last):
  File "/Users/rr/opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/rr/opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/rr/labeled_lda/mt_llda.py", line 48, in train_model
    llda_model.training(1)
  File "/Users/rr/labeled_lda/labeled_lda.py", line 440, in training
    self._gibbs_sample_training()
  File "/Users/rr/labeled_lda/labeled_lda.py", line 272, in _gibbs_sample_training
    sample_z = LldaModel._multinomial_sample(p_vector)
  File "/Users/rr/labeled_lda/labeled_lda.py", line 218, in _multinomial_sample
    return np.random.multinomial(1, p_vector).argmax()
  File "mtrand.pyx", line 3863, in numpy.random.mtrand.RandomState.multinomial
  File "common.pyx", line 323, in numpy.random.common.check_array_constraint
ValueError: pvals < 0, pvals > 1 or pvals contains NaNs

where the line 47 and line 48

File "/Users/rr/labeled_lda/mt_llda.py", line 48, in train_model
    llda_model.training(1)

creates the object of labeled lda and sends it to training:

llda_model = llda.LldaModel(labeled_documents=labeled_documents, alpha_vector=0.01)
llda_model.training(1)

question on input labelled documents

Dear,

First of all, thank you very much for your sharing a nice program.

I have a question related to the input labeled documents as follow
Each document has a following number, for example, labeled_documents = [("text" * 10, ['label_1]), ...],. In this case, what is 10 used for? How does it affect the training process? For example, if we change these values or even ignore them.

Thank you very much in advance!
Best regards,
Son.

Topic Term Matrix

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

common_topic

Hai Joe, thankyou so much for the coding. I want to ask about common topic. What is the interpretation for that? I really appreciate your answer because right now I'm doing my undergraduate thesis using this code

An error occured when I use the function load_model_from_dir

Thank you very much for sharing your code.
When I download your example.py and run it, I found an error occured when I use
'''llda_model_new.load_model_from_dir(save_model_dir, load_derivative_properties=False)'''.

And here is the traceback:
'''
Traceback (most recent call last):

File "", line 1, in
runfile('D:/putong/taxiLDA/Labeled-LDA-Python-master/example/example.py', wdir='D:/putong/taxiLDA/Labeled-LDA-Python-master/example')

File "D:\ana\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "D:\ana\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/putong/taxiLDA/Labeled-LDA-Python-master/example/example.py", line 78, in
llda_model_new.load_model_from_dir(save_model_dir, load_derivative_properties=False)

File "..\model\labeled_lda.py", line 794, in load_model_from_dir
self._initialize_derivative_fields()

File "..\model\labeled_lda.py", line 126, in _initialize_derivative_fields
self.alpha_vector_Lambda = self.alpha_vector * self.Lambda

ValueError: operands could not be broadcast together with shapes (0,) (6,6)
'''
I think something goes wrong when the program loads and reads the model.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.