gagan3012 commited on
Commit
f50ef72
·
1 Parent(s): c6e4955
Files changed (2) hide show
  1. src/models/evaluate_model.py +1 -1
  2. 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.txt", "w") as fp:
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
- "Rouge 1": {
513
- "Rouge_1 Low Precision": results["rouge1"].low.precision,
514
- "Rouge_1 Low recall": results["rouge1"].low.recall,
515
- "Rouge_1 Low F1": results["rouge1"].low.fmeasure,
516
- "Rouge_1 Mid Precision": results["rouge1"].mid.precision,
517
- "Rouge_1 Mid recall": results["rouge1"].mid.recall,
518
- "Rouge_1 Mid F1": results["rouge1"].mid.fmeasure,
519
- "Rouge_1 High Precision": results["rouge1"].high.precision,
520
- "Rouge_1 High recall": results["rouge1"].high.recall,
521
- "Rouge_1 High F1": results["rouge1"].high.fmeasure,
522
- },
523
- "Rouge 2": {
524
- "Rouge_2 Low Precision": results["rouge2"].low.precision,
525
- "Rouge_2 Low recall": results["rouge2"].low.recall,
526
- "Rouge_2 Low F1": results["rouge2"].low.fmeasure,
527
- "Rouge_2 Mid Precision": results["rouge2"].mid.precision,
528
- "Rouge_2 Mid recall": results["rouge2"].mid.recall,
529
- "Rouge_2 Mid F1": results["rouge2"].mid.fmeasure,
530
- "Rouge_2 High Precision": results["rouge2"].high.precision,
531
- "Rouge_2 High recall": results["rouge2"].high.recall,
532
- "Rouge_2 High F1": results["rouge2"].high.fmeasure,
533
- },
534
- "Rouge L": {
535
- "Rouge_L Low Precision": results["rougeL"].low.precision,
536
- "Rouge_L Low recall": results["rougeL"].low.recall,
537
- "Rouge_L Low F1": results["rougeL"].low.fmeasure,
538
- "Rouge_L Mid Precision": results["rougeL"].mid.precision,
539
- "Rouge_L Mid recall": results["rougeL"].mid.recall,
540
- "Rouge_L Mid F1": results["rougeL"].mid.fmeasure,
541
- "Rouge_L High Precision": results["rougeL"].high.precision,
542
- "Rouge_L High recall": results["rougeL"].high.recall,
543
- "Rouge_L High F1": results["rougeL"].high.fmeasure,
544
- },
545
- "rougeLsum": {
546
- "rougeLsum Low Precision": results["rougeLsum"].low.precision,
547
- "rougeLsum Low recall": results["rougeLsum"].low.recall,
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