keras Usage of metrics 评价指标
2017-07-05 19:50
169 查看
Usage of metrics
A metric is a function that is used to judge the performance of your model. Metric functions are to be supplied in the metricsparameter
when a model is compiled.
model.compile(loss='mean_squared_error', optimizer='sgd', metrics=['mae', 'acc'])
from keras import metrics model.compile(loss='mean_squared_error', optimizer='sgd', metrics=[metrics.mae, metrics.categorical_accuracy])
A metric function is similar to an loss function, except that the results from evaluating a metric are not used when training the model.
You can either pass the name of an existing metric, or pass a Theano/TensorFlow symbolic function (see Custom metrics).
Arguments
y_true: True labels. Theano/TensorFlow tensor.y_pred: Predictions. Theano/TensorFlow tensor of the same shape as y_true.
Returns
Single tensor value representing the mean of the output array across all datapoints.
Available metrics
binary_accuracy
binary_accuracy(y_true, y_pred)
categorical_accuracy
categorical_accuracy(y_true, y_pred)
sparse_categorical_accuracy
sparse_categorical_accuracy(y_true, y_pred)
top_k_categorical_accuracy
top_k_categorical_accuracy(y_true, y_pred, k=5)
sparse_top_k_categorical_accuracy
sparse_top_k_categorical_accuracy(y_true, y_pred, k=5)
Custom metrics
Custom metrics can be passed at the compilation step. The function would need to take (y_true, y_pred)as arguments and return a single tensor value.
import keras.backend as K def mean_pred(y_true, y_pred): return K.mean(y_pred) model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy', mean_pred])
相关文章推荐
- kaggle 各种评价指标之二 :Error Metrics for Classification Problems 分类问题错误度量
- 图像检索:信息检索评价指标mAP
- Usage and Characteristics of Modern Drying Equipment
- 信息检索(IR)的评价指标介绍-准确率、召回率、F1、mAP、ROC、AUC
- 分类器评价指标
- IR的评价指标-MAP,NDCG和MRR
- Usage of Inner class in java,java 内部类的使用
- 环境影响评价的概念和指标体系
- Extensive usage of Make
- the usage of final class instance
- 机器学习模型评价指标
- svm评价指标公式
- 模型评价指标
- 【机器学习】评价指标 - 偏差与方差
- 2007透明加密一览(2) -透明加密原理和产品分类和关键评价指标
- [转] 使用SQL脚本查看表空间使用率和使用dba_tablespace_usage_metrics视图的差别
- 聚类评价指标(一)
- 检索模型评价指标
- 数据中心能效定量评价指标
- 【DataStructure】The description and usage of Stack