Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accuracy for the prediction in real time #16

Open
shreyah opened this issue Feb 12, 2019 · 4 comments
Open

Accuracy for the prediction in real time #16

shreyah opened this issue Feb 12, 2019 · 4 comments

Comments

@shreyah
Copy link

shreyah commented Feb 12, 2019

Hello Guys,

I was wondering if it possible to find the accuracy for my prediction when running in real time?

I see from your model(shown below),the prediction returns the element with maximum value in your one_hot_prediction array.
predictions = one_hot_predictions.argmax(1)

But, I want to find the accuracy of the prediction in range (0,1). I noticed the individual values of all elements in one_hot prediction array is in range (-6 to +6) (maybe because I have 6 class labels),
and the sum of all the elements in one_hot_prediction is ranging between (-1,1).

I am not sure if my deduction is right, it would be great if you give me more details on finding the accuracy of prediction.

@stuarteiffert
Copy link
Owner

Hi Shreyah,

It's not possible to find the 'accuracy' during inference (without having a ground truth), however it is possible to know how confident the network is in its classification.

You're looking at the right place, one_hot_predictions holds the output of the last layer of the network (tf.matmul(lstm_last_output, _weights['out']) + _biases['out']) and so will give you the best idea of confidence per class.

@shreyah
Copy link
Author

shreyah commented Feb 14, 2019 via email

@KristianDukov
Copy link

@shreyah Can you share how are you applying the model on your own data?

Best Regards,
Kris

@stuarteiffert
Copy link
Owner

Hi Shreyah,

Sorry about delayed response. I think tensorflow actually needs a set number of steps, it doesn't seem to be as flexible as other libraries like pytorch, which allows this.

What you can do is simply pad the input sequence with zeros to the required length and use tf.nn.dynamic_rnn() which takes sequence length as an input. This blog explains it a bit better:
https://danijar.com/variable-sequence-lengths-in-tensorflow/

Hopefully you already worked it out yourself!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants