keras中的这个自定义指标函数是什么意思?

What does this custom metric function in keras mean?

我在看这个capsnet code on github

而且我找不到行号是什么。 116 是什么意思?

metrics={'capsnet': 'accuracy'})

有人可以解释一下这一行吗?因为我在 keras documentation

中找不到任何此类参考

提前致谢!

文档

来自 Keras 模型函数 API:https://keras.io/models/model/

参见方法 > 编译 > 度量

metrics: List of metrics to be evaluated by the model during training and testing. Typically you will use metrics=['accuracy']. To specify different metrics for different outputs of a multi-output model, you could also pass a dictionary, such as metrics={'output_a': 'accuracy'}.

(来源:https://github.com/keras-team/keras/blob/master/keras/models.py#L786-L791


它有什么作用?

该行输出名为capsnet的层(which can be found within the same file) with accuracy metric. The rest is just the same as the document you provided

.... (The above omitted)
____________________________________________________________________________________________________
mask_1 (Mask)                    (None, 160)           0           digitcaps[0][0]                  
                                                               input_2[0][0]                    
____________________________________________________________________________________________________
capsnet (Length)                 (None, 10)            0           digitcaps[0][0]                  
____________________________________________________________________________________________________
decoder (Sequential)             (None, 28, 28, 1)     1411344     mask_1[0][0]                     
====================================================================================================
Total params: 8,215,568
Trainable params: 8,215,568
Non-trainable params: 0
____________________________________________________________________________________________________