


"""simple docstring"""


from sklearn.metrics import mean_squared_error

import datasets


a					:Optional[Any]    = '\\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'

a					:List[Any]    = '\\nMean Squared Error(MSE) is the average of the square of difference between the predicted\nand actual values.\n'


a					:int    = '\nArgs:\n    predictions: array-like of shape (n_samples,) or (n_samples, n_outputs)\n        Estimated target values.\n    references: array-like of shape (n_samples,) or (n_samples, n_outputs)\n        Ground truth (correct) target values.\n    sample_weight: array-like of shape (n_samples,), default=None\n        Sample weights.\n    multioutput: {"raw_values", "uniform_average"} or array-like of shape (n_outputs,), default="uniform_average"\n        Defines aggregating of multiple output values. Array-like value defines weights used to average errors.\n\n        "raw_values" : Returns a full set of errors in case of multioutput input.\n\n        "uniform_average" : Errors of all outputs are averaged with uniform weight.\n\n    squared : bool, default=True\n        If True returns MSE value, if False returns RMSE (Root Mean Squared Error) value.\n\nReturns:\n    mse : mean squared error.\nExamples:\n\n    >>> mse_metric = datasets.load_metric("mse")\n    >>> predictions = [2.5, 0.0, 2, 8]\n    >>> references = [3, -0.5, 2, 7]\n    >>> results = mse_metric.compute(predictions=predictions, references=references)\n    >>> print(results)\n    {\'mse\': 0.375}\n    >>> rmse_result = mse_metric.compute(predictions=predictions, references=references, squared=False)\n    >>> print(rmse_result)\n    {\'mse\': 0.6123724356957945}\n\n    If you\'re using multi-dimensional lists, then set the config as follows :\n\n    >>> mse_metric = datasets.load_metric("mse", "multilist")\n    >>> predictions = [[0.5, 1], [-1, 1], [7, -6]]\n    >>> references = [[0, 2], [-1, 2], [8, -5]]\n    >>> results = mse_metric.compute(predictions=predictions, references=references)\n    >>> print(results)\n    {\'mse\': 0.7083333333333334}\n    >>> results = mse_metric.compute(predictions=predictions, references=references, multioutput=\'raw_values\')\n    >>> print(results) # doctest: +NORMALIZE_WHITESPACE\n    {\'mse\': array([0.41666667, 1. ])}\n'

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






     '''simple docstring'''

     def 					_a			(						self  )  ->      Optional[Any]:


           """simple docstring"""


           return datasets.MetricInfo(
               description=_DESCRIPTION	,    citation=_CITATION	,    inputs_description=_KWARGS_DESCRIPTION	,    features=datasets.Features(self._get_feature_types()  )	,    reference_urls=[
                   """https://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_squared_error.html"""
               ]	,    )

     def 					_a			(						self  )  ->      Optional[Any]:


           """simple docstring"""


           if self.config_name == "multilist":
                 return {
                     "predictions": datasets.Sequence(datasets.Value("""float"""  )  ),
                     "references": datasets.Sequence(datasets.Value("""float"""  )  ),
                 }
           else:
                 return {
                     "predictions": datasets.Value("""float"""  ),
                     "references": datasets.Value("""float"""  ),
                 }





     def 					_a			(						self	,    _a	,    _a	,    _a=None	,    _a="uniform_average"	,    _a=True  )  ->      Optional[int]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      int      		=	mean_squared_error(
               __A	,    __A	,    sample_weight=__A	,    multioutput=__A	,    squared=__A  )

           return {"mse": mse}







"""simple docstring"""


import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
  from .tokenization_xlnet import XLNetTokenizer
else:
  a					:List[Any]    = None


a					:Optional[int]    = logging.get_logger(__name__)

a					:Union[str, Any]    = {"vocab_file": "spiece.model", "tokenizer_file": "tokenizer.json"}

a					:Optional[int]    = {
    "vocab_file": {
        "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/spiece.model",
        "xlnet-large-cased": "https://huggingface.co/xlnet-large-cased/resolve/main/spiece.model",
    },
    "tokenizer_file": {
        "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/tokenizer.json",
        "xlnet-large-cased": "https://huggingface.co/xlnet-large-cased/resolve/main/tokenizer.json",
    },
}

a					:Dict    = {
    "xlnet-base-cased": None,
    "xlnet-large-cased": None,
}

a					:int    = "▁"

# Segments (not really needed)
a					:Dict    = 0
a					:Optional[int]    = 1
a					:Tuple    = 2
a					:List[str]    = 3
a					:Optional[Any]    = 4

class      __a							(UpperCamelCase_):






     '''simple docstring'''
     _SCREAMING_SNAKE_CASE						:Tuple       = VOCAB_FILES_NAMES
     _SCREAMING_SNAKE_CASE						:Union[str, Any]       = PRETRAINED_VOCAB_FILES_MAP
     _SCREAMING_SNAKE_CASE						:Tuple       = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     _SCREAMING_SNAKE_CASE						:str       = """left"""
     _SCREAMING_SNAKE_CASE						:Optional[Any]       = XLNetTokenizer

     def __init__(						self	,    _a=None	,    _a=None	,    _a=False	,    _a=True	,    _a=False	,    _a="<s>"	,    _a="</s>"	,    _a="<unk>"	,    _a="<sep>"	,    _a="<pad>"	,    _a="<cls>"	,    _a="<mask>"	,    _a=["<eop>", "<eod>"]	,    **_a	,    )  ->      Any:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Tuple      		=	AddedToken(_a	,    lstrip=_a	,    rstrip=_a  ) if isinstance(_a	,    _a  ) else mask_token

           super().__init__(
               vocab_file=_a	,    tokenizer_file=_a	,    do_lower_case=_a	,    remove_space=_a	,    keep_accents=_a	,    bos_token=_a	,    eos_token=_a	,    unk_token=_a	,    sep_token=_a	,    pad_token=_a	,    cls_token=_a	,    mask_token=_a	,    additional_special_tokens=_a	,    **_a	,    )

           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	3
           SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	do_lower_case
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	remove_space
           SCREAMING_SNAKE_CASE__   :      int      		=	keep_accents
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	vocab_file
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	False if not self.vocab_file else True

     def 					_a			(						self	,    _a	,    _a = None  )  ->      List[int]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      str      		=	[self.sep_token_id]
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	[self.cls_token_id]
           if token_ids_a is None:
                 return token_ids_a + sep + cls
           return token_ids_a + sep + token_ids_a + sep + cls

     def 					_a			(						self	,    _a	,    _a = None  )  ->      List[int]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Any      		=	[self.sep_token_id]
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	[2]

           if token_ids_a is None:
                 return len(token_ids_a + sep  ) * [0] + cls_segment_id
           return len(token_ids_a + sep  ) * [0] + len(token_ids_a + sep  ) * [1] + cls_segment_id





     def 					_a			(						self	,    _a	,    _a = None  )  ->      Tuple[str]:


           """simple docstring"""


           if not self.can_save_slow_tokenizer:
                 raise ValueError(
                     """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
                     """tokenizer."""  )

           if not os.path.isdir(_a  ):
                 logger.error(f'''Vocabulary path ({save_directory}) should be a directory'''  )
                 return
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	os.path.join(
               _a	,    (filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]  )

           if os.path.abspath(self.vocab_file  ) != os.path.abspath(_a  ):
                 copyfile(self.vocab_file	,    _a  )

           return (out_vocab_file,)




