in Education by
I am using a pre-trained doc2vec model, when I try to find out most similar document to that of my sample document. It gives me unsupported operand type(s) error. from gensim.models import Doc2Vec filename = "doc2vec.bin" doc1 =["This is a sample document."] model = Doc2Vec.load(filename) inferred_vector = model.infer_vector(doc1) sims = model.docvecs.most_similar(positive=[inferred_vector],topn=1) print(sims) This gives me following error File "D:\doc2vectest.py", line 10, in sims = model.docvecs.most_similar(positive=[inferred_vector],topn=1) File "C:\Users\admin\Anaconda3\lib\site-packages\gensim\models\keyedvectors.py", line 1667, in most_similar self.init_sims() File "C:\Users\admin\Anaconda3\lib\site-packages\gensim\models\keyedvectors.py", line 1630, in init_sims self.vectors_docs_norm = _l2_norm(self.vectors_docs, replace=replace) File "C:\Users\admin\Anaconda3\lib\site-packages\gensim\models\keyedvectors.py", line 2346, in _l2_norm dist = sqrt((m ** 2).sum(-1))[..., newaxis] TypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int' JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
It's possible your pre-trained model isn't compatible with the version of gensim in your environment. Where did the model originate? (Separately: infer_document() requires a list-of-tokens, not a string. And, those tokens should have been preprocessed in exactly the same was as whatever training data was used to train the model.)

Related questions

0 votes
    I Have a soccer database, and I have a trigger (notas) that is calculating a player rating after ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    The code works fine but the only problem I encountered an error is: bad operand type for unary +: 'str'. This is ... for unary +: 'str' Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
0 votes
    I am trying to create QR Reader. However, when I open the window with scanner, it crashes with ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    after installing composer I tried to install larvel but it gives ErrorException .please help.... data from ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    after installing composer I tried to install larvel but it gives ErrorException .please help.... data from ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    We switched from citrix to HAProxy for load balancing recently. The Problem is that for some requests ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    ___________ function gives an error message if the desired package cannot be loaded. (a) Dplyr (b) Require (c ... of R Programming Select the correct answer from above options...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    The question as the title. Why is this, I have used the ssh command: ssh -i mykey.pem root@xxx-xxx-xx-xx-xxx ... What am I doing wrong? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    If the ratio of the polynomial P (s) and its derivative gives a continued fraction expansion with ________ coefficients ... EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 12, 2021 in Education by JackTerrance
0 votes
    I just updated to Android Studio 3.4 (Canary 5). Then I opened my existing project (which worked ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    Annotation type definition looks similar to which of the following? (a) Method (b) Class (c) Interface (d) ... & Annotations of Java Select the correct answer from above options...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    Similar type of vegetation can be observed, in the same (a) latitude (b) longitude (c) ... Science,Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 8, 2021 in Education by JackTerrance
0 votes
    Using _________ on categorical data will produce similar output to a Series or DataFrame of type string. (a) ... and answers pdf, Data Science interview questions for beginners...
asked Oct 31, 2021 in Education by JackTerrance
...