JoeZJH / Labeled-LDA-Python

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

An error occured when I use the function load_model_from_dir #2

Open JeromePau opened 4 years ago

JeromePau commented 4 years ago

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.

JoeZJH commented 4 years ago

Sorry, I am busy these days

I have read your question, I think the problem is your model has not been written completely, or something wrong when writing the model to disk Are you sure your model in the disk is ok? please use my original code run 'python example.py' again, and tell me if there is any problem