How do I return just one element from this output?

Question:

I am using TensorFlow in Python. When making a prediction with my model, here is my input:

UberLyft_model.predict(my_UberLyft_encoded)

I get this output:

1/1 [==============================] - 0s 53ms/step
array([[16.11945]], dtype=float32)

But I simply want this output:

16.11945

Asked By: Swifty

||

Answers:

Try

prediction = UberLyft_model.predict(my_UberLyft_encoded)
result = prediction[0][0]
print(result)
Answered By: Lakshan Costa