【发布时间】:2019-05-09 01:09:50
【问题描述】:
我创建了一个分段函数。 y是mnist标签,y_是softmax预测结果,pen_less和pen_more是两个惩罚参数。
loss = tf.reduce_sum(tf.where(
tf.greater(tf.to_float(tf.argmax(y, 1)), tf.to_float(tf.argmax(y_, 1))),
tf.pow(pen_less, tf.to_float(tf.argmax(y, 1)) - tf.to_float(tf.argmax(y_, 1))),
tf.pow(pen_more, tf.to_float(tf.argmax(y, 1)) - tf.to_float(tf.argmax(y_, 1)))))
【问题讨论】:
标签: tensorflow machine-learning loss-function gradient