code: 
  
  
  
  
  
  from sklearn.metrics import accuracy_score
  
  import datasets
  
  
  lowerCAmelCase_   =   "\nAccuracy is the proportion of correct predictions among the total number of cases processed. It can be computed with:\nAccuracy = (TP + TN) / (TP + TN + FP + FN)\n Where:\nTP: True positive\nTN: True negative\nFP: False positive\nFN: False negative\n"
  
  
  lowerCAmelCase_   =   "\nArgs:\n    predictions (`list` of `int`): Predicted labels.\n    references (`list` of `int`): Ground truth labels.\n    normalize (`boolean`): If set to False, returns the number of correctly classified samples. Otherwise, returns the fraction of correctly classified samples. Defaults to True.\n    sample_weight (`list` of `float`): Sample weights Defaults to None.\n\nReturns:\n    accuracy (`float` or `int`): Accuracy score. Minimum possible value is 0. Maximum possible value is 1.0, or the number of examples input, if `normalize` is set to `True`.. A higher score means higher accuracy.\n\nExamples:\n\n    Example 1-A simple example\n        >>> accuracy_metric = datasets.load_metric(\"accuracy\")\n        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0])\n        >>> print(results)\n        {\'accuracy\': 0.5}\n\n    Example 2-The same as Example 1, except with `normalize` set to `False`.\n        >>> accuracy_metric = datasets.load_metric(\"accuracy\")\n        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0], normalize=False)\n        >>> print(results)\n        {\'accuracy\': 3.0}\n\n    Example 3-The same as Example 1, except with `sample_weight` set.\n        >>> accuracy_metric = datasets.load_metric(\"accuracy\")\n        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0], sample_weight=[0.5, 2, 0.7, 0.5, 9, 0.4])\n        >>> print(results)\n        {\'accuracy\': 0.8778625954198473}\n"
  
  
  lowerCAmelCase_   =   "\n@article{scikit-learn,\n  title={Scikit-learn: Machine Learning in {P}ython},\n  author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n         and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.\n         and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and\n         Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},\n  journal={Journal of Machine Learning Research},\n  volume={12},\n  pages={2825--2830},\n  year={2011}\n}\n"
  
  @datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION       ,_KWARGS_DESCRIPTION				)
  class 				A    (datasets.Metric				):
  
  
  
        def    __a (					self					)      ->   Union[str, Any]:
  
  
  
               '''simple docstring'''
  
               return datasets.MetricInfo(
                   description=_DESCRIPTION     ,  citation=_CITATION     ,  inputs_description=_KWARGS_DESCRIPTION     ,  features=datasets.Features(
                       {
                           '''predictions''': datasets.Sequence(datasets.Value('''int32'''					)					),
                           '''references''': datasets.Sequence(datasets.Value('''int32'''					)					),
                       }
                       if self.config_name == '''multilabel'''
                       else {
                           '''predictions''': datasets.Value('''int32'''					),
                           '''references''': datasets.Value('''int32'''					),
                       }					)     ,  reference_urls=['''https://scikit-learn.org/stable/modules/generated/sklearn.metrics.accuracy_score.html''']     ,  )
  
  
  
        def    __a (					self     ,  lowercase_     ,  lowercase_     ,  lowercase_=True     ,  lowercase_=None					)      ->   Optional[int]:
  
  
  
               '''simple docstring'''
  
               return {
                   "accuracy": float(
                       accuracy_score(lowercase_     ,  lowercase_     ,  normalize=lowercase_     ,  sample_weight=lowercase_					)					)
               }
  
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  import unittest
  
  import numpy as np
  
  from transformers.testing_utils import require_torch, require_vision
  from transformers.utils import is_torch_available, is_vision_available
  
  from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
  
  
  if is_torch_available():
     import torch
  
  if is_vision_available():
     from PIL import Image
  
     from transformers import ConvNextImageProcessor
  
  class 				A    (unittest.TestCase				):
  
  
  
        def __init__(					self     ,  lowercase_     ,  lowercase_=7     ,  lowercase_=3     ,  lowercase_=18     ,  lowercase_=30     ,  lowercase_=400     ,  lowercase_=True     ,  lowercase_=None     ,  lowercase_=0.875     ,  lowercase_=True     ,  lowercase_=[0.5, 0.5, 0.5]     ,  lowercase_=[0.5, 0.5, 0.5]     ,  )      ->   List[str]:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Tuple     				=						size if size is not None else {'''shortest_edge''': 20}
               _snake_case      :							List[Any]     				=						parent
               _snake_case      :							Optional[int]     				=						batch_size
               _snake_case      :							str     				=						num_channels
               _snake_case      :							Union[str, Any]     				=						image_size
               _snake_case      :							Optional[Any]     				=						min_resolution
               _snake_case      :							Union[str, Any]     				=						max_resolution
               _snake_case      :							Tuple     				=						do_resize
               _snake_case      :							List[Any]     				=						size
               _snake_case      :							Optional[int]     				=						crop_pct
               _snake_case      :							Any     				=						do_normalize
               _snake_case      :							Optional[int]     				=						image_mean
               _snake_case      :							Union[str, Any]     				=						image_std
  
  
  
        def    __a (					self					)      ->   str:
  
  
  
               '''simple docstring'''
  
               return {
                   "image_mean": self.image_mean,
                   "image_std": self.image_std,
                   "do_normalize": self.do_normalize,
                   "do_resize": self.do_resize,
                   "size": self.size,
                   "crop_pct": self.crop_pct,
               }
  
  
  @require_torch
  @require_vision
  class 				A    (__UpperCAmelCase       ,unittest.TestCase				):
        _SCREAMING_SNAKE_CASE					=							ConvNextImageProcessor if is_vision_available() else None
  
  
  
        def    __a (					self					)      ->   Dict:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							List[Any]     				=						ConvNextImageProcessingTester(self					)
  
  
  
        @property
        def    __a (					self					)      ->   Dict:
  
  
  
               '''simple docstring'''
  
               return self.image_processor_tester.prepare_image_processor_dict()
  
  
  
        def    __a (					self					)      ->   str:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							List[Any]     				=						self.image_processing_class(**self.image_processor_dict					)
               self.assertTrue(hasattr(lowercase_     ,  '''do_resize'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''size'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''crop_pct'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''do_normalize'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''image_mean'''					)					)
               self.assertTrue(hasattr(lowercase_     ,  '''image_std'''					)					)
  
  
  
        def    __a (					self					)      ->   List[Any]:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							int     				=						self.image_processing_class.from_dict(self.image_processor_dict					)
               self.assertEqual(image_processor.size     ,  {'''shortest_edge''': 20}					)
  
               _snake_case      :							Tuple     				=						self.image_processing_class.from_dict(self.image_processor_dict     ,  size=42					)
               self.assertEqual(image_processor.size     ,  {'''shortest_edge''': 42}					)
  
  
  
        def    __a (					self					)      ->   List[Any]:
  
  
  
               '''simple docstring'''
  
               pass
  
  
  
        def    __a (					self					)      ->   int:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Tuple     				=						self.image_processing_class(**self.image_processor_dict					)
               # create random PIL images
               _snake_case      :							List[str]     				=						prepare_image_inputs(self.image_processor_tester     ,  equal_resolution=lowercase_					)
               for image in image_inputs:
                      self.assertIsInstance(lowercase_     ,  Image.Image					)
  
               # Test not batched input
               _snake_case      :							List[str]     				=						image_processing(image_inputs[0]     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       1,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.size['''shortest_edge'''],
                       self.image_processor_tester.size['''shortest_edge'''],
                   )     ,  )
  
               # Test batched
               _snake_case      :							int     				=						image_processing(lowercase_     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       self.image_processor_tester.batch_size,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.size['''shortest_edge'''],
                       self.image_processor_tester.size['''shortest_edge'''],
                   )     ,  )
  
  
  
        def    __a (					self					)      ->   Dict:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Tuple     				=						self.image_processing_class(**self.image_processor_dict					)
               # create random numpy tensors
               _snake_case      :							Tuple     				=						prepare_image_inputs(self.image_processor_tester     ,  equal_resolution=lowercase_     ,  numpify=lowercase_					)
               for image in image_inputs:
                      self.assertIsInstance(lowercase_     ,  np.ndarray					)
  
               # Test not batched input
               _snake_case      :							List[str]     				=						image_processing(image_inputs[0]     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       1,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.size['''shortest_edge'''],
                       self.image_processor_tester.size['''shortest_edge'''],
                   )     ,  )
  
               # Test batched
               _snake_case      :							Union[str, Any]     				=						image_processing(lowercase_     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       self.image_processor_tester.batch_size,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.size['''shortest_edge'''],
                       self.image_processor_tester.size['''shortest_edge'''],
                   )     ,  )
  
  
  
        def    __a (					self					)      ->   Union[str, Any]:
  
  
  
               '''simple docstring'''
  
               _snake_case      :							Union[str, Any]     				=						self.image_processing_class(**self.image_processor_dict					)
               # create random PyTorch tensors
               _snake_case      :							Dict     				=						prepare_image_inputs(self.image_processor_tester     ,  equal_resolution=lowercase_     ,  torchify=lowercase_					)
               for image in image_inputs:
                      self.assertIsInstance(lowercase_     ,  torch.Tensor					)
  
               # Test not batched input
               _snake_case      :							Union[str, Any]     				=						image_processing(image_inputs[0]     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       1,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.size['''shortest_edge'''],
                       self.image_processor_tester.size['''shortest_edge'''],
                   )     ,  )
  
               # Test batched
               _snake_case      :							List[Any]     				=						image_processing(lowercase_     ,  return_tensors='''pt'''					).pixel_values
               self.assertEqual(
                   encoded_images.shape     ,  (
                       self.image_processor_tester.batch_size,
                       self.image_processor_tester.num_channels,
                       self.image_processor_tester.size['''shortest_edge'''],
                       self.image_processor_tester.size['''shortest_edge'''],
                   )     ,  )
  
  
  
  
  
  
  