




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

import datasets


__a							     =					'\\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'


__a							     =					'\\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'


__a							     =					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 				a__ ( self    )					->						Union[str, Any]:
         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 				a__ ( self  ,_SCREAMING_SNAKE_CASE  ,_SCREAMING_SNAKE_CASE    )					->						Dict:
         UpperCAmelCase_     :				List[Any]  =     0.0
         for i, j in zip(_SCREAMING_SNAKE_CASE  ,_SCREAMING_SNAKE_CASE    ):
              n_correct += 1.0 if math_equivalence.is_equiv(_SCREAMING_SNAKE_CASE  ,_SCREAMING_SNAKE_CASE    ) else 0.0
         UpperCAmelCase_     :				str  =     n_correct / len(_SCREAMING_SNAKE_CASE    )
         return {
             "accuracy": accuracy,
         }





import warnings

from ...utils import logging
from .image_processing_clip import CLIPImageProcessor


__a							     =					logging.get_logger(__name__)

class     __a(	_a  ):






    """simple docstring"""





    def __init__( self  ,*_SCREAMING_SNAKE_CASE  ,**_SCREAMING_SNAKE_CASE    )					->						None:
         warnings.warn(
             '''The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'''
             ''' use CLIPImageProcessor instead.'''  ,_SCREAMING_SNAKE_CASE  ,)
         super().__init__(*_SCREAMING_SNAKE_CASE  ,**_SCREAMING_SNAKE_CASE    )