penduDev
penduDev

Reputation: 4785

What does this custom metric function in keras mean?

I was looking at this capsnet code on github

And I can't find what does the line no. 116 mean?

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

Can someone please explain this line? As I can't find any such reference in the keras documentation

Thanks in advance!

Upvotes: 1

Views: 2143

Answers (1)

Tay2510
Tay2510

Reputation: 5978

Document

From Keras model functional API: https://keras.io/models/model/

See Method > compile > metrics

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'}.

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


What Does it Do?

The line outputs the layer called 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
____________________________________________________________________________________________________

Upvotes: 3

Related Questions