Closed sachin1190 closed 4 years ago
getting a ValueError inside the predictWords function at line 6 ,
y_pred = predictor.predict_proba(wordsDf)
and inside the naive_bayes.py
<ipython-input-6-55c8aeacc0c5> in predictWords(wordsDf, df) 4 predictor = loadPickle(predictorPickleName) 5 ----> 6 y_pred = predictor.predict_proba(wordsDf) 7 8 labeledAnswers = [] ~/env/lib/python3.6/site-packages/sklearn/naive_bayes.py in predict_log_proba(self, X) 95 check_is_fitted(self) 96 X = self._check_X(X) ---> 97 jll = self._joint_log_likelihood(X) 98 # normalize by P(x) = P(f_1, ..., f_n) 99 log_prob_x = logsumexp(jll, axis=1) ~/env/lib/python3.6/site-packages/sklearn/naive_bayes.py in _joint_log_likelihood(self, X) 449 jointi = np.log(self.class_prior_[i]) 450 n_ij = - 0.5 * np.sum(np.log(2. * np.pi * self.sigma_[i, :])) --> 451 n_ij -= 0.5 * np.sum(((X - self.theta_[i, :]) ** 2) / 452 (self.sigma_[i, :]), 1) 453 joint_log_likelihood.append(jointi + n_ij)
Requirements used : attrs==19.3.0 backcall==0.1.0 bleach==3.1.1 blis==0.4.1 boto==2.49.0 boto3==1.12.5 botocore==1.15.5 catalogue==1.0.0 certifi==2019.11.28 chardet==3.0.4 cycler==0.10.0 cymem==2.0.3 decorator==4.4.1 defusedxml==0.6.0 docutils==0.15.2 en-core-web-md==2.2.5 en-core-web-sm==2.2.5 entrypoints==0.3 gensim==3.8.1 idna==2.9 importlib-metadata==1.5.0 ipykernel==5.1.4 ipython==7.12.0 ipython-genutils==0.2.0 ipywidgets==7.5.1 jedi==0.16.0 Jinja2==2.11.1 jmespath==0.9.4 joblib==0.14.1 jsonschema==3.2.0 jupyter==1.0.0 jupyter-client==5.3.4 jupyter-console==6.1.0 jupyter-core==4.6.3 kiwisolver==1.1.0 MarkupSafe==1.1.1 matplotlib==3.1.3 mistune==0.8.4 murmurhash==1.0.2 nbconvert==5.6.1 nbformat==5.0.4 nltk==3.4.5 notebook==6.0.3 numpy==1.18.1 pandas==1.0.1 pandocfilters==1.4.2 parso==0.6.1 pexpect==4.8.0 pickleshare==0.7.5 pkg-resources==0.0.0 plac==1.1.3 preshed==3.0.2 prometheus-client==0.7.1 prompt-toolkit==3.0.3 ptyprocess==0.6.0 Pygments==2.5.2 pyparsing==2.4.6 pyrsistent==0.15.7 python-dateutil==2.8.1 pytz==2019.3 pyzmq==18.1.1 qtconsole==4.6.0 requests==2.23.0 s3transfer==0.3.3 scikit-learn==0.22.1 scipy==1.4.1 Send2Trash==1.5.0 six==1.14.0 sklearn==0.0 smart-open==1.9.0 spacy==2.2.3 srsly==1.0.1 terminado==0.8.3 testpath==0.4.4 thinc==7.3.1 tornado==6.0.3 tqdm==4.43.0 traitlets==4.3.3 urllib3==1.25.8 wasabi==0.6.0 wcwidth==0.1.8 webencodings==0.5.1 widgetsnbextension==3.5.1 zipp==3.0.0
@sachin1190 @KristiyanVachev , getting same error ValueError: operands could not be broadcast together with shapes (2336,122) (121,) and i followed above requirements as well but i was unable to resolve this issue
could you please help me to resolve this
Thanks and Regards, Manikantha Sekhar Musunuri.
@sachin1190 : How did you resolve this ValueError can you answer that, I am also facing the same issue with my code
Having the same problem, anyone found a fix??
getting a ValueError inside the predictWords function at line 6 ,
y_pred = predictor.predict_proba(wordsDf)
and inside the naive_bayes.py
Requirements used : attrs==19.3.0 backcall==0.1.0 bleach==3.1.1 blis==0.4.1 boto==2.49.0 boto3==1.12.5 botocore==1.15.5 catalogue==1.0.0 certifi==2019.11.28 chardet==3.0.4 cycler==0.10.0 cymem==2.0.3 decorator==4.4.1 defusedxml==0.6.0 docutils==0.15.2 en-core-web-md==2.2.5 en-core-web-sm==2.2.5 entrypoints==0.3 gensim==3.8.1 idna==2.9 importlib-metadata==1.5.0 ipykernel==5.1.4 ipython==7.12.0 ipython-genutils==0.2.0 ipywidgets==7.5.1 jedi==0.16.0 Jinja2==2.11.1 jmespath==0.9.4 joblib==0.14.1 jsonschema==3.2.0 jupyter==1.0.0 jupyter-client==5.3.4 jupyter-console==6.1.0 jupyter-core==4.6.3 kiwisolver==1.1.0 MarkupSafe==1.1.1 matplotlib==3.1.3 mistune==0.8.4 murmurhash==1.0.2 nbconvert==5.6.1 nbformat==5.0.4 nltk==3.4.5 notebook==6.0.3 numpy==1.18.1 pandas==1.0.1 pandocfilters==1.4.2 parso==0.6.1 pexpect==4.8.0 pickleshare==0.7.5 pkg-resources==0.0.0 plac==1.1.3 preshed==3.0.2 prometheus-client==0.7.1 prompt-toolkit==3.0.3 ptyprocess==0.6.0 Pygments==2.5.2 pyparsing==2.4.6 pyrsistent==0.15.7 python-dateutil==2.8.1 pytz==2019.3 pyzmq==18.1.1 qtconsole==4.6.0 requests==2.23.0 s3transfer==0.3.3 scikit-learn==0.22.1 scipy==1.4.1 Send2Trash==1.5.0 six==1.14.0 sklearn==0.0 smart-open==1.9.0 spacy==2.2.3 srsly==1.0.1 terminado==0.8.3 testpath==0.4.4 thinc==7.3.1 tornado==6.0.3 tqdm==4.43.0 traitlets==4.3.3 urllib3==1.25.8 wasabi==0.6.0 wcwidth==0.1.8 webencodings==0.5.1 widgetsnbextension==3.5.1 zipp==3.0.0