
'''simple docstring'''



import math_equivalence  # From: git+https://github.com/hendrycks/math.git

import datasets


UpperCamelCase__      :		int       							=  "\\n@article{hendrycksmath2021,\n  title={Measuring Mathematical Problem Solving With the MATH Dataset},\n  author={Dan Hendrycks\n    and Collin Burns\n    and Saurav Kadavath\n    and Akul Arora\n    and Steven Basart\n    and Eric Tang\n    and Dawn Song\n    and Jacob Steinhardt},\n  journal={arXiv preprint arXiv:2103.03874},\n  year={2021}\n}\n"


UpperCamelCase__      :		Optional[Any]       							=  "\\nThis metric is used to assess performance on the Mathematics Aptitude Test of Heuristics (MATH) dataset.\nIt first canonicalizes the inputs (e.g., converting \"1/2\" to \"\\frac{1}{2}\") and then computes accuracy.\n"


UpperCamelCase__      :		int       							=  R"\nCalculates accuracy after canonicalizing inputs.\n\nArgs:\n    predictions: list of predictions to score. Each prediction\n        is a string that contains natural language and LaTex.\n    references: list of reference for each prediction. Each\n        reference is a string that contains natural language\n        and LaTex.\nReturns:\n    accuracy: accuracy after canonicalizing inputs\n        (e.g., converting \"1/2\" to \"\\frac{1}{2}\")\n\nExamples:\n    >>> metric = datasets.load_metric(\"competition_math\")\n    >>> results = metric.compute(references=[\"\\frac{1}{2}\"], predictions=[\"1/2\"])\n    >>> print(results)\n    {'accuracy': 1.0}\n"

@datasets.utils.file_utils.add_end_docstrings(_DESCRIPTION  ,					_KWARGS_DESCRIPTION)
class    _a				(datasets.Metric):





       """simple docstring"""




       def        UpperCamelCase				(							self      )    ->			List[str]:
          return datasets.MetricInfo(
              description=_DESCRIPTION       ,							citation=_CITATION       ,							inputs_description=_KWARGS_DESCRIPTION       ,							features=datasets.Features(
                  {
                      """predictions""": datasets.Value("""string"""      ),
                      """references""": datasets.Value("""string"""      ),
                  }      )       ,							homepage="""https://github.com/hendrycks/math"""       ,							codebase_urls=["""https://github.com/hendrycks/math"""]       ,							)






       def        UpperCamelCase				(							self       ,							A__       ,							A__      )    ->			Tuple:
          _SCREAMING_SNAKE_CASE      =				0.0
          for i, j in zip(A__       ,							A__      ):
             n_correct += 1.0 if math_equivalence.is_equiv(A__       ,							A__      ) else 0.0
          _SCREAMING_SNAKE_CASE      =				n_correct / len(A__      )
          return {
              "accuracy": accuracy,
          }

'''simple docstring'''



def    lowerCAmelCase_	(				SCREAMING_SNAKE_CASE_						)     ->     int:




   """simple docstring"""

   if not isinstance(SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_						):
      raise ValueError("""multiplicative_persistence() only accepts integral values"""						)
   if num < 0:
      raise ValueError("""multiplicative_persistence() does not accept negative values"""						)

   _SCREAMING_SNAKE_CASE      =				0
   _SCREAMING_SNAKE_CASE      =				str(SCREAMING_SNAKE_CASE_						)

   while len(SCREAMING_SNAKE_CASE_						) != 1:
      _SCREAMING_SNAKE_CASE      =				[int(SCREAMING_SNAKE_CASE_						) for i in num_string]

      _SCREAMING_SNAKE_CASE      =				1
      for i in range(0    ,      len(SCREAMING_SNAKE_CASE_						)						):
         total *= numbers[i]

      _SCREAMING_SNAKE_CASE      =				str(SCREAMING_SNAKE_CASE_						)

      steps += 1
   return steps
def    lowerCAmelCase_	(				SCREAMING_SNAKE_CASE_						)     ->     int:




   """simple docstring"""

   if not isinstance(SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_						):
      raise ValueError("""additive_persistence() only accepts integral values"""						)
   if num < 0:
      raise ValueError("""additive_persistence() does not accept negative values"""						)

   _SCREAMING_SNAKE_CASE      =				0
   _SCREAMING_SNAKE_CASE      =				str(SCREAMING_SNAKE_CASE_						)

   while len(SCREAMING_SNAKE_CASE_						) != 1:
      _SCREAMING_SNAKE_CASE      =				[int(SCREAMING_SNAKE_CASE_						) for i in num_string]

      _SCREAMING_SNAKE_CASE      =				0
      for i in range(0    ,      len(SCREAMING_SNAKE_CASE_						)						):
         total += numbers[i]

      _SCREAMING_SNAKE_CASE      =				str(SCREAMING_SNAKE_CASE_						)

      steps += 1
   return steps


if __name__ == "__main__":
     import doctest

     doctest.testmod()






