original_docstring: Evaluate the dl model on the test set
docstring: Evaluate the dl model on the test set
docstring_tokens: Evaluate the dl model on the test set
code: def eval_dl(model="models/captcha_dcnn.pt"):
      """Evaluate the dl model on the test set"""
      # the test dataset
      eval_ds = CaptchaDataset(
          csv_file=config.TEST_DATA, 
          root_dir=config.PROC_DIR, 
          transform=transforms.ToTensor()
      )
      # the test data loader
      eval_loader = DataLoader(eval_ds)
      # storing results
      y_true, y_pred = [0]*len(eval_ds), [0]*len(eval_ds)
      # evaluate the model on the test data
      print("Evaluating DCNN")
      for i, (data, target) in tqdm(enumerate(eval_loader), total=len(eval_ds)):
          # save the prediction and the true value
          y_true[i], y_pred[i] = target, predict(data, model)
      # return the precision score
      return precision_score(y_true, y_pred, average="micro")
code_tokens: def eval_dl ( model = "models/captcha_dcnn.pt" ) : eval_ds = CaptchaDataset ( csv_file = config . TEST_DATA , root_dir = config . PROC_DIR , transform = transforms . ToTensor ( ) ) eval_loader = DataLoader ( eval_ds ) y_true , y_pred = [ 0 ] * len ( eval_ds ) , [ 0 ] * len ( eval_ds ) print ( "Evaluating DCNN" ) for i , ( data , target ) in tqdm ( enumerate ( eval_loader ) , total = len ( eval_ds ) ) : y_true [ i ] , y_pred [ i ] = target , predict ( data , model ) return precision_score ( y_true , y_pred , average = "micro" )
short_docstring: Evaluate the dl model on the test set
short_docstring_tokens: Evaluate the dl model on the test set
comment: """Evaluate the dl model on the test set"""$SEP$# the test dataset$SEP$# the test data loader$SEP$# storing results$SEP$# evaluate the model on the test data$SEP$# save the prediction and the true value$SEP$# return the precision score