Browse Source

Set mean of all classes in F1 Score.

tags/v0.100.4-load-saved-model
Haiping Chen 2 years ago
parent
commit
922139ff75
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/TensorFlowNET.Keras/Engine/Model.Train.cs

+ 9
- 1
src/TensorFlowNET.Keras/Engine/Model.Train.cs View File

@@ -39,7 +39,15 @@ namespace Tensorflow.Keras.Engine
compiled_metrics.update_state(y, y_pred);

var dict = new Dictionary<string, float>();
metrics.ToList().ForEach(x => dict[x.Name] = (float)x.result());
metrics.ToList().ForEach(x =>
{
var r = x.result();
if (r.ndim > 0)
{
r = tf.reduce_mean(r);
}
dict[x.Name] = (float)r;
});
return dict;
}



Loading…
Cancel
Save