2

I am working in imdb dataset on reviews, when i want to predict the outcome of the user given input using the model.predict method in tensorflow it gives an array. How to interpret the results from that array?

string = str(input()) new_string = token.texts_to_sequences(string) padded_new_string = pad_sequences(new_string,maxlen = 120, truncating = 'post') print(model.predict(padded_new_string)) 

Also i used binary classification using sigmoid

model = tf.keras.Sequential([ tf.keras.layers.Embedding(10000,16,input_length = 120), tf.keras.layers.Flatten(), tf.keras.layers.Dense(12,activation = 'relu'), tf.keras.layers.Dense(6,activation = 'relu'), tf.keras.layers.Dense(1,activation = 'sigmoid') ]) 

Any help will be helpful

1 Answer 1

1

If I'm not mistaken model.predict returns numpy array for each corresponding prediction of the y_test. To interpret the values you could use evaluate method to find the accuracy of your model

score = model.evaluate(x_test, y_test, verbose=0) print('Test loss:', score[0]) print('Test accuracy:', score[1]) 
Sign up to request clarification or add additional context in comments.

2 Comments

What about the other values in the array ? they must also tell something about the model.
Maybe you should look at the link The fact is I can't tell precisely what is the output of your predcitions, since I can't test your code. I believe you should look at your y_test and y_pred results to get a meaningful interpretation.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.