prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Training classification accuracy >1
  **Describe the bug**
  Hi, I am training a classification model on MRI brain scans using vgg16 in gandlf. We expect to have accuracy in the range of 0-1. But Training classification accuracy is displayed >1. Validation accuracy seems correct. Attaching the screenshot below. Can you please have a look?
  
  **Screenshots**
  ![Screenshot from 2022-03-17 14-13-02](https://user-images.githubusercontent.com/6376680/158874773-97c9a7cd-49a1-45fa-85c9-86b93533911b.png)
  
  **GaNDLF Version**
  0.0.14
  
  
  
  </issue>
  <code>
  [start of GANDLF/metrics/regression.py]
  1 """
  2 All the metrics are to be called from here
  3 """
  4 import torch
  5 from sklearn.metrics import balanced_accuracy_score
  6 import numpy as np
  7 
  8 
  9 def classification_accuracy(output, label, params):
  10     if params["problem_type"] == "classification":
  11         predicted_classes = torch.argmax(output, 1)
  12     else:
  13         predicted_classes = output
  14     acc = torch.sum(predicted_classes == label) / len(label)
  15     return acc
  16 
  17 
  18 def balanced_acc_score(output, label, params):
  19     if params["problem_type"] == "classification":
  20         predicted_classes = torch.argmax(output, 1)
  21     else:
  22         predicted_classes = output
  23 
  24     return torch.from_numpy(
  25         np.array(balanced_accuracy_score(predicted_classes.cpu(), label.cpu()))
  26     )
  27
  [end of GANDLF/metrics/regression.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/GANDLF/metrics/regression.py b/GANDLF/metrics/regression.py
  --- a/GANDLF/metrics/regression.py
  +++ b/GANDLF/metrics/regression.py
  @@ -11,7 +11,8 @@
           predicted_classes = torch.argmax(output, 1)
       else:
           predicted_classes = output
  -    acc = torch.sum(predicted_classes == label) / len(label)
  +
  +    acc = torch.sum(predicted_classes == label.squeeze()) / len(label)
       return acc
  
verification_info: {"golden_diff": "diff --git a/GANDLF/metrics/regression.py b/GANDLF/metrics/regression.py\n--- a/GANDLF/metrics/regression.py\n+++ b/GANDLF/metrics/regression.py\n@@ -11,7 +11,8 @@\n         predicted_classes = torch.argmax(output, 1)\n     else:\n         predicted_classes = output\n-    acc = torch.sum(predicted_classes == label) / len(label)\n+\n+    acc = torch.sum(predicted_classes == label.squeeze()) / len(label)\n     return acc\n", "issue": "Training classification accuracy >1\n**Describe the bug**\r\nHi, I am training a classification model on MRI brain scans using vgg16 in gandlf. We expect to have accuracy in the range of 0-1. But Training classification accuracy is displayed >1. Validation accuracy seems correct. Attaching the screenshot below. Can you please have a look?\r\n\r\n**Screenshots**\r\n![Screenshot from 2022-03-17 14-13-02](https://user-images.githubusercontent.com/6376680/158874773-97c9a7cd-49a1-45fa-85c9-86b93533911b.png)\r\n\r\n**GaNDLF Version**\r\n0.0.14\r\n\r\n\n", "before_files": [{"content": "\"\"\"\nAll the metrics are to be called from here\n\"\"\"\nimport torch\nfrom sklearn.metrics import balanced_accuracy_score\nimport numpy as np\n\n\ndef classification_accuracy(output, label, params):\n    if params[\"problem_type\"] == \"classification\":\n        predicted_classes = torch.argmax(output, 1)\n    else:\n        predicted_classes = output\n    acc = torch.sum(predicted_classes == label) / len(label)\n    return acc\n\n\ndef balanced_acc_score(output, label, params):\n    if params[\"problem_type\"] == \"classification\":\n        predicted_classes = torch.argmax(output, 1)\n    else:\n        predicted_classes = output\n\n    return torch.from_numpy(\n        np.array(balanced_accuracy_score(predicted_classes.cpu(), label.cpu()))\n    )\n", "path": "GANDLF/metrics/regression.py"}]}