Joshua Lochner commited on
Commit
a6de017
1 Parent(s): 7781f10

Remove redundant count

Browse files
Files changed (1) hide show
  1. src/evaluate.py +5 -9
src/evaluate.py CHANGED
@@ -6,9 +6,8 @@ from transformers import (
6
  HfArgumentParser
7
  )
8
  from preprocess import DatasetArguments, ProcessedArguments, get_words
9
- from model import get_classifier_vectorizer
10
  from shared import device, GeneralArguments
11
- from predict import ClassifierArguments, predict, add_predictions, TrainingOutputArguments
12
  from segment import word_start, word_end, SegmentationArguments, add_labels_to_words
13
  import pandas as pd
14
  from dataclasses import dataclass, field
@@ -176,7 +175,6 @@ def main():
176
  total_recall = 0
177
  total_fscore = 0
178
 
179
- count = 0
180
  out_metrics = []
181
 
182
  try:
@@ -189,8 +187,6 @@ def main():
189
  if not words:
190
  continue
191
 
192
- count += 1
193
-
194
  # Make predictions
195
  predictions = predict(video_id, model, tokenizer,
196
  segmentation_args, words, classifier_args)
@@ -207,10 +203,10 @@ def main():
207
  total_fscore += met['f-score']
208
 
209
  progress.set_postfix({
210
- 'accuracy': total_accuracy/count,
211
- 'precision': total_precision/count,
212
- 'recall': total_recall/count,
213
- 'f-score': total_fscore/count
214
  })
215
 
216
  labelled_predicted_segments = attach_predictions_to_sponsor_segments(
 
6
  HfArgumentParser
7
  )
8
  from preprocess import DatasetArguments, ProcessedArguments, get_words
 
9
  from shared import device, GeneralArguments
10
+ from predict import ClassifierArguments, predict, TrainingOutputArguments
11
  from segment import word_start, word_end, SegmentationArguments, add_labels_to_words
12
  import pandas as pd
13
  from dataclasses import dataclass, field
 
175
  total_recall = 0
176
  total_fscore = 0
177
 
 
178
  out_metrics = []
179
 
180
  try:
 
187
  if not words:
188
  continue
189
 
 
 
190
  # Make predictions
191
  predictions = predict(video_id, model, tokenizer,
192
  segmentation_args, words, classifier_args)
 
203
  total_fscore += met['f-score']
204
 
205
  progress.set_postfix({
206
+ 'accuracy': total_accuracy/len(out_metrics),
207
+ 'precision': total_precision/len(out_metrics),
208
+ 'recall': total_recall/len(out_metrics),
209
+ 'f-score': total_fscore/len(out_metrics)
210
  })
211
 
212
  labelled_predicted_segments = attach_predictions_to_sponsor_segments(