Skip to content

Commit 32a3e48

Browse files
committed
All threshold as null in F1 Score.
1 parent 9726fc6 commit 32a3e48

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/TensorFlowNET.Core/Keras/Metrics/IMetricsApi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ IMetricFunc CosineSimilarity(string name = "cosine_similarity",
7777
/// <returns></returns>
7878
IMetricFunc F1Score(int num_classes,
7979
string? average = null,
80-
float threshold = -1f,
80+
float? threshold = null,
8181
string name = "f1_score",
8282
TF_DataType dtype = TF_DataType.TF_FLOAT);
8383

@@ -88,7 +88,7 @@ IMetricFunc F1Score(int num_classes,
8888
IMetricFunc FBetaScore(int num_classes,
8989
string? average = null,
9090
float beta = 0.1f,
91-
float threshold = -1f,
91+
float? threshold = null,
9292
string name = "fbeta_score",
9393
TF_DataType dtype = TF_DataType.TF_FLOAT);
9494

src/TensorFlowNET.Keras/Metrics/F1Score.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class F1Score : FBetaScore
44
{
55
public F1Score(int num_classes,
66
string? average = null,
7-
float? threshold = -1f,
7+
float? threshold = null,
88
string name = "f1_score",
99
TF_DataType dtype = TF_DataType.TF_FLOAT)
1010
: base(num_classes, average: average, threshold: threshold, beta: 1f, name: name, dtype: dtype)

src/TensorFlowNET.Keras/Metrics/FBetaScore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class FBetaScore : Metric
1717
public FBetaScore(int num_classes,
1818
string? average = null,
1919
float beta = 0.1f,
20-
float? threshold = -1f,
20+
float? threshold = null,
2121
string name = "fbeta_score",
2222
TF_DataType dtype = TF_DataType.TF_FLOAT)
2323
: base(name: name, dtype: dtype)

src/TensorFlowNET.Keras/Metrics/MetricsApi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ public IMetricFunc CategoricalCrossentropy(string name = "categorical_crossentro
8686
public IMetricFunc CosineSimilarity(string name = "cosine_similarity", TF_DataType dtype = TF_DataType.TF_FLOAT, Axis? axis = null)
8787
=> new CosineSimilarity(name: name, dtype: dtype, axis: axis ?? -1);
8888

89-
public IMetricFunc F1Score(int num_classes, string? average = null, float threshold = -1, string name = "f1_score", TF_DataType dtype = TF_DataType.TF_FLOAT)
89+
public IMetricFunc F1Score(int num_classes, string? average = null, float? threshold = null, string name = "f1_score", TF_DataType dtype = TF_DataType.TF_FLOAT)
9090
=> new F1Score(num_classes, average: average, threshold: threshold, name: name, dtype: dtype);
9191

92-
public IMetricFunc FBetaScore(int num_classes, string? average = null, float beta = 0.1F, float threshold = -1, string name = "fbeta_score", TF_DataType dtype = TF_DataType.TF_FLOAT)
92+
public IMetricFunc FBetaScore(int num_classes, string? average = null, float beta = 0.1F, float? threshold = null, string name = "fbeta_score", TF_DataType dtype = TF_DataType.TF_FLOAT)
9393
=> new FBetaScore(num_classes, average: average,beta: beta, threshold: threshold, name: name, dtype: dtype);
9494

9595
public IMetricFunc TopKCategoricalAccuracy(int k = 5, string name = "top_k_categorical_accuracy", TF_DataType dtype = TF_DataType.TF_FLOAT)

0 commit comments

Comments
 (0)