Spaces:
Sleeping
Sleeping
hichem-abdellali
commited on
update the sorting and minor changes
Browse files- user-friendly-metrics.py +8 -9
user-friendly-metrics.py
CHANGED
@@ -141,6 +141,8 @@ class UserFriendlyMetrics(evaluate.Metric):
|
|
141 |
"recognition_0.3",
|
142 |
"recognition_0.5",
|
143 |
"recognition_0.8",
|
|
|
|
|
144 |
"recognized_0.3",
|
145 |
"recognized_0.5",
|
146 |
"recognized_0.8",
|
@@ -161,11 +163,12 @@ class UserFriendlyMetrics(evaluate.Metric):
|
|
161 |
run.log({log_key: value})
|
162 |
|
163 |
if debug:
|
164 |
-
print(f"
|
165 |
|
166 |
for category, metrics in categories.items():
|
167 |
if metric in metrics:
|
168 |
chart_data[category].append([metric, value])
|
|
|
169 |
|
170 |
if log_plots:
|
171 |
for category, data in chart_data.items():
|
@@ -186,11 +189,8 @@ class UserFriendlyMetrics(evaluate.Metric):
|
|
186 |
if "per_sequence" in results:
|
187 |
sorted_sequences = sorted(
|
188 |
results["per_sequence"].items(),
|
189 |
-
key=lambda x: x[1]
|
190 |
-
|
191 |
-
.get("f1", {})
|
192 |
-
.get("all", 0),
|
193 |
-
reverse=True,
|
194 |
)
|
195 |
|
196 |
for sequence_name, sequence_data in sorted_sequences:
|
@@ -203,9 +203,8 @@ class UserFriendlyMetrics(evaluate.Metric):
|
|
203 |
)
|
204 |
run.log({log_key: value})
|
205 |
if debug:
|
206 |
-
print(
|
207 |
-
|
208 |
-
)
|
209 |
|
210 |
if debug:
|
211 |
print("\nDebug Mode: Logging Summary and History")
|
|
|
141 |
"recognition_0.3",
|
142 |
"recognition_0.5",
|
143 |
"recognition_0.8",
|
144 |
+
},
|
145 |
+
"recognized_metrics": {
|
146 |
"recognized_0.3",
|
147 |
"recognized_0.5",
|
148 |
"recognized_0.8",
|
|
|
163 |
run.log({log_key: value})
|
164 |
|
165 |
if debug:
|
166 |
+
print(f" {log_key} = {value}")
|
167 |
|
168 |
for category, metrics in categories.items():
|
169 |
if metric in metrics:
|
170 |
chart_data[category].append([metric, value])
|
171 |
+
print("----------------------------------------------------")
|
172 |
|
173 |
if log_plots:
|
174 |
for category, data in chart_data.items():
|
|
|
189 |
if "per_sequence" in results:
|
190 |
sorted_sequences = sorted(
|
191 |
results["per_sequence"].items(),
|
192 |
+
key=lambda x: next(iter(x[1].values()), {}).get("all", {}).get("f1", 0),
|
193 |
+
reverse=True, # Set to True for descending order
|
|
|
|
|
|
|
194 |
)
|
195 |
|
196 |
for sequence_name, sequence_data in sorted_sequences:
|
|
|
203 |
)
|
204 |
run.log({log_key: value})
|
205 |
if debug:
|
206 |
+
print(f" {log_key} = {value}")
|
207 |
+
print("----------------------------------------------------")
|
|
|
208 |
|
209 |
if debug:
|
210 |
print("\nDebug Mode: Logging Summary and History")
|