





"""simple docstring"""






from sklearn.metrics import accuracy_score

import datasets


lowerCAmelCase_      =				'''
Accuracy is the proportion of correct predictions among the total number of cases processed. It can be computed with:
Accuracy = (TP + TN) / (TP + TN + FP + FN)
 Where:
TP: True positive
TN: True negative
FP: False positive
FN: False negative
'''


lowerCAmelCase_      =				'''
Args:
    predictions (`list` of `int`): Predicted labels.
    references (`list` of `int`): Ground truth labels.
    normalize (`boolean`): If set to False, returns the number of correctly classified samples. Otherwise, returns the fraction of correctly classified samples. Defaults to True.
    sample_weight (`list` of `float`): Sample weights Defaults to None.

Returns:
    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.

Examples:

    Example 1-A simple example
        >>> accuracy_metric = datasets.load_metric("accuracy")
        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0])
        >>> print(results)
        {\'accuracy\': 0.5}

    Example 2-The same as Example 1, except with `normalize` set to `False`.
        >>> accuracy_metric = datasets.load_metric("accuracy")
        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0], normalize=False)
        >>> print(results)
        {\'accuracy\': 3.0}

    Example 3-The same as Example 1, except with `sample_weight` set.
        >>> accuracy_metric = datasets.load_metric("accuracy")
        >>> 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])
        >>> print(results)
        {\'accuracy\': 0.8778625954198473}
'''


lowerCAmelCase_      =				'''
@article{scikit-learn,
  title={Scikit-learn: Machine Learning in {P}ython},
  author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.
         and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.
         and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and
         Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},
  journal={Journal of Machine Learning Research},
  volume={12},
  pages={2825--2830},
  year={2011}
}
'''



@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION      ,						_KWARGS_DESCRIPTION				)
class 						lowerCAmelCase       (   datasets.Metric				):






       def 				__A			( self  ):
              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     ,	a__     ,	a__     ,	a__=True     ,	a__=None  ):
              return {
                  "accuracy": float(
                      accuracy_score(a__     ,	a__     ,	normalize=a__     ,	sample_weight=a__  )  )
              }













"""simple docstring"""






from typing import Callable, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase_      =				logging.get_logger(__name__)

lowerCAmelCase_      =				{
    '''microsoft/prophetnet-large-uncased''': (
        '''https://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.json'''
    ),
}



class 						lowerCAmelCase       (   snake_case				):
       lowerCAmelCase__    			=	"""prophetnet"""
       lowerCAmelCase__    			=	["""past_key_values"""]
       lowerCAmelCase__    			=	{
           """num_attention_heads""": """num_encoder_attention_heads""",
       }






       def __init__( self     ,	a__ = 0.1     ,	a__ = "gelu"     ,	a__ = 3_05_22     ,	a__ = 10_24     ,	a__ = 40_96     ,	a__ = 12     ,	a__ = 16     ,	a__ = 40_96     ,	a__ = 12     ,	a__ = 16     ,	a__ = 0.1     ,	a__ = 0.1     ,	a__ = 5_12     ,	a__ = 0.02     ,	a__ = True     ,	a__ = True     ,	a__ = 0     ,	a__ = 2     ,	a__ = 32     ,	a__ = 1_28     ,	a__ = False     ,	a__ = 0.0     ,	a__ = True     ,	a__ = 0     ,	a__ = 1     ,	a__ = 2     ,	**a__     ,	):
              _UpperCAmelCase			     =  vocab_size
              _UpperCAmelCase			     =  hidden_size
              _UpperCAmelCase			     =  encoder_ffn_dim
              _UpperCAmelCase			     =  num_encoder_layers
              _UpperCAmelCase			     =  num_encoder_attention_heads
              _UpperCAmelCase			     =  decoder_ffn_dim
              _UpperCAmelCase			     =  num_decoder_layers
              _UpperCAmelCase			     =  num_decoder_attention_heads
              _UpperCAmelCase			     =  max_position_embeddings
              _UpperCAmelCase			     =  init_std  # Normal(0, this parameter)
              _UpperCAmelCase			     =  activation_function

              # parameters for prophetnet
              _UpperCAmelCase			     =  ngram
              _UpperCAmelCase			     =  num_buckets
              _UpperCAmelCase			     =  relative_max_distance
              _UpperCAmelCase			     =  disable_ngram_loss
              _UpperCAmelCase			     =  eps

              # 3 Types of Dropout
              _UpperCAmelCase			     =  attention_dropout
              _UpperCAmelCase			     =  activation_dropout
              _UpperCAmelCase			     =  dropout

              _UpperCAmelCase			     =  use_cache

              super().__init__(
                  pad_token_id=a__     ,	bos_token_id=a__     ,	eos_token_id=a__     ,	is_encoder_decoder=a__     ,	add_cross_attention=a__     ,	decoder_start_token_id=a__     ,	**a__     ,	)






       @property
       def 				__A			( self  ):
              return self.num_encoder_layers + self.num_decoder_layers






       @num_hidden_layers.setter
       def 				__A			( self     ,	a__  ):
              raise NotImplementedError(
                  'This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and'
                  ' `num_decoder_layers`.'  )






