I'm pretty new to tensor flow and i'm trying to make my network sort an series of 8 numbers.
the way i would like to evaluate how well it has done is by subtracting x by y, invert the negative numbers and multiply them by a weight if thats necessary. And i was wondering if this is possible in tensorflow. Or if in any case there is better way to do this.
Something that is not tensoflow would look something like:
w = 20
s = 0
print prediction, y
for i in range(len(prediction.val)):
s+= (y[i] / prediction[i] - 1) * w
if s < 0:
s = s * -1
return s
In this case, if the total is a negative it will be inverted, however i would preferably do each element individually.
I'm currently stuck after:
prediction = neural_network_model(x)
sub = tf.subtract(prediction,y)
i found a solution that works and looks like :
prediction = neural_network_model(x)
sub = tf.subtract(prediction,y)
sign = tf.sign(sub)
cost = tf.multiply(sub,sign)
this does not yet include the weight but for now its working fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With