



"""simple docstring"""





from scipy.stats import spearmanr

import datasets


lowerCamelCase      =		"""
The Spearman rank-order correlation coefficient is a measure of the
relationship between two datasets. Like other correlation coefficients,
this one varies between -1 and +1 with 0 implying no correlation.
Positive correlations imply that as data in dataset x increases, so
does data in dataset y. Negative correlations imply that as x increases,
y decreases. Correlations of -1 or +1 imply an exact monotonic relationship.

Unlike the Pearson correlation, the Spearman correlation does not
assume that both datasets are normally distributed.

The p-value roughly indicates the probability of an uncorrelated system
producing datasets that have a Spearman correlation at least as extreme
as the one computed from these datasets. The p-values are not entirely
reliable but are probably reasonable for datasets larger than 500 or so.
"""

lowerCamelCase      =		"""
Args:
    predictions (`List[float]`): Predicted labels, as returned by a model.
    references (`List[float]`): Ground truth labels.
    return_pvalue (`bool`): If `True`, returns the p-value. If `False`, returns
            only the spearmanr score. Defaults to `False`.
Returns:
    spearmanr (`float`): Spearman correlation coefficient.
    p-value (`float`): p-value. **Note**: is only returned if `return_pvalue=True` is input.
Examples:
    Example 1:
        >>> spearmanr_metric = datasets.load_metric(\"spearmanr\")
        >>> results = spearmanr_metric.compute(references=[1, 2, 3, 4, 5], predictions=[10, 9, 2.5, 6, 4])
        >>> print(results)
        {'spearmanr': -0.7}

    Example 2:
        >>> spearmanr_metric = datasets.load_metric(\"spearmanr\")
        >>> results = spearmanr_metric.compute(references=[1, 2, 3, 4, 5],
        ...                                     predictions=[10, 9, 2.5, 6, 4],
        ...                                     return_pvalue=True)
        >>> print(results['spearmanr'])
        -0.7
        >>> print(round(results['spearmanr_pvalue'], 2))
        0.19
"""

lowerCamelCase      =		r"""\
@book{kokoska2000crc,
  title={CRC standard probability and statistics tables and formulae},
  author={Kokoska, Stephen and Zwillinger, Daniel},
  year={2000},
  publisher={Crc Press}
}
@article{2020SciPy-NMeth,
  author  = {Virtanen, Pauli and Gommers, Ralf and Oliphant, Travis E. and
            Haberland, Matt and Reddy, Tyler and Cournapeau, David and
            Burovski, Evgeni and Peterson, Pearu and Weckesser, Warren and
            Bright, Jonathan and {van der Walt}, St{\'e}fan J. and
            Brett, Matthew and Wilson, Joshua and Millman, K. Jarrod and
            Mayorov, Nikolay and Nelson, Andrew R. J. and Jones, Eric and
            Kern, Robert and Larson, Eric and Carey, C J and
            Polat, {\.I}lhan and Feng, Yu and Moore, Eric W. and
            {VanderPlas}, Jake and Laxalde, Denis and Perktold, Josef and
            Cimrman, Robert and Henriksen, Ian and Quintero, E. A. and
            Harris, Charles R. and Archibald, Anne M. and
            Ribeiro, Ant{\^o}nio H. and Pedregosa, Fabian and
            {van Mulbregt}, Paul and {SciPy 1.0 Contributors}},
  title   = {{{SciPy} 1.0: Fundamental Algorithms for Scientific
            Computing in Python}},
  journal = {Nature Methods},
  year    = {2020},
  volume  = {17},
  pages   = {261--272},
  adsurl  = {https://rdcu.be/b08Wh},
  doi     = {10.1038/s41592-019-0686-2},
}
"""
@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION       ,      _KWARGS_DESCRIPTION   )
class    lowercase__     (					datasets.Metric   ):







							'''simple docstring'''


							def   lowercase__       (							self    :						Tuple					)				->		Dict:


													'''simple docstring'''




													return datasets.MetricInfo(
													    description=_DESCRIPTION	,       citation=_CITATION	,       inputs_description=_KWARGS_DESCRIPTION	,       features=datasets.Features(
													        {
													            "predictions": datasets.Value("float"					),
													            "references": datasets.Value("float"					),
													        }					)	,       reference_urls=["https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.spearmanr.html"]	,       )







							def   lowercase__       (							self    :						str	,       _UpperCAmelCase    :						Tuple	,       _UpperCAmelCase    :						Tuple	,       _UpperCAmelCase    :						Optional[int]=False					)				->		List[str]:


													'''simple docstring'''




													UpperCAmelCase_    				=							spearmanr(_UpperCAmelCase	,       _UpperCAmelCase					)
													if return_pvalue:
																			return {"spearmanr": results[0], "spearmanr_pvalue": results[1]}
													else:
																			return {"spearmanr": results[0]}









"""simple docstring"""





from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCamelCase      =		logging.get_logger(__name__)

lowerCamelCase      =		{
    """YituTech/conv-bert-base""": """https://huggingface.co/YituTech/conv-bert-base/resolve/main/config.json""",
    """YituTech/conv-bert-medium-small""": (
        """https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/config.json"""
    ),
    """YituTech/conv-bert-small""": """https://huggingface.co/YituTech/conv-bert-small/resolve/main/config.json""",
    # See all ConvBERT models at https://huggingface.co/models?filter=convbert
}
class    lowercase__     (					SCREAMING_SNAKE_CASE   ):







       '''simple docstring'''


       UpperCamelCase		=  '''convbert'''



       def __init__(							self    :						Any	,       _UpperCAmelCase    :						Optional[int]=30522	,       _UpperCAmelCase    :						Tuple=768	,       _UpperCAmelCase    :						Optional[int]=12	,       _UpperCAmelCase    :						Dict=12	,       _UpperCAmelCase    :						Any=3072	,       _UpperCAmelCase    :						Dict="gelu"	,       _UpperCAmelCase    :						Optional[int]=0.1	,       _UpperCAmelCase    :						str=0.1	,       _UpperCAmelCase    :						Tuple=512	,       _UpperCAmelCase    :						Optional[Any]=2	,       _UpperCAmelCase    :						Union[str, Any]=0.02	,       _UpperCAmelCase    :						Dict=1e-12	,       _UpperCAmelCase    :						Optional[int]=1	,       _UpperCAmelCase    :						int=0	,       _UpperCAmelCase    :						Optional[Any]=2	,       _UpperCAmelCase    :						List[Any]=768	,       _UpperCAmelCase    :						Optional[int]=2	,       _UpperCAmelCase    :						str=9	,       _UpperCAmelCase    :						List[Any]=1	,       _UpperCAmelCase    :						Optional[Any]=None	,       **_UpperCAmelCase    :						str	,       )				->		List[Any]:


             '''simple docstring'''




             super().__init__(
                 pad_token_id=_UpperCAmelCase	,       bos_token_id=_UpperCAmelCase	,       eos_token_id=_UpperCAmelCase	,       **_UpperCAmelCase	,       )

             UpperCAmelCase_    				=							vocab_size
             UpperCAmelCase_    				=							hidden_size
             UpperCAmelCase_    				=							num_hidden_layers
             UpperCAmelCase_    				=							num_attention_heads
             UpperCAmelCase_    				=							intermediate_size
             UpperCAmelCase_    				=							hidden_act
             UpperCAmelCase_    				=							hidden_dropout_prob
             UpperCAmelCase_    				=							attention_probs_dropout_prob
             UpperCAmelCase_    				=							max_position_embeddings
             UpperCAmelCase_    				=							type_vocab_size
             UpperCAmelCase_    				=							initializer_range
             UpperCAmelCase_    				=							layer_norm_eps
             UpperCAmelCase_    				=							embedding_size
             UpperCAmelCase_    				=							head_ratio
             UpperCAmelCase_    				=							conv_kernel_size
             UpperCAmelCase_    				=							num_groups
             UpperCAmelCase_    				=							classifier_dropout



class    lowercase__     (					SCREAMING_SNAKE_CASE   ):







       '''simple docstring'''


       @property
       def   lowercase__       (							self    :						Dict					)				->		Mapping[str, Mapping[int, str]]:


             '''simple docstring'''




             if self.task == "multiple-choice":
                   UpperCAmelCase_    				=							{0: "batch", 1: "choice", 2: "sequence"}
             else:
                   UpperCAmelCase_    				=							{0: "batch", 1: "sequence"}
             return OrderedDict(
                 [
                     ("input_ids", dynamic_axis),
                     ("attention_mask", dynamic_axis),
                     ("token_type_ids", dynamic_axis),
                 ]					)




