nibtehaz / RamanNet

RamanNet: A generalized neural network architecture for Raman Spectrum Analysis
MIT License
14 stars 4 forks source link

One metric, two outputs in .compile() #2

Closed katharinafechtner closed 5 months ago

katharinafechtner commented 5 months ago

I am trying to adapt your model but I get an error because only one metric is provided.

ValueError: For a model with multiple outputs, when providing the `metrics` argument as a list, it should have as many entries as the model has outputs. Received:
metrics=[<CategoricalAccuracy name=categorical_accuracy>]
of length 1 whereas the model has 2 outputs.

This doesnt work: mdl.compile(optimizer='adam', loss=losses, loss_weights=lossWeights, metrics=[CategoricalAccuracy()]) This works: mdl.compile(optimizer='adam', loss=losses, loss_weights=lossWeights, metrics=[CategoricalAccuracy(), CategoricalAccuracy()]) Can you explain or do you have any idea why this worked for you?

katharinafechtner commented 5 months ago

I made it work now, I was using another custom loss function so the behavior was different.