





"""simple docstring"""






from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__UpperCAmelCase						=			logging.get_logger(__name__)

__UpperCAmelCase						=			{
    '''microsoft/focalnet-tiny''': '''https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json''',
}



class 					__UpperCAmelCase							(						_UpperCamelCase						,  _UpperCamelCase  ):
				__lowerCamelCase				:	int				     =				"focalnet"
				def __init__(		self    :			List[Any]	, a_    :			Optional[int]=2_24	, a_    :			int=4	, a_    :			Tuple=3	, a_    :			Tuple=96	, a_    :			Tuple=False	, a_    :			int=[1_92, 3_84, 7_68, 7_68]	, a_    :			str=[2, 2, 6, 2]	, a_    :			Optional[int]=[2, 2, 2, 2]	, a_    :			Optional[int]=[3, 3, 3, 3]	, a_    :			Optional[Any]="gelu"	, a_    :			List[str]=4.0	, a_    :			Any=0.0	, a_    :			int=0.1	, a_    :			Union[str, Any]=False	, a_    :			Optional[Any]=1E-4	, a_    :			List[Any]=False	, a_    :			Optional[Any]=False	, a_    :			Any=False	, a_    :			Any=0.02	, a_    :			Dict=1E-5	, a_    :			str=32	, a_    :			List[str]=None	, a_    :			List[Any]=None	, **a_    :			Union[str, Any]	, )	->	str:



							'''simple docstring'''



							super().__init__(**a_    )

							a__  :	str		 =			image_size
							a__  :	Union[str, Any]		 =			patch_size
							a__  :	Optional[Any]		 =			num_channels
							a__  :	int		 =			embed_dim
							a__  :	str		 =			use_conv_embed
							a__  :	int		 =			hidden_sizes
							a__  :	str		 =			depths
							a__  :	Any		 =			focal_levels
							a__  :	Optional[int]		 =			focal_windows
							a__  :	Dict		 =			hidden_act
							a__  :	int		 =			mlp_ratio
							a__  :	Optional[int]		 =			hidden_dropout_prob
							a__  :	List[Any]		 =			drop_path_rate
							a__  :	Any		 =			use_layerscale
							a__  :	Optional[Any]		 =			layerscale_value
							a__  :	Union[str, Any]		 =			use_post_layernorm
							a__  :	str		 =			use_post_layernorm_in_modulation
							a__  :	str		 =			normalize_modulator
							a__  :	str		 =			initializer_range
							a__  :	Any		 =			layer_norm_eps
							a__  :	Tuple		 =			encoder_stride
							a__  :	Any		 =			["stem"] + [F"stage{idx}" for idx in range(1	, len(self.depths    ) + 1    )]
							a__ ,	a__  :	Any		 =			get_aligned_output_features_output_indices(
							    out_features=a_	, out_indices=a_	, stage_names=self.stage_names    )






"""simple docstring"""






from sklearn.metrics import matthews_corrcoef

import datasets


__UpperCAmelCase						=			'''
Compute the Matthews correlation coefficient (MCC)

The Matthews correlation coefficient is used in machine learning as a
measure of the quality of binary and multiclass classifications. It takes
into account true and false positives and negatives and is generally
regarded as a balanced measure which can be used even if the classes are of
very different sizes. The MCC is in essence a correlation coefficient value
between -1 and +1. A coefficient of +1 represents a perfect prediction, 0
an average random prediction and -1 an inverse prediction.  The statistic
is also known as the phi coefficient. [source: Wikipedia]
'''

__UpperCAmelCase						=			'''
Args:
    predictions (list of int): Predicted labels, as returned by a model.
    references (list of int): Ground truth labels.
    sample_weight (list of int, float, or bool): Sample weights. Defaults to `None`.
Returns:
    matthews_correlation (dict containing float): Matthews correlation.
Examples:
    Example 1, a basic example with only predictions and references as inputs:
        >>> matthews_metric = datasets.load_metric("matthews_correlation")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3])
        >>> print(round(results[\'matthews_correlation\'], 2))
        0.54

    Example 2, the same example as above, but also including sample weights:
        >>> matthews_metric = datasets.load_metric("matthews_correlation")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3],
        ...                                     sample_weight=[0.5, 3, 1, 1, 1, 2])
        >>> print(round(results[\'matthews_correlation\'], 2))
        0.1

    Example 3, the same example as above, but with sample weights that cause a negative correlation:
        >>> matthews_metric = datasets.load_metric("matthews_correlation")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3],
        ...                                     sample_weight=[0.5, 1, 0, 0, 0, 1])
        >>> print(round(results[\'matthews_correlation\'], 2))
        -0.25
'''

__UpperCAmelCase						=			'''\
@article{scikit-learn,
  title={Scikit-learn: Machine Learning in {P}ython},
  author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.
         and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.
         and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and
         Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},
  journal={Journal of Machine Learning Research},
  volume={12},
  pages={2825--2830},
  year={2011}
}
'''



@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION						,  _KWARGS_DESCRIPTION  )
class 					__UpperCAmelCase							(						datasets.Metric  ):
				def       UpperCAmelCase      (		self    :			Optional[int]    )	->	str:



							'''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       UpperCAmelCase      (		self    :			Tuple	, a_    :			Optional[Any]	, a_    :			Optional[Any]	, a_    :			Any=None    )	->	Union[str, Any]:



							'''simple docstring'''



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