Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Keras:整个预测的自定义损失函数_Python_Machine Learning_Keras_Loss Function - Fatal编程技术网

Python Keras:整个预测的自定义损失函数

Python Keras:整个预测的自定义损失函数,python,machine-learning,keras,loss-function,Python,Machine Learning,Keras,Loss Function,我想知道Keras中是否有办法定义损失函数“损失(Yhat)” 在一个时代结束时,将预测数据作为一个整体接收。据我所知,Keras只允许计算每批的损失,但我想知道是否有任何人知道的解决方法 谢谢 你不是在找打印(模型评估(x\u火车,y\u火车)) 如果确实希望看到“每个”历元,可以将其添加到回调中,但这会占用太多时间: printEvaluation(e,logs): print("evaluation for epoch: " + str(e)) print(model.e

我想知道Keras中是否有办法定义损失函数“损失(Yhat)”

在一个时代结束时,将预测数据作为一个整体接收。据我所知,Keras只允许计算每批的损失,但我想知道是否有任何人知道的解决方法


谢谢

你不是在找
打印(模型评估(x\u火车,y\u火车))

如果确实希望看到“每个”历元,可以将其添加到回调中,但这会占用太多时间:

printEvaluation(e,logs):

    print("evaluation for epoch: " + str(e))
    print(model.evaluate(x_train,y_train))

callback = LambdaCallback(on_epoch_end= printEvaluation)
callbacks = [callback]

model.fit(........, callbacks = callbacks)

显然,如果可能的话,使批处理大小等于整个训练数据集。