code: def test_regression(self):
      ds_spec = {
          "val": types.Scalar(),
          "text": types.TextSegment(),
      }
      out_spec = {
          "score": types.RegressionScore(parent="val"),
      }
      example = {"val": 2}
      output = {"score": 1}
  
      score = types.RegressionScore(parent="val")
      try:
          score.validate_output(
              1, out_spec, output, ds_spec, ds_spec, example
          )
      except ValueError:
          self.fail("Raised unexpected error.")
  
      self.assertRaises(
          ValueError,
          score.validate_output,
          "wrong",
          out_spec,
          output,
          ds_spec,
          ds_spec,
          example,
      )
      bad_score = types.RegressionScore(parent="text")
      self.assertRaises(
          ValueError,
          bad_score.validate_output,
          1,
          out_spec,
          output,
          ds_spec,
          ds_spec,
          example,
      )
  
imports: from collections.abc import Callable
  import os
  from typing import Any, Optional, Union
  from absl.testing import absltest
  from absl.testing import parameterized
  from etils import epath
  from lit_nlp.api import dtypes
  from lit_nlp.api import types
  import numpy
label_desc: Use image node_id 14 for calling the TypesTest obj's underlying member method code with example usage: obj.test_regression() without return types