python关键字evaluate_python – Keras中的model.evaluate()返回了什么值?

Keras的model.evaluate()返回模型在测试数据上的损失值或一系列指标。如果模型有多个输出或指标,返回的是标量列表。可以通过model.metrics_names获取显示标签。示例代码展示了如何使用该方法并解释了输出结果的含义。
摘要由CSDN通过智能技术生成

引自

evaluate() method documentation:

Returns

Scalar test loss (if the model has a single output and no metrics) or

list of scalars (if the model has multiple outputs and/or metrics).

The attribute model.metrics_names will give you the display labels

for the scalar outputs.

因此,您可以使用模型的metrics_names属性来查找每个值对应的内容.例如:

from keras import layers

from keras import models

import numpy as np

input_data = layers.Input(shape=(100,))

out_1 = layers.Dense(1)(input_data)

out_2 = layers.Dense(1)(input_data)

model = models.Model(input_data, [out_1, out_2])

model.compile(loss='mse', optimizer='adam', metrics=['mae'])

print(model.metrics_names)

输出以下内容:

['loss', 'dense_1_loss', 'dense_2_loss', 'dense_1_mean_ab

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值