
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 importlib
import shutil
import threading
import warnings
from typing import List

import fsspec
import fsspec.asyn

from . import compression
from .hffilesystem import HfFileSystem


_SCREAMING_SNAKE_CASE					:				Any					    =						importlib.util.find_spec('''s3fs''') is not None

if _has_safs:
  from .safilesystem import SaFileSystem  # noqa: F401

_SCREAMING_SNAKE_CASE					:				List[compression.BaseCompressedFileFileSystem]					    =						[
    compression.BzaFileSystem,
    compression.GzipFileSystem,
    compression.LzaFileSystem,
    compression.XzFileSystem,
    compression.ZstdFileSystem,
]

# Register custom filesystems
for fs_class in COMPRESSION_FILESYSTEMS + [HfFileSystem]:
  if fs_class.protocol in fsspec.registry and fsspec.registry[fs_class.protocol] is not fs_class:
    warnings.warn(F'''A filesystem protocol was already set for {fs_class.protocol} and will be overwritten.''')
  fsspec.register_implementation(fs_class.protocol, fs_class, clobber=True)







def      lowerCamelCase__       (							_lowerCamelCase       :		str )      ->				str:
  if "://" in dataset_path:
    lowerCamelCase_         =						dataset_path.split('://' )[1]
  return dataset_path







def      lowerCamelCase__       (							_lowerCamelCase       :		fsspec.AbstractFileSystem )      ->				bool:
  if fs is not None and fs.protocol != "file":
    return True
  else:
    return False







def      lowerCamelCase__       (							_lowerCamelCase       :		fsspec.AbstractFileSystem		,				_lowerCamelCase       :		str		,				_lowerCamelCase       :		str )      ->				int:
  lowerCamelCase_         =						not is_remote_filesystem(_lowerCamelCase )
  if is_local:
    # LocalFileSystem.mv does copy + rm, it is more efficient to simply move a local directory
    shutil.move(fs._strip_protocol(_lowerCamelCase )		,				fs._strip_protocol(_lowerCamelCase ) )
  else:
    fs.mv(_lowerCamelCase		,				_lowerCamelCase		,				recursive=_lowerCamelCase )







def      lowerCamelCase__       (							)      ->				None:
  if hasattr(fsspec.asyn		,				'reset_lock' ):
    # for future fsspec>2022.05.0
    fsspec.asyn.reset_lock()
  else:
    lowerCamelCase_         =						None
    lowerCamelCase_         =						None
    lowerCamelCase_         =						threading.Lock()




