Numpy error in hmmlearn - numpy

I am using hmmlearn library to create HMM. While running the code it gave an error ttributeError: 'module' object has no attribute 'broadcast_to'.
I am running GMMHMM as
model1 = GMMHMM(n_components=4, n_mix=64, covariance_type='diag', n_iter=1000, min_covar=0.001, startprob_prior=1.0, transmat_prior=1.0, weights_prior=1.0, means_prior=0.0, means_weight=0.0, covars_prior=None, covars_weight=None, algorithm='viterbi', random_state=None, tol=0.01, verbose=False, params='stmcw', init_params='stmcw').fit(X)
and the error traceback is
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-i686/egg/hmmlearn/base.py", line 424, in fit
File "build/bdist.linux-i686/egg/hmmlearn/hmm.py", line 609, in _init
File "build/bdist.linux-i686/egg/hmmlearn/hmm.py", line 677, in
_fix_priors_shape
AttributeError: 'module' object has no attribute 'broadcast_to'
I figured out that it is because of numpy. How can we fix this

Make sure you have at least NumPy 1.10.0, because np.broadcast_to is not available for newer versions.

Related

Is there a way to fix AttributeError: module 'tensorflow._api.v2.io.gfile' has no attribute 'Open'

ERROR: test_create_center_net_model_mobilenet (main.ModelBuilderTF2Test)
ModelBuilderTF2Test.test_create_center_net_model_mobilenet
Test building a CenterNet model using bilinear interpolation.
Traceback (most recent call last):
File "Tensorflow\models\research\object_detection\builders\model_builder_tf2_test.py", line 499, in test_create_center_net_model_mobilenet
self.get_fake_label_map_file_path())
File "Tensorflow\models\research\object_detection\builders\model_builder_tf2_test.py", line 80, in get_fake_label_map_file_path
with tf.io.gfile.Open(keypoint_label_map_path, 'wb') as f:
AttributeError: module 'tensorflow._api.v2.io.gfile' has no attribute 'Open'

<TypeError: loop of ufunc does not support argument 0 of type numpy.ndarray which has no callable rint method

I get the followin error when I tey tu run the file from terminal:
I am using python 3.7 and working on a windows 10 system.
The error apears while running a virtual environment where all the requirements have been installed.
Using TensorFlow backend.
AttributeError: 'numpy.ndarray' object has no attribute 'rint'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\52331\PycharmProjects\Q-Learning-for-Trading\venv\lib\site-packages\numpy\core\fromnumeric.py", line 61, in _wrapfunc
return bound(*args, **kwds)
TypeError: loop of ufunc does not support argument 0 of type numpy.ndarray which has no callable rint method
During handling of the above exception, another exception occurred:
AttributeError: 'numpy.ndarray' object has no attribute 'rint'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "run.py", line 29, in <module>
data = np.around(get_data())
File "<__array_function__ internals>", line 6, in around
File "C:\Users\52331\PycharmProjects\Q-Learning-for-Trading\venv\lib\site-packages\numpy\core\fromnumeric.py", line 3224, in around
return _wrapfunc(a, 'round', decimals=decimals, out=out)
File "C:\Users\52331\PycharmProjects\Q-Learning-for-Trading\venv\lib\site-packages\numpy\core\fromnumeric.py", line 70, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
File "C:\Users\52331\PycharmProjects\Q-Learning-for-Trading\venv\lib\site-packages\numpy\core\fromnumeric.py", line 47, in _wrapit
result = getattr(asarray(obj), method)(*args, **kwds)
TypeError: loop of ufunc does not support argument 0 of type numpy.ndarray which has no callable rint method

Tensorflow object detection API test error

I am currently trying to use models from Google, and testing object detection API, but I met with the error which stops me from processing. Here are my errors. Can anyone tell me how to solve this:
tf#tf:~/Downloads/user/huyanju/models/research$ python object_detection/builders/model_builder_test.py
Traceback (most recent call last):
File "object_detection/builders/model_builder_test.py", line 21, in <module>
from object_detection.builders import model_builder
File "/home/tf/Downloads/user/huyanju/models/research/object_detection/builders/model_builder.py", line 17, in <module>
from object_detection.builders import anchor_generator_builder
File "/home/tf/Downloads/user/huyanju/models/research/object_detection/builders/anchor_generator_builder.py", line 21, in <module>
from object_detection.protos import anchor_generator_pb2
File "/home/tf/Downloads/user/huyanju/models/research/object_detection/protos/anchor_generator_pb2.py", line 16, in <module>
from object_detection.protos import grid_anchor_generator_pb2 as object__detection_dot_protos_dot_grid__anchor__generator__pb2
File "/home/tf/Downloads/user/huyanju/models/research/object_detection/protos/grid_anchor_generator_pb2.py", line 41, in <module>
options=None, file=DESCRIPTOR),
TypeError: __new__() got an unexpected keyword argument 'file'
tf#tf:~/Downloads/user/huyanju/models/research$

from tensorflow.python.ops.rnn_cell import _linear

Mine is tensor flow v 1.0 and i am getting this error how resolve this error
Error:-
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named rnn_cell
Thanks
Pratik goyal

mnist_with_summaries.py error: 'Graph' object has no attribute 'SerializeToString'

When I try to run mnist_with_summaries.py I get the following error:
Traceback (most recent call last):
File "/home/rob/tf_from_source/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py", line 110, in
tf.app.run()
File "/home/rob/.virtualenvs/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
File "/home/rob/tf_from_source/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py", line 85, in main
writer = tf.train.SummaryWriter(FLAGS.summaries_dir, sess.graph)
File "/home/rob/.virtualenvs/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/summary_io.py", line 104, in init
self.add_graph(graph_def)
File "/home/rob/.virtualenvs/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/summary_io.py", line 168, in add_graph
graph_bytes = graph_def.SerializeToString()
AttributeError: 'Graph' object has no attribute 'SerializeToString'
I'm also seeing this error on some of my own code when I try to generate a tensorboard graph. Any ideas about the problem and solution would be appreciated.
Looks like the answer was provided here. I rolled back to the r0.7 branch and the problem was resolved.