Reputation: 21
i have multiple feature columns and a result column where i want to predict if something happens or not. so I'm training my model and finally i do
const predictions = model.predict(xTest).argMax(-1);
this returns a tensor and when getting the data with:
predictions.dataSync ()
i get values like [0, 1, 1, 1, 0, ...] is there any way to get probabilities like in python? [0.121, 0.421, 0.8621, ...]
I only found one result: https://groups.google.com/a/tensorflow.org/g/tfjs/c/TvcB69MUj_I?pli=1
is this still the case? are there no probabilities in javascript?
Upvotes: 0
Views: 80
Reputation: 18401
tf.argMax
returns the indices of the maximum value along the axis. If you rather want to have the maximum value itself you could use tf.max
instead
const x = tf.tensor2d([[1, 2, 3],[ 4, 8, 4]]);
x.max(-1).print() // [3, 8]
x.argMax(-1).print() // [2, 1]
Upvotes: 1