Open NumesSanguis opened 5 years ago
Hi @NumesSanguis, thank you for posting the issue.
Could you, please, post a model configuration or at least the last layer (example of output data), so I could understand why this fix is necessary? Thank you in advance.
@ybubnov I can confirm this issue. I tried with
f1 = keras_metrics.f1_score(label=1)
self.model.compile(optimizer="Adam", loss='binary_crossentropy', metrics=[f1])
and got the same error. My last layer currently is
output_layer = keras.layers.Dense(self.n_classes, activation="softmax")(dense2)
The labels are 1-hot-encoded and have 12 classes, so the values have to be in the form
np.array([0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0.])
Since this issue (https://github.com/netrack/keras-metrics/pull/23) it should be possible to have a y array of longer than 2, however I cannot get it to work.
I have 5 classes, so I tried to use precision for 1 label with:
However, this results in the error:
It seems like it only looks at the y shape, and not whether a label is specified?
Would this be better?: