class_docstr: A task that asks the model to induce an unknown polynomial at a point given a set of function evaluations.
  Unlike pre-existing tasks testing arithmetic, this task attempts to test a deeper notion of numeracy
  which the model cannot rely purely on rote memorization of standard tables of arithmetic operations
  in order to succeed on and which intuitively occurs as a implicit subroutine in broader contexts.
  
  Decomposes into 4 function classes:
  - linear                    (1 degree,  1 variable)
  - parabola                  (2 degrees, 2 variables)
  - plane                     (1 degree,  2 variables)
  - (elliptic) paraboloid    (2 degrees, 2 variables)
  
      with coefficients drawn from restricted ranges
      (see dict `RELTYPE_INFO`), and
      where {parabola, paraboloid} have nonnegative domains,
      ie. the right ray of the x-axis or upper-right
      quadrant of the plane resp. so that the model cannot
      rely on symmetry.
  
  and independently 2 + 1 modes:
  - standard
      - A single dataset corresponding to the same polynomial.
      Evaluate on different points.
  - function
      - Multiple datasets, where each dataset instance corresponds to
      an independently sampled polynomial belonging to the same class.
      Evaluate on different (dataset, point) pairs.
  and
  - example
      - A single dataset corresponding to the same fixed representative for each class.
  
  If `overlap` is `True`:
      Train and test datapoints are drawn from the same rectilinear region
      centered at the origin (see function `select_ranges`),
      making sure to exclude the training set from the test set.
  Otherwise:
      Train datapoints are drawn from a rectilinear border region while
      test datapoints are drawn from a disjoint rectilinear interior region,
      centered at the origin (see function `select_ranges`).
  
  Example prompt for `relation_type=parabola,mode=function` with `num_function_train=num_function_test=num_train=2`:
      x,y
      1,4
      -1,2
      0,2
  
      x,y
      -1,0
      1,20
      0,8
  
      x,y
      -1,7
      1,11
      0,
class_docstr_tok: ["A","task","that","asks","the","model","to","induce","an","unknown","polynomial","at","a","point","given","a","set","of","function","evaluations",".","Unlike","pre-existing","tasks","testing","arithmetic",",","this","task","attempts","to","test","a","deeper","notion","of","numeracy","which","the","model","can","not","rely","purely","on","rote","memorization","of","standard","tables","of","arithmetic","operations","in","order","to","succeed","on","and","which","intuitively","occurs","as","a","implicit","subroutine","in","broader","contexts",".","Decomposes","into","4","function","classes",":","-","linear","(","1","degree",",","1","variable",")","-","parabola","(","2","degrees",",","2","variables",")","-","plane","(","1","degree",",","2","variables",")","-","(","elliptic",")","paraboloid","(","2","degrees",",","2","variables",")","with","coefficients","drawn","from","restricted","ranges","(","see","dict","`","RELTYPE_INFO","`",")",",","and","where","{","parabola",",","paraboloid","}","have","nonnegative","domains",",","ie",".","the","right","ray","of","the","x-axis","or","upper-right","quadrant","of","the","plane","resp",".","so","that","the","model","can","not","rely","on","symmetry",".","and","independently","2","+","1","modes",":","-","standard","-","A","single","dataset","corresponding","to","the","same","polynomial",".","Evaluate","on","different","points",".","-","function","-","Multiple","datasets",",","where","each","dataset","instance","corresponds","to","an","independently","sampled","polynomial","belonging","to","the","same","class",".","Evaluate","on","different","(","dataset",",","point",")","pairs",".","and","-","example","-","A","single","dataset","corresponding","to","the","same","fixed","representative","for","each","class",".","If","`","overlap","`","is","`","True","`",":","Train","and","test","datapoints","are","drawn","from","the","same","rectilinear","region","centered","at","the","origin","(","see","function","`","select_ranges","`",")",",","making","sure","to","exclude","the","training","set","from","the","test","set",".","Otherwise",":","Train","datapoints","are","drawn","from","a","rectilinear","border","region","while","test","datapoints","are","drawn","from","a","disjoint","rectilinear","interior","region",",","centered","at","the","origin","(","see","function","`","select_ranges","`",")",".","Example","prompt","for","`","relation_type=parabola",",","mode=function","`","with","`","num_function_train=num_function_test=num_train=2","`",":","x",",","y","1,4","-1,2","0,2","x",",","y","-1,0","1,20","0,8","x",",","y","-1,7","1,11","0",","]
code: def __init__(
      self,
      relation_type: str = "linear",
      mode: str = "function",
      seed: Optional[int] = None,
      overlap: bool = True,  # whether the in-context and eval points are drawn from the same region
      sort_vals: bool = False,  # whether to sort the in-context examples
  ):
      super().__init__()
      assert relation_type in NumeracyScenario.RELTYPES
      assert mode in NumeracyScenario.MODES
      self.random_seed = seed
  
      self.relation_type = relation_type
      self.mode = mode
      self.delimiter = NumeracyScenario.delimiter
      self.seed = seed
      self.overlap = overlap
      self.sort_vals = sort_vals
  
      self.degree: int = RELTYPE_INFO[relation_type].degree
      self.num_variables: int = RELTYPE_INFO[
          relation_type
      ].num_variables
      self.range_coeffs = RELTYPE_INFO[relation_type].range
      self.dim = self.num_variables + 1
  
      self.num_function_train = MODE_INFO[mode]["num_function_train"]
      self.num_function_test = MODE_INFO[mode]["num_function_test"]
      self.num_train = MODE_INFO[mode]["num_train"]
      self.num_test = MODE_INFO[mode]["num_test"]
  
imports: from collections import defaultdict
  from dataclasses import dataclass, field
  from itertools import combinations_with_replacement, product
  import math
  from math import comb
  import numpy
  import numpy.typing
  import random
  import sympy
  from sympy import Symbol, Poly, diff
  from sympy.parsing.sympy_parser import standard_transformations, implicit_multiplication_application
  from typing import List, Optional, Tuple, Dict
  from helm.benchmark.adaptation.adapters.adapter_factory import ADAPT_GENERATION
  from helm.benchmark.adaptation.adapter_spec import AdapterSpec
  from helm.benchmark.window_services.tokenizer_service import TokenizerService
  from helm.common.authentication import Authentication
  from helm.proxy.services.server_service import ServerService
  from .scenario import Scenario, Instance, Reference, TRAIN_SPLIT, TEST_SPLIT, CORRECT_TAG, Input, Output
label_desc: Use image node_id 1 to create a new NumeracyScenario object from inherited base classes: Scenario with example: obj = NumeracyScenario(relation_type, mode, seed, overlap, sort_vals)