


'''simple docstring'''






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

import datasets


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


__UpperCAmelCase     :   Union[str, Any]					       =							'''\
This metric is used to assess performance on the Mathematics Aptitude Test of Heuristics (MATH) dataset.
It first canonicalizes the inputs (e.g., converting "1/2" to "\\frac{1}{2}") and then computes accuracy.
'''


__UpperCAmelCase     :   Optional[Any]					       =							R'''
Calculates accuracy after canonicalizing inputs.

Args:
    predictions: list of predictions to score. Each prediction
        is a string that contains natural language and LaTex.
    references: list of reference for each prediction. Each
        reference is a string that contains natural language
        and LaTex.
Returns:
    accuracy: accuracy after canonicalizing inputs
        (e.g., converting "1/2" to "\\frac{1}{2}")

Examples:
    >>> metric = datasets.load_metric("competition_math")
    >>> results = metric.compute(references=["\\frac{1}{2}"], predictions=["1/2"])
    >>> print(results)
    {\'accuracy\': 1.0}
'''




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





							'''simple docstring'''






							def 						__SCREAMING_SNAKE_CASE							(	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 						__SCREAMING_SNAKE_CASE							(	self      ,					lowerCamelCase_      ,					lowerCamelCase_     ) ->							Tuple:
														lowerCAmelCase__      =			0.0
														for i, j in zip(lowerCamelCase_      ,					lowerCamelCase_     ):
																					n_correct += 1.0 if math_equivalence.is_equiv(lowerCamelCase_      ,					lowerCamelCase_     ) else 0.0
														lowerCAmelCase__      =			n_correct / len(lowerCamelCase_     )
														return {
														    "accuracy": accuracy,
														}



'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


__UpperCAmelCase					       =							{
    '''configuration_poolformer''': [
        '''POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''PoolFormerConfig''',
        '''PoolFormerOnnxConfig''',
    ]
}

try:
		if not is_vision_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__UpperCAmelCase					       =							['''PoolFormerFeatureExtractor''']
		__UpperCAmelCase					       =							['''PoolFormerImageProcessor''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__UpperCAmelCase					       =							[
		    '''POOLFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''PoolFormerForImageClassification''',
		    '''PoolFormerModel''',
		    '''PoolFormerPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_poolformer import (
		    POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    PoolFormerConfig,
		    PoolFormerOnnxConfig,
		)

		try:
				if not is_vision_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .feature_extraction_poolformer import PoolFormerFeatureExtractor
				from .image_processing_poolformer import PoolFormerImageProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_poolformer import (
				    POOLFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
				    PoolFormerForImageClassification,
				    PoolFormerModel,
				    PoolFormerPreTrainedModel,
				)


else:
		import sys

		__UpperCAmelCase					       =							_LazyModule(__name__, globals()['''__file__'''], _import_structure)