

from collections.abc import Iterator, MutableMapping
from dataclasses import dataclass
from typing import Generic, TypeVar

a__												=						TypeVar('''KEY''')
a__												=						TypeVar('''VAL''')

@dataclass(frozen=__lowercase							,			slots=__lowercase  )
class 							UpperCAmelCase_						(     Generic[KEY, VAL]  ):
							"""simple docstring"""







							UpperCAmelCase__			:		KEY
							UpperCAmelCase__			:		VAL



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







							def __init__(     self			)       ->       None:
												super().__init__(_a			,				_a			)




							def __bool__(     self			)       ->       bool:
												return False



a__												=						_DeletedItem()

class 							UpperCAmelCase_						(     MutableMapping[KEY, VAL]  ):
							"""simple docstring"""







							def __init__(     self			,				_a = 8			,				_a = 0.75			)       ->       None:
												_a      :       Tuple   =						initial_block_size
												_a      :       list[_Item | None]   =						[None] * initial_block_size
												assert 0.0 < capacity_factor < 1.0
												_a      :       Tuple   =						capacity_factor
												_a      :       Optional[Any]   =						0


							def 							__lowercase							(     self			,				_a			)       ->       int:
												return hash(_a			) % len(self._buckets			)


							def 							__lowercase							(     self			,				_a			)       ->       int:
												return (ind + 1) % len(self._buckets			)


							def 							__lowercase							(     self			,				_a			,				_a			,				_a			)       ->       bool:
												_a      :       int   =						self._buckets[ind]
												if not stored:
																	_a      :       Dict   =						_Item(_a			,				_a			)
																	self._len += 1
																	return True
												elif stored.key == key:
																	_a      :       int   =						_Item(_a			,				_a			)
																	return True
												else:
																	return False


							def 							__lowercase							(     self			)       ->       bool:
												_a      :       Optional[int]   =						len(self._buckets			) * self._capacity_factor
												return len(self			) >= int(_a			)


							def 							__lowercase							(     self			)       ->       bool:
												if len(self._buckets			) <= self._initial_block_size:
																	return False
												_a      :       Optional[Any]   =						len(self._buckets			) * self._capacity_factor / 2
												return len(self			) < limit


							def 							__lowercase							(     self			,				_a			)       ->       None:
												_a      :       Optional[Any]   =						self._buckets
												_a      :       Dict   =						[None] * new_size
												_a      :       int   =						0
												for item in old_buckets:
																	if item:
																						self._add_item(item.key			,				item.val			)


							def 							__lowercase							(     self			)       ->       None:
												self._resize(len(self._buckets			) * 2			)


							def 							__lowercase							(     self			)       ->       None:
												self._resize(len(self._buckets			) // 2			)


							def 							__lowercase							(     self			,				_a			)       ->       Iterator[int]:
												_a      :       Union[str, Any]   =						self._get_bucket_index(_a			)
												for _ in range(len(self._buckets			)			):
																	yield ind
																	_a      :       Dict   =						self._get_next_ind(_a			)


							def 							__lowercase							(     self			,				_a			,				_a			)       ->       None:
												for ind in self._iterate_buckets(_a			):
																	if self._try_set(_a			,				_a			,				_a			):
																						break


							def __setitem__(     self			,				_a			,				_a			)       ->       None:
												if self._is_full():
																	self._size_up()

												self._add_item(_a			,				_a			)


							def __delitem__(     self			,				_a			)       ->       None:
												for ind in self._iterate_buckets(_a			):
																	_a      :       List[Any]   =						self._buckets[ind]
																	if item is None:
																						raise KeyError(_a			)
																	if item is _deleted:
																						continue
																	if item.key == key:
																						_a      :       Any   =						_deleted
																						self._len -= 1
																						break
												if self._is_sparse():
																	self._size_down()


							def __getitem__(     self			,				_a			)       ->       VAL:
												for ind in self._iterate_buckets(_a			):
																	_a      :       int   =						self._buckets[ind]
																	if item is None:
																						break
																	if item is _deleted:
																						continue
																	if item.key == key:
																						return item.val
												raise KeyError(_a			)


							def __len__(     self			)       ->       int:
												return self._len


							def __iter__(     self			)       ->       Iterator[KEY]:
												yield from (item.key for item in self._buckets if item)




							def __repr__(     self			)       ->       str:
												_a      :       str   =						''' ,'''.join(
												    F"""{item.key}: {item.val}""" for item in self._buckets if item			)
												return F"""HashMap({val_string})"""






from scipy.stats import spearmanr

import datasets


a__												=						'''
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.
'''

a__												=						'''
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
'''

a__												=						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 							UpperCAmelCase_						(     datasets.Metric  ):
							"""simple docstring"""







							def 							__lowercase							(     self			)       ->       int:
												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			,				_a			,				_a			,				_a=False			)       ->       str:
												_a      :       int   =						spearmanr(_a			,				_a			)
												if return_pvalue:
																	return {"spearmanr": results[0], "spearmanr_pvalue": results[1]}
												else:
																	return {"spearmanr": results[0]}



