
from sklearn.metrics import matthews_corrcoef

import datasets


A     :	int    = '\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifications. It takes\ninto account true and false positives and negatives and is generally\nregarded as a balanced measure which can be used even if the classes are of\nvery different sizes. The MCC is in essence a correlation coefficient value\nbetween -1 and +1. A coefficient of +1 represents a perfect prediction, 0\nan average random prediction and -1 an inverse prediction.  The statistic\nis also known as the phi coefficient. [source: Wikipedia]\n'

A     :	Dict    = '\nArgs:\n    predictions (list of int): Predicted labels, as returned by a model.\n    references (list of int): Ground truth labels.\n    sample_weight (list of int, float, or bool): Sample weights. Defaults to `None`.\nReturns:\n    matthews_correlation (dict containing float): Matthews correlation.\nExamples:\n    Example 1, a basic example with only predictions and references as inputs:\n        >>> matthews_metric = datasets.load_metric("matthews_correlation")\n        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],\n        ...                                     predictions=[1, 2, 2, 0, 3, 3])\n        >>> print(round(results[\'matthews_correlation\'], 2))\n        0.54\n\n    Example 2, the same example as above, but also including sample weights:\n        >>> matthews_metric = datasets.load_metric("matthews_correlation")\n        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],\n        ...                                     predictions=[1, 2, 2, 0, 3, 3],\n        ...                                     sample_weight=[0.5, 3, 1, 1, 1, 2])\n        >>> print(round(results[\'matthews_correlation\'], 2))\n        0.1\n\n    Example 3, the same example as above, but with sample weights that cause a negative correlation:\n        >>> matthews_metric = datasets.load_metric("matthews_correlation")\n        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],\n        ...                                     predictions=[1, 2, 2, 0, 3, 3],\n        ...                                     sample_weight=[0.5, 1, 0, 0, 0, 1])\n        >>> print(round(results[\'matthews_correlation\'], 2))\n        -0.25\n'

A     :	Optional[int]    = '\\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 				SCREAMING_SNAKE_CASE_		(     self				)    ->      Any:


								'''simple docstring'''




								return datasets.MetricInfo(
								    description=_DESCRIPTION		,     citation=_CITATION		,     inputs_description=_KWARGS_DESCRIPTION		,     features=datasets.Features(
								        {
								            '''predictions''': datasets.Value('''int32'''				),
								            '''references''': datasets.Value('''int32'''				),
								        }				)		,     reference_urls=[
								        '''https://scikit-learn.org/stable/modules/generated/sklearn.metrics.matthews_corrcoef.html'''
								    ]		,     )




				def 				SCREAMING_SNAKE_CASE_		(     self		,     _snake_case		,     _snake_case		,     _snake_case=None				)    ->      Any:


								'''simple docstring'''




								return {
								    "matthews_correlation": float(matthews_corrcoef(_snake_case		,     _snake_case		,     sample_weight=_snake_case				)				),
								}




'''simple docstring'''





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoFormerTokenizer
from .tokenization_utils import JiebaPreTokenizer


__a          =		logging.get_logger(__name__)

__a          =		{"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

__a          =		{
    "vocab_file": {
        "junnyu/roformer_chinese_small": "https://huggingface.co/junnyu/roformer_chinese_small/resolve/main/vocab.txt",
        "junnyu/roformer_chinese_base": "https://huggingface.co/junnyu/roformer_chinese_base/resolve/main/vocab.txt",
        "junnyu/roformer_chinese_char_small": (
            "https://huggingface.co/junnyu/roformer_chinese_char_small/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_chinese_char_base": (
            "https://huggingface.co/junnyu/roformer_chinese_char_base/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_small_discriminator": (
            "https://huggingface.co/junnyu/roformer_small_discriminator/resolve/main/vocab.txt"
        ),
        "junnyu/roformer_small_generator": (
            "https://huggingface.co/junnyu/roformer_small_generator/resolve/main/vocab.txt"
        ),
    }
}

__a          =		{
    "junnyu/roformer_chinese_small": 1536,
    "junnyu/roformer_chinese_base": 1536,
    "junnyu/roformer_chinese_char_small": 512,
    "junnyu/roformer_chinese_char_base": 512,
    "junnyu/roformer_small_discriminator": 128,
    "junnyu/roformer_small_generator": 128,
}


__a          =		{
    "junnyu/roformer_chinese_small": {"do_lower_case": True},
    "junnyu/roformer_chinese_base": {"do_lower_case": True},
    "junnyu/roformer_chinese_char_small": {"do_lower_case": True},
    "junnyu/roformer_chinese_char_base": {"do_lower_case": True},
    "junnyu/roformer_small_discriminator": {"do_lower_case": True},
    "junnyu/roformer_small_generator": {"do_lower_case": True},
}







class     UpperCAmelCase_       (       _a	):
    """simple docstring"""







    lowercase					=		VOCAB_FILES_NAMES
    lowercase					=		PRETRAINED_VOCAB_FILES_MAP
    lowercase					=		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    lowercase					=		PRETRAINED_INIT_CONFIGURATION
    lowercase					=		RoFormerTokenizer




    def __init__(    self					:     List[Any] ,     snake_case_					:     List[str]=None ,     snake_case_					:     Dict=None ,     snake_case_					:     Any=True ,     snake_case_					:     str="[UNK]" ,     snake_case_					:     List[str]="[SEP]" ,     snake_case_					:     Optional[Any]="[PAD]" ,     snake_case_					:     Union[str, Any]="[CLS]" ,     snake_case_					:     Union[str, Any]="[MASK]" ,     snake_case_					:     List[Any]=True ,     snake_case_					:     Optional[Any]=None ,     **snake_case_					:     Tuple ,     ):
          super().__init__(
              snake_case_ ,     tokenizer_file=snake_case_ ,     do_lower_case=snake_case_ ,     unk_token=snake_case_ ,     sep_token=snake_case_ ,     pad_token=snake_case_ ,     cls_token=snake_case_ ,     mask_token=snake_case_ ,     tokenize_chinese_chars=snake_case_ ,     strip_accents=snake_case_ ,     **snake_case_ ,     )

          snake_case__  :    str    						=      json.loads(self.backend_tokenizer.normalizer.__getstate__()						)
          if (
              pre_tok_state.get("""lowercase""" ,     snake_case_						) != do_lower_case
              or pre_tok_state.get("""strip_accents""" ,     snake_case_						) != strip_accents
          ):
                snake_case__  :    str    						=      getattr(snake_case_ ,     pre_tok_state.pop("""type"""						)						)
                snake_case__  :    Optional[int]    						=      do_lower_case
                snake_case__  :    Union[str, Any]    						=      strip_accents
                snake_case__  :    Union[str, Any]    						=      pre_tok_class(**snake_case_						)

          snake_case__  :    str    						=      do_lower_case




    def __getstate__(    self					:     int						):
          snake_case__  :    List[Any]    						=      self.__dict__.copy()
          snake_case__  :    str    						=      BertPreTokenizer()
          return state




    def __setstate__(    self					:     Dict ,     snake_case_					:     Dict						):
          snake_case__  :    List[Any]    						=      d
          snake_case__  :    Union[str, Any]    						=      self.__dict__["""_tokenizer"""].get_vocab()
          snake_case__  :    List[Any]    						=      PreTokenizer.custom(JiebaPreTokenizer(snake_case_						)						)




    def lowerCamelCase       (    self					:     str ,     snake_case_					:     Optional[Any] ,     snake_case_					:     List[str]=None						):
          snake_case__  :    str    						=      [self.cls_token_id] + token_ids_a + [self.sep_token_id]

          if token_ids_a:
                output += token_ids_a + [self.sep_token_id]

          return output




    def lowerCamelCase       (    self					:     str ,     snake_case_					:     List[int] ,     snake_case_					:     Optional[List[int]] = None						):
          snake_case__  :    int    						=      [self.sep_token_id]
          snake_case__  :    str    						=      [self.cls_token_id]
          if token_ids_a is None:
                return len(cls + token_ids_a + sep						) * [0]
          return len(cls + token_ids_a + sep						) * [0] + len(token_ids_a + sep						) * [1]




    def lowerCamelCase       (    self					:     Dict ,     snake_case_					:     str ,     snake_case_					:     Optional[str] = None						):
          snake_case__  :    Union[str, Any]    						=      self._tokenizer.model.save(snake_case_ ,     name=snake_case_						)
          return tuple(snake_case_						)




    def lowerCamelCase       (    self					:     Dict ,     snake_case_					:     List[str] ,     snake_case_					:     Tuple=None ,     snake_case_					:     List[str]=None ,     snake_case_					:     Union[str, Any]=False ,     **snake_case_					:     Tuple ,     ):
          snake_case__  :    Optional[Any]    						=      BertPreTokenizer()
          return super().save_pretrained(snake_case_ ,     snake_case_ ,     snake_case_ ,     snake_case_ ,     **snake_case_						)
