8. Tensorflow training: custom loss function
ฝัง
- เผยแพร่เมื่อ 25 ธ.ค. 2024
- #tensorflow #tutorial #keras #lossfunction #custom #neuralnetwork #training #machinelearning #deeplearning
def customloss(ytrue, ypred):
ms= tf.abs(ytrue-ypred) * tf.math.maximum(ytrue, ypred)
return tf.reduce_mean(ms)
model.compile(loss= customloss, optimizer=sgd )