PyBayes
PyBayes copied to clipboard
Vector multiplication error
Hi, I'm using the deb package available in Ubuntu 16.04. I'm experiencing this error with PyBayes:
File "/home/manolofc/catkin_ws/src/RFID/pr_model/scripts/frequencyModel.py", line 151, in addObservation
self.pf.bayes(yt)
File "/usr/local/lib/python2.7/dist-packages/pybayes/filters.py", line 322, in bayes
self.emp.weights[i] *= exp(self.p_yt_xt.eval_log(yt, self.emp.particles[i]))
File "/usr/local/lib/python2.7/dist-packages/pybayes/pdfs.py", line 1300, in eval_log
return self.gauss.eval_log(x)
File "/usr/local/lib/python2.7/dist-packages/pybayes/pdfs.py", line 568, in eval_log
log_val = -1/2. * np.dot_vv(distance, np.dot_mv(linalg.inv(self.R), distance))
ValueError: shapes (2,) and (1,2) not aligned: 2 (dim 0) != 1 (dim 0)
It seems to be related with the observation and state dimensions. In my case yt has dimension 2 and xt dimension 3. Any idea of what could be wrong? Thanks
Hmm, seems to be a mismatch somewhere between a vector (1D array) and 1-row matrix (2D array). Can you print shape
of yt
at RFID/pr_model/scripts/frequencyModel.py", line 151, in addObservation
?
Hi,
yt.shape
is (2,)
. I tried to reshape it to (2,1)
[1-row matrix] and I saw what you meant: library needs vectors as inputs.