Spaces:
Runtime error
Runtime error
updates
Browse files- src/models/evaluate_model.py +1 -1
- src/models/model.py +36 -44
src/models/evaluate_model.py
CHANGED
@@ -18,7 +18,7 @@ def evaluate_model():
|
|
18 |
model.load_model(model_type=params["model_type"], model_dir=params["model_dir"])
|
19 |
results = model.evaluate(test_df=test_df, metrics=params["metric"])
|
20 |
|
21 |
-
with open("reports/metrics.
|
22 |
json.dump(results, fp)
|
23 |
|
24 |
|
|
|
18 |
model.load_model(model_type=params["model_type"], model_dir=params["model_dir"])
|
19 |
results = model.evaluate(test_df=test_df, metrics=params["metric"])
|
20 |
|
21 |
+
with open("reports/metrics.csv", "w") as fp:
|
22 |
json.dump(results, fp)
|
23 |
|
24 |
|
src/models/model.py
CHANGED
@@ -509,49 +509,41 @@ class Summarization:
|
|
509 |
results = metric.compute(predictions=predictions, references=references)
|
510 |
|
511 |
output = {
|
512 |
-
"
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
"
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
"
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
"rougeLsum":
|
546 |
-
|
547 |
-
|
548 |
-
"rougeLsum Low F1": results["rougeLsum"].low.fmeasure,
|
549 |
-
"rougeLsum Mid Precision": results["rougeLsum"].mid.precision,
|
550 |
-
"rougeLsum Mid recall": results["rougeLsum"].mid.recall,
|
551 |
-
"rougeLsum Mid F1": results["rougeLsum"].mid.fmeasure,
|
552 |
-
"rougeLsum High Precision": results["rougeLsum"].high.precision,
|
553 |
-
"rougeLsum High recall": results["rougeLsum"].high.recall,
|
554 |
-
"rougeLsum High F1": results["rougeLsum"].high.fmeasure,
|
555 |
-
},
|
556 |
}
|
557 |
return output
|
|
|
509 |
results = metric.compute(predictions=predictions, references=references)
|
510 |
|
511 |
output = {
|
512 |
+
"Rouge_1 Low Precision": results["rouge1"].low.precision,
|
513 |
+
"Rouge_1 Low recall": results["rouge1"].low.recall,
|
514 |
+
"Rouge_1 Low F1": results["rouge1"].low.fmeasure,
|
515 |
+
"Rouge_1 Mid Precision": results["rouge1"].mid.precision,
|
516 |
+
"Rouge_1 Mid recall": results["rouge1"].mid.recall,
|
517 |
+
"Rouge_1 Mid F1": results["rouge1"].mid.fmeasure,
|
518 |
+
"Rouge_1 High Precision": results["rouge1"].high.precision,
|
519 |
+
"Rouge_1 High recall": results["rouge1"].high.recall,
|
520 |
+
"Rouge_1 High F1": results["rouge1"].high.fmeasure,
|
521 |
+
"Rouge_2 Low Precision": results["rouge2"].low.precision,
|
522 |
+
"Rouge_2 Low recall": results["rouge2"].low.recall,
|
523 |
+
"Rouge_2 Low F1": results["rouge2"].low.fmeasure,
|
524 |
+
"Rouge_2 Mid Precision": results["rouge2"].mid.precision,
|
525 |
+
"Rouge_2 Mid recall": results["rouge2"].mid.recall,
|
526 |
+
"Rouge_2 Mid F1": results["rouge2"].mid.fmeasure,
|
527 |
+
"Rouge_2 High Precision": results["rouge2"].high.precision,
|
528 |
+
"Rouge_2 High recall": results["rouge2"].high.recall,
|
529 |
+
"Rouge_2 High F1": results["rouge2"].high.fmeasure,
|
530 |
+
"Rouge_L Low Precision": results["rougeL"].low.precision,
|
531 |
+
"Rouge_L Low recall": results["rougeL"].low.recall,
|
532 |
+
"Rouge_L Low F1": results["rougeL"].low.fmeasure,
|
533 |
+
"Rouge_L Mid Precision": results["rougeL"].mid.precision,
|
534 |
+
"Rouge_L Mid recall": results["rougeL"].mid.recall,
|
535 |
+
"Rouge_L Mid F1": results["rougeL"].mid.fmeasure,
|
536 |
+
"Rouge_L High Precision": results["rougeL"].high.precision,
|
537 |
+
"Rouge_L High recall": results["rougeL"].high.recall,
|
538 |
+
"Rouge_L High F1": results["rougeL"].high.fmeasure,
|
539 |
+
"rougeLsum Low Precision": results["rougeLsum"].low.precision,
|
540 |
+
"rougeLsum Low recall": results["rougeLsum"].low.recall,
|
541 |
+
"rougeLsum Low F1": results["rougeLsum"].low.fmeasure,
|
542 |
+
"rougeLsum Mid Precision": results["rougeLsum"].mid.precision,
|
543 |
+
"rougeLsum Mid recall": results["rougeLsum"].mid.recall,
|
544 |
+
"rougeLsum Mid F1": results["rougeLsum"].mid.fmeasure,
|
545 |
+
"rougeLsum High Precision": results["rougeLsum"].high.precision,
|
546 |
+
"rougeLsum High recall": results["rougeLsum"].high.recall,
|
547 |
+
"rougeLsum High F1": results["rougeLsum"].high.fmeasure,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
}
|
549 |
return output
|