class_docstr: A simple linear regression model used for testing.
class_docstr_tok: ["A","simple","linear","regression","model","used","for","testing","."]
code: def compute_accuracy(
      self,
      trained_network: SimpleRegressionNetwork,
      dataset: Iterator[SampleDatapoint],
      parallelize: bool = True,
      use_multiprocessing=True,
  ) -> float:
      trained_network.eval()
      num_samples, num_correct = 0, 0
  
      for mb_data, initial_points in self.minibatch_iterator(
          self.tensorize_dataset(
              dataset,
              return_input_data=True,
              parallelize=parallelize,
              use_multiprocessing=use_multiprocessing,
          ),
          max_minibatch_size=10,
          parallelize=parallelize,
          device=torch.device(
              "cuda:0" if torch.cuda.is_available() else "cpu"
          ),
      ):
          mb_predictions = (
              trained_network.predict(**mb_data).cpu().numpy()
          )
          for point, prediction in zip(initial_points, mb_predictions):
              num_samples += 1
              if point is None:
                  raise Exception("Inital Point Data was not loaded.")
              if point.target_class == prediction:
                  num_correct += 1
      return num_correct / num_samples
  
imports: import numpy
  import torch
  from torch import nn
  from typing import Any, Dict, Iterator, NamedTuple, Optional, Union
  from ptgnn.baseneuralmodel import AbstractNeuralModel, ModuleWithMetrics
  from ptgnn.baseneuralmodel.utils.data import enforce_not_None
  from ptgnn.tests.simplemodel.data import SampleDatapoint
label_desc: Use image node_id 8 for calling the SimpleRegressionModel obj's underlying member method code with example usage: obj.compute_accuracy(trained_network, dataset, parallelize, use_multiprocessing) and returns: unknown