tensorflow: ValueError while implementing GMM using skflow

Hi I am trying to implement GMM using tensorflow. But I am getting the following error :- ValueError: Features are incompatible with given information. Given features: Tensor(“input:0”, shape=(?, 198), dtype=float32), required signatures: TensorSignature(dtype=tf.float64, shape=TensorShape([Dimension(None), Dimension(198)]), is_sparse=False)

Operating System: Ubuntu 16.04 tensorflow version 1.0.0

from tensorflow.contrib.factorization.python.ops import gmm as gmm_lib gmm = gmm_lib.GMM(num_clusters, batch_size=1) gmm.fit(x.astype('float32'),steps=300) yy = gmm.predict(x,y=None)

x is a numpy array of shape (2384, 198)

Please find the stack trace in stackoverflow question

If I pass a float64 data then I get the following error:- ValueError: Tensor conversion requested dtype float64 for Tensor with dtype float32: 'Tensor("sub_1:0", shape=(), dtype=float32)'

Please find the stack trace in stackoverflow question

I even tried to implement the gmm_test from here

But I got a new error :-

Traceback (most recent call last):
  File "/home/xxxxx/anaconda3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-61-c8c19df9240a>", line 1, in <module>
    gmm.fit(input_fn=input_fn(), steps=0)
TypeError: fit() got an unexpected keyword argument 'input_fn'

If it is a bug please fix it, otherwise provide an alternative

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (7 by maintainers)

Most upvoted comments

The GMM part is encapsulated as part of an Estimator (see https://www.tensorflow.org/extend/estimators). Think of that as a wrapper where you define your model and then use the class method “.fit()” to do the training. That will run sess.run() for you.

2017-05-02 14:50 GMT-04:00 vinay-hebb notifications@github.com:

@poxvoculi https://github.com/poxvoculi , I am newbie to TensorFlow so please bear with me. I have to estimate GMM parameters like weights, means. In this regards, I am using code in link https://github.com/tensorflow/tensorflow/issues/7784#issuecomment-282081517. It would be very helpful if you can explain the below.

  1. I don’t see any sess.run() to evaluate the graph. How does it get executed? If you have complete script please provide it
  2. I also tried to execute the code in link https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/factorization/python/ops/gmm_test.py. This script is executing but again I am not able to see sess.run(). If you have idea about this kindly let me know

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/tensorflow/issues/7784#issuecomment-298726114, or mute the thread https://github.com/notifications/unsubscribe-auth/AEVsoa4OV2_shkp7v7I0SBRVKSUR2P9vks5r13sCgaJpZM4MI6E5 .

– Xavi.