ó
    Ñ]j$Q  ã                   óÔ   • S r SSKrSSKJr  SSKJr  SSKrSSKJ	r	  SSK
Jr  SSKJrJr  SSKJr  SS	KJrJrJr  SS
 jrSS jr\\\S.rS rS rS rS rSS jrSS jrSS jrS rg)zAUtilities to handle multiclass/multioutput target in classifiers.é    N)ÚSequence)Úchain)Úissparse)Úget_namespace)Úattach_uniqueÚcached_unique)ÚVisibleDeprecationWarning)Ú_assert_all_finiteÚ_num_samplesÚcheck_arrayc                 ó�   • [        XS9u  p[        U S5      (       d  U(       a  [        UR                  U 5      US9$ [	        U 5      $ )N©ÚxpÚ	__array__)r   Úhasattrr   ÚasarrayÚset©Úyr   Úis_array_api_compliants      ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sklearn/utils/multiclass.pyÚ_unique_multiclassr      s=   € Ü!.¨qÑ!8Ñ€BÜˆq�+×ÑÖ"8Ü˜RŸZ™Z¨›]¨rÑ2Ð2ä�1‹vˆó    c                 ój   • [        XS9u  pUR                  [        U S/ SQS9R                  S   5      $ )Nr   r   ©ÚcsrÚcscÚcoo)Ú
input_nameÚaccept_sparseé   )r   Úaranger   Úshape)r   r   Ú_s      r   Ú_unique_indicatorr%      s8   € Ü˜!Ñ#�E€BØ�9‰9Ü�A #Ò5JÑK×QÑQÐRSÑTóð r   )ÚbinaryÚ
multiclassúmultilabel-indicatorc            
      ó&  ^^• [        U SS06n [        U 6 u  mn[        U 5      S:X  a  [        S5      e[	        S U  5       5      nUSS1:X  a  S1n[        U5      S:”  a  [        S	U-  5      eUR                  5       nUS
:X  a*  [        [	        S U  5       5      5      S:”  a  [        S5      e[        R                  US5      mT(       d  [        S[        U 5      -  5      eU(       a8  TR                  U  Vs/ s H
  nT" UTS9PM     sn5      nTR                  U5      $ [	        [        R                  " UU4S jU  5       5      5      n[        [	        S U 5       5      5      S:”  a  [        S5      eTR                  [        U5      5      $ s  snf )a)  Extract an ordered array of unique labels.

We don't allow:
    - mix of multilabel and multiclass (single label) targets
    - mix of label indicator matrix and anything else,
      because there are no explicit labels)
    - mix of label indicator matrices of different sizes
    - mix of string and integer labels

At the moment, we also don't allow "multiclass-multioutput" input type.

Parameters
----------
*ys : array-likes
    Label values.

Returns
-------
out : ndarray of shape (n_unique_labels,)
    An ordered array of unique labels.

Examples
--------
>>> from sklearn.utils.multiclass import unique_labels
>>> unique_labels([3, 5, 5, 5, 7, 7])
array([3, 5, 7])
>>> unique_labels([1, 2, 3, 4], [2, 2, 3, 4])
array([1, 2, 3, 4])
>>> unique_labels([1, 2, 10], [5, 11])
array([ 1,  2,  5, 10, 11])
Úreturn_tupleTr   zNo argument has been passed.c              3   ó8   #   • U  H  n[        U5      v •  M     g 7f©N)Útype_of_target)Ú.0Úxs     r   Ú	<genexpr>Ú unique_labels.<locals>.<genexpr>O   s   é € Ð1ªb¨”> !×$Ð$ªbùs   ‚r&   r'   r!   z'Mix type of y not allowed, got types %sr(   c              3   óT   #   • U  H  n[        U/ S QS9R                  S   v •  M      g7f)r   )r    r!   N)r   r#   )r.   r   s     r   r0   r1   \   s(   é € ð ÚVXÐQR”˜AÒ-BÑC×IÑIÈ!ÖLÒVXùs   ‚&(zCMulti-label binary indicator input with different numbers of labelsNzUnknown label type: %sr   c              3   ó@   >#   • U  H  nS  T" UTS9 5       v •  M     g7f)c              3   ó$   #   • U  H  ov •  M     g 7fr,   © )r.   Úis     r   r0   Ú*unique_labels.<locals>.<genexpr>.<genexpr>q   s   é € ÐAÒ(@ 1œQÒ(@ùs   ‚r   Nr5   )r.   r   Ú_unique_labelsr   s     €€r   r0   r1   q   s!   øé € ÐNÊ2ÀaÑA©°q¸RÒ(@×AÐAÊ2ùs   ƒc              3   óB   #   • U  H  n[        U[        5      v •  M     g 7fr,   )Ú
isinstanceÚstr)r.   Úlabels     r   r0   r1   t   s   é € Ð=²9¨%Œz˜%¤×%Ð%²9ùs   ‚z,Mix of label input types (string and number))r   r   ÚlenÚ
ValueErrorr   ÚpopÚ_FN_UNIQUE_LABELSÚgetÚreprÚconcatÚunique_valuesr   Úfrom_iterabler   Úsorted)	Úysr   Úys_typesÚ
label_typer   Ú	unique_ysÚ	ys_labelsr8   r   s	          @@r   Úunique_labelsrL   )   s�  ù€ ô@ 
˜Ð	.¨Ñ	.€BÜ!.°Ð!3Ñ€BÐÜ
ˆ2ƒw�!ƒ|ÜÐ7Ó8Ð8ô Ñ1©bÓ1Ó1€HØ�H˜lÐ+Ó+Ø �>ˆä
ˆ8ƒ}�qÓÜÐBÀXÑMÓNÐNà—‘“€Jð 	Ð,Ó,ÜÜñ ÙVXóó ó
ð
 óô ØQó
ð 	
ô
 '×*Ñ*¨:°tÓ<€NÞÜÐ1´D¸³HÑ<Ó=Ð=æà—I‘IÁÓDÂ¸A™~¨a°BÔ7ÁÑDÓEˆ	Ø×Ñ 	Ó*Ð*äÜ×ÒÕNÉ2ÓNÓNó€Iô Œ3Ñ=±9Ó=Ó=Ó>ÀÓBÜÐGÓHÐHà�:‰:”f˜YÓ'Ó(Ð(ùò Es   Ã7Fc           
      ó  • [        U 5      u  pUR                  U R                  S5      =(       aP    [        UR	                  UR                  UR                  XR                  5      U R                  5      U :H  5      5      $ )Núreal floating)r   ÚisdtypeÚdtypeÚboolÚallÚastypeÚint64r   s      r   Ú_is_integral_floatrU   z   s_   € Ü!.¨qÓ!1Ñ€BØ�:‰:�a—g‘g˜Ó/÷ ´DØ
�‰ˆr�y‰y˜"Ÿ)™) A§x¡xÓ0°1·7±7Ó;¸qÑ@ÓAó5ð r   c           	      óŠ  • [        U 5      u  p[        U S5      (       d  [        U [        5      (       d  U(       aV  [	        SSSSSSS9n[
        R                  " 5          [
        R                  " S[        5         [        U 4SS0UD6n SSS5        [        U S
5      (       a#  U R                  S:X  a  U R                  S   S:”  d  g[!        U 5      (       a½  U R"                  S;   a  U R%                  5       n UR'                  U R(                  5      n[+        U R(                  5      S:H  =(       dc    UR,                  S:H  =(       d    UR,                  S:H  =(       a    SU;   =(       a+    U R.                  R0                  S;   =(       d    [3        U5      $ [5        XS9nUR                  S   S:  =(       a.    UR7                  U R.                  S5      =(       d    [3        U5      $ ! [        [        4 a=  n[        U5      R                  S	5      (       a  e [        U 4S[        0UD6n  SnAGN¢SnAff = f! , (       d  f       GN±= f)a!  Check if ``y`` is in a multilabel format.

Parameters
----------
y : ndarray of shape (n_samples,)
    Target values.

Returns
-------
out : bool
    Return ``True``, if ``y`` is in a multilabel format, else ``False``.

Examples
--------
>>> import numpy as np
>>> from sklearn.utils.multiclass import is_multilabel
>>> is_multilabel([0, 1, 0, 1])
False
>>> is_multilabel([[1], [0, 2], []])
False
>>> is_multilabel(np.array([[1, 0], [0, 0]]))
True
>>> is_multilabel(np.array([[1], [0], [0]]))
False
>>> is_multilabel(np.array([[1, 0, 0]]))
True
r   TFr   ©r    Úallow_ndÚensure_all_finiteÚ	ensure_2dÚensure_min_samplesÚensure_min_featuresÚerrorrP   NúComplex data not supportedr#   é   r!   )ÚdokÚlilÚbiur   é   )rQ   zsigned integerzunsigned integer)r   r   r:   r   ÚdictÚwarningsÚcatch_warningsÚsimplefilterr	   r   r>   r;   Ú
startswithÚobjectÚndimr#   r   ÚformatÚtocsrrD   Údatar=   ÚsizerP   ÚkindrU   r   rO   )r   r   r   Úcheck_y_kwargsÚeÚlabelss         r   Úis_multilabelrs   �   sÜ  € ô8 "/¨qÓ!1Ñ€BÜˆq�+×Ñ¤*¨Q´×"9Ñ"9Ö=Sô ØØØ#ØØ Ø !ñ
ˆô ×$Ò$Õ&Ü×!Ò! 'Ô+DÔEðCÜ Ñ@¨Ð@°Ñ@�÷ 'ô �A�w×Ñ A§F¡F¨a£K°A·G±G¸A±JÀ³NØä�‡{�{Ø�8‰8�~Ó%Ø—‘“	ˆAØ×!Ñ! !§&¡&Ó)ˆÜ�1—6‘6‹{˜aÑ÷ 
Ø�[‰[˜AÑ×G 6§;¡;°!Ñ#3×"F¸!¸v¹+÷ FØ—‘—‘ Ñ&×DÔ*<¸VÓ*Dð	
ô
 ˜qÑ(ˆà�|‰|˜A‰ Ñ"÷ 
Ø�J‰J�q—w‘wÐ NÓO÷ *Ü! &Ó)ð	
øô- .¬zÐ:ó CÜ�q“6×$Ñ$Ð%A×BÑBØô   ÑB¬ÐB°>ÑB–ûðCú÷	 'Ö&ús0   ÁH3Á;G#Ç#H0Ç32H+È%H3È+H0È0H3È3
Ic                 óú   • [        U SS9nUS;  a  [        SU S35      eSU;   aV  [        U 5      nUS:”  aD  [        U 5      R                  S   [        S	U-  5      :”  a  [        R                  " S
[        SS9  gggg)a!  Ensure that target y is of a non-regression type.

Only the following target types (as defined in type_of_target) are allowed:
    'binary', 'multiclass', 'multiclass-multioutput',
    'multilabel-indicator', 'multilabel-sequences'

Parameters
----------
y : array-like
    Target values.
r   ©r   )r&   r'   zmulticlass-multioutputr(   zmultilabel-sequenceszUnknown label type: zy. Maybe you are trying to fit a classifier, which expects discrete classes on a regression target with continuous values.r'   é   r   g      à?z’The number of unique classes is greater than 50% of the number of samples. `y` could represent a regression problem, not a classification problem.r_   )Ú
stacklevelN)	r-   r>   r   r   r#   Úroundre   ÚwarnÚUserWarning)r   Úy_typeÚ	n_sampless      r   Úcheck_classification_targetsr}   É   s�   € ô ˜A¨#Ñ.€FØð ó ô Ø" 6 (ð +8ð 8ó
ð 	
ð �vÓÜ  “Oˆ	Ø�r‹>œm¨AÓ.×4Ñ4°QÑ7¼%ÀÀiÁÓ:PÓPä�MŠMð*ô Øóð Qˆ>ð r   c           	      ó²  ^ ^^• [        T 5      u  p4UUU 4S jn[        T [        5      =(       d    [        T 5      =(       d    [	        T S5      =(       a    [        T [
        5      (       + =(       d    UnU(       d  [        ST -  5      eT R                  R                  S;   nU(       a  [        S5      e[        T 5      (       a  g[        SSSSS	S	S
9n[        R                  " 5          [        R                  " S[        5        [        T 5      (       d   [        T 4SS0UD6m SSS5         [        T 5      (       a
  T S	/SS24   OT S	   n
[        U
[$        5      (       a  ['        S5      e[	        U
S5      (       d5  [        U
[        5      (       a   [        U
[
        5      (       d  [        S5      eT R*                  S;  a  U" 5       $ [-        T R.                  5      (       d  T R*                  S:X  a  gU" 5       $ [        T 5      (       d=  T R0                  ["        :X  a)  [        T R2                  S	   [
        5      (       d  U" 5       $ T R*                  S:X  a  T R.                  S   S:”  a  SnOSnUR5                  T R0                  S5      (       az  [        T 5      (       a  T R6                  OT nUR9                  XÃR:                  5      nUR=                  XÃR9                  UT R0                  5      :g  5      (       a  [?        UTS9  SU-   $ [        W
5      (       a  U
R6                  n
[A        T 5      R.                  S	   S:”  d  T R*                  S:X  a  [C        U
5      S:”  a  SU-   $ g! [        [        4 a=  n	[        U	5      R!                  S5      (       a  e [        T 4S["        0UD6m  Sn	A	GNŒSn	A	ff = f! , (       d  f       GN›= f! [(         a     GN%f = f)aÆ	  Determine the type of data indicated by the target.

Note that this type is the most specific type that can be inferred.
For example:

* ``binary`` is more specific but compatible with ``multiclass``.
* ``multiclass`` of integers is more specific but compatible with ``continuous``.
* ``multilabel-indicator`` is more specific but compatible with
  ``multiclass-multioutput``.

Parameters
----------
y : {array-like, sparse matrix}
    Target values. If a sparse matrix, `y` is expected to be a
    CSR/CSC matrix.

input_name : str, default=""
    The data name used to construct the error message.

    .. versionadded:: 1.1.0

raise_unknown : bool, default=False
    If `True`, raise an error when the type of target returned by
    :func:`~sklearn.utils.multiclass.type_of_target` is `"unknown"`.

    .. versionadded:: 1.6

Returns
-------
target_type : str
    One of:

    * 'continuous': `y` is an array-like of floats that are not all
      integers, and is 1d or a column vector.
    * 'continuous-multioutput': `y` is a 2d array of floats that are
      not all integers, and both dimensions are of size > 1.
    * 'binary': `y` contains <= 2 discrete values and is 1d or a column
      vector.
    * 'multiclass': `y` contains more than two discrete values, is not a
      sequence of sequences, and is 1d or a column vector.
    * 'multiclass-multioutput': `y` is a 2d array that contains more
      than two discrete values, is not a sequence of sequences, and both
      dimensions are of size > 1.
    * 'multilabel-indicator': `y` is a label indicator matrix, an array
      of two dimensions with at least two columns, and at most 2 unique
      values.
    * 'unknown': `y` is array-like but none of the above, such as a 3d
      array, sequence of sequences, or an array of non-sequence objects.

Examples
--------
>>> from sklearn.utils.multiclass import type_of_target
>>> import numpy as np
>>> type_of_target([0.1, 0.6])
'continuous'
>>> type_of_target([1, -1, -1, 1])
'binary'
>>> type_of_target(['a', 'b', 'a'])
'binary'
>>> type_of_target([1.0, 2.0])
'binary'
>>> type_of_target([1, 0, 2])
'multiclass'
>>> type_of_target([1.0, 0.0, 3.0])
'multiclass'
>>> type_of_target(['a', 'b', 'c'])
'multiclass'
>>> type_of_target(np.array([[1, 2], [3, 1]]))
'multiclass-multioutput'
>>> type_of_target([[1, 2]])
'multilabel-indicator'
>>> type_of_target(np.array([[1.5, 2.0], [3.0, 1.6]]))
'continuous-multioutput'
>>> type_of_target(np.array([[0, 1], [1, 1]]))
'multilabel-indicator'
c                  óN   >• T(       a  T(       a  TOSn [        SU  ST< 35      eg)zTDepending on the value of raise_unknown, either raise an error or return
'unknown'.
rm   zUnknown label type for z: Úunknown)r>   )Úinputr   Úraise_unknownr   s    €€€r   Ú_raise_or_returnÚ(type_of_target.<locals>._raise_or_return?  s-   ø€ ö Þ",‘J°&ˆEÜÐ6°u°g¸RÀ¹uÐEÓFÐFàr   r   z:Expected array-like (array or non-string sequence), got %r)ÚSparseSeriesÚSparseArrayz1y cannot be class 'SparseSeries' or 'SparseArray'r(   TFr   rW   r]   rP   Nr^   zkSupport for labels represented as bytes is not supported. Convert the labels to a string or integer format.zÝYou appear to be using a legacy multi-label data representation. Sequence of sequences are no longer supported; use a binary array or sparse matrix instead - the MultiLabelBinarizer transformer can convert to this format.)r!   r_   r!   r&   r_   z-multioutputÚ rN   ru   Ú
continuousr'   )"r   r:   r   r   r   r;   r>   Ú	__class__Ú__name__rs   rd   re   rf   rg   r	   r   rh   ri   ÚbytesÚ	TypeErrorÚ
IndexErrorrj   Úminr#   rP   ÚflatrO   rm   rS   rT   Úanyr
   r   r=   )r   r   r‚   r   r   rƒ   ÚvalidÚsparse_pandasrp   rq   Úfirst_row_or_valÚsuffixrm   Úintegral_datas   ```           r   r-   r-   ð   sQ  ú€ ôZ "/¨qÓ!1Ñ€B÷ô 
�A”xÓ	 ×	J¤H¨Q£K×	J´7¸1¸kÓ3J÷ 	#Ü˜1œcÓ"Ô"÷ ð 
 ð 
ö
 ÜØHÈ1ÑLó
ð 	
ð —K‘K×(Ñ(Ð,KÑK€MÞÜÐLÓMÐMä�Q×ÑØ%ô ØØØØØØñ€Nô 
×	 Ò	 Õ	"Ü×Ò˜gÔ'@ÔAÜ˜�{‰{ðCÜ Ñ@¨Ð@°Ñ@�÷	 
#ðÜ(0°¯©˜1˜a˜S¢!˜Vš9¸¸1¹ÐäÐ&¬×.Ñ.Üð<óð ô Ð(¨+×6Ñ6ÜÐ+¬X×6Ñ6ÜÐ/´×5Ñ5äð;óð ð 	‡v�v�VÓáÓ!Ð!Üˆq�w‰w�<‰<à�6‰6�Q‹;àáÓ!Ð!Ü�A�;‰;˜1Ÿ7™7¤fÓ,´ZÀÇÁÀqÁ	Ì3×5OÑ5OáÓ!Ð!ð 	‡v�v�ƒ{�q—w‘w˜q‘z A“~Ø‰àˆð 
‡z�z�!—'‘'˜?×+Ñ+ä! !Ÿ™ˆq�vŠv¨!ˆØŸ	™	 $¯©Ó1ˆð �6‰6�$Ÿ)™) M°1·7±7Ó;Ñ;×<Ñ<Ü˜t°
Ò;Ø &Ñ(Ð(ô Ð ×!Ñ!Ø+×0Ñ0ÐÜ�QÓ×Ñ˜aÑ  1Ó$¨¯©°1«¼Ð=MÓ9NÐQRÓ9Rà˜fÑ$Ð$àøôQ .¬zÐ:ó CÜ�q“6×$Ñ$Ð%A×BÑBØô   ÑB¬ÐB°>ÑB–ûðCú÷ 
#Ö	"ûôD ó ÚðúsC   Ã',N6ÄM&Ä+BO Í&N3Í62N.Î(N6Î.N3Î3N6Î6
OÏ
OÏOc                 ó  • [        U SS5      c  Uc  [        S5      eUbm  [        U SS5      bN  [        R                  " U R                  [        U5      5      (       d  [        SU< SU R                  < 35      e g[        U5      U l        gg)a  Private helper function for factorizing common classes param logic.

Estimators that implement the ``partial_fit`` API need to be provided with
the list of possible classes at the first call to partial_fit.

Subsequent calls to partial_fit should check that ``classes`` is still
consistent with a previous value of ``clf.classes_`` when provided.

This function returns True if it detects that this was the first call to
``partial_fit`` on ``clf``. In that case the ``classes_`` attribute is also
set on ``clf``.

Úclasses_Nz8classes must be passed on the first call to partial_fit.z	`classes=z7` is not the same as on last call to partial_fit, was: TF)Úgetattrr>   ÚnpÚarray_equalr—   rL   )ÚclfÚclassess     r   Ú_check_partial_fit_first_callr�   ·  s�   € ô ˆs�J Ó%Ñ-°'±/ÜÐSÓTÐTà	Ñ	Ü�3˜
 DÓ)Ñ5Ü—>’> #§,¡,´¸gÓ0F×GÑGÝ ã18¸#¿,»,ðHóð ð Hð ô )¨Ó1ˆCŒLØð r   c                 ó0  • / n/ n/ nU R                   u  pVUb  [        R                  " U5      n[        U 5      (       GaÁ  U R	                  5       n [        R
                  " U R                  5      n[        U5       GH€  nU R                  U R                  U   U R                  US-       n	Ub2  X   n
[        R                  " U5      [        R                  " U
5      -
  nOSn
U R                   S   Xx   -
  n[        R                  " U R                  U R                  U   U R                  US-       SS9u  pÍ[        R                  " XÚS9nSU;   a  XìS:H  ==   U-  ss'   SU;  aE  Xx   U R                   S   :  a0  [        R                  " USS5      n[        R                  " USU5      nUR                  U5        UR                  UR                   S   5        UR                  XîR                  5       -  5        GMƒ     O”[        U5       H…  n[        R                  " U SS2U4   SS9u  pÍUR                  U5        UR                  UR                   S   5        [        R                  " XÑS9nUR                  XîR                  5       -  5        M‡     X#U4$ )a>  Compute class priors from multioutput-multiclass target data.

Parameters
----------
y : {array-like, sparse matrix} of size (n_samples, n_outputs)
    The labels for each example.

sample_weight : array-like of shape (n_samples,), default=None
    Sample weights.

Returns
-------
classes : list of size n_outputs of ndarray of size (n_classes,)
    List of classes for each column.

n_classes : list of int of size n_outputs
    Number of classes in each column.

class_prior : list of size n_outputs of ndarray of size (n_classes,)
    Class distribution of each column.
Nr!   r   T)Úreturn_inverse)Úweights)r#   r™   r   r   ÚtocscÚdiffÚindptrÚrangeÚindicesÚsumÚuniquerm   ÚbincountÚinsertÚappend)r   Úsample_weightrœ   Ú	n_classesÚclass_priorr|   Ú	n_outputsÚy_nnzÚkÚcol_nonzeroÚnz_samp_weightÚzeros_samp_weight_sumÚ	classes_kÚy_kÚclass_prior_ks                  r   Úclass_distributionr·   Ú  s1  € ð, €GØ€IØ€KàŸ7™7Ñ€IØÑ ÜŸ
š
 =Ó1ˆä�‡{‚{Ø�G‰G‹IˆÜ—’˜Ÿ™Ó!ˆä�y×!ˆAØŸ)™) A§H¡H¨Q¡K°!·(±(¸1¸q¹5±/ÐBˆKàÑ(Ø!.Ñ!;�Ü(*¯ª¨}Ó(=ÄÇÂÀ~Ó@VÑ(VÑ%à!%�Ø()¯©°©
°U±XÑ(=Ð%äŸYšYØ—‘�q—x‘x ‘{ Q§X¡X¨a°!©e¡_Ð5Àdñ‰NˆIô ŸKšK¨ÑDˆMð �I‹~Ø¨1™nÓ-Ð1FÑFÓ-ð ˜	Ó! e¡h°·±¸±Ó&;ÜŸIšI i°°AÓ6�	Ü "§	¢	¨-¸Ð<QÓ R�à�N‰N˜9Ô%Ø×Ñ˜YŸ_™_¨QÑ/Ô0Ø×Ñ˜}×/@Ñ/@Ó/BÑB×Cò9 "ô< �yÖ!ˆAÜŸYšY qª¨A¨¡w¸tÑD‰NˆIØ�N‰N˜9Ô%Ø×Ñ˜YŸ_™_¨QÑ/Ô0ÜŸKšK¨ÑCˆMØ×Ñ˜}×/@Ñ/@Ó/BÑBÖCñ "ð  Ð,Ð,r   c                 óà  • U R                   S   n[        R                  " X245      n[        R                  " X245      nSn[        U5       H~  n[        US-   U5       Hh  nUSS2U4==   USS2U4   -  ss'   USS2U4==   USS2U4   -  ss'   X@SS2U4   S:H  U4==   S-  ss'   X@SS2U4   S:H  U4==   S-  ss'   US-  nMj     M€     US[        R                  " U5      S-   -  -  n	XI-   $ )aE  Compute a continuous, tie-breaking OvR decision function from OvO.

It is important to include a continuous value, not only votes,
to make computing AUC or calibration meaningful.

Parameters
----------
predictions : array-like of shape (n_samples, n_classifiers)
    Predicted classes for each binary classifier.

confidences : array-like of shape (n_samples, n_classifiers)
    Decision functions or predicted probabilities for positive class
    for each binary classifier.

n_classes : int
    Number of classes. n_classifiers must be
    ``n_classes * (n_classes - 1 ) / 2``.
r   r!   Nrc   )r#   r™   Úzerosr¤   Úabs)
ÚpredictionsÚconfidencesr¬   r|   ÚvotesÚsum_of_confidencesr°   r6   ÚjÚtransformed_confidencess
             r   Ú_ovr_decision_functionrÁ   $  s  € ð& ×!Ñ! !Ñ$€IÜ�HŠH�iÐ+Ó,€EÜŸš 9Ð"8Ó9Ðà	€AÜ�9ÖˆÜ�q˜1‘u˜iÖ(ˆAØšq !˜tÓ$¨²A°q°DÑ(9Ñ9Ó$Øšq !˜tÓ$¨²A°q°DÑ(9Ñ9Ó$Øša ˜dÑ# qÑ(¨!Ð+Ó,°Ñ1Ó,Øša ˜dÑ# qÑ(¨!Ð+Ó,°Ñ1Ó,Ø�‰FŠAó )ñ ð 1Ø	ŒR�VŠVÐ&Ó'¨!Ñ+Ñ,ñÐð Ñ*Ð*r   r,   )r‡   F) Ú__doc__re   Úcollections.abcr   Ú	itertoolsr   Únumpyr™   Úscipy.sparser   Úsklearn.utils._array_apir   Úsklearn.utils._uniquer   r   Úsklearn.utils.fixesr	   Úsklearn.utils.validationr
   r   r   r   r%   r@   rL   rU   rs   r}   r-   r�   r·   rÁ   r5   r   r   Ú<module>rË      sw   ðÙ Gó
 Ý $Ý ã Ý !å 2ß >Ý 9ß RÑ Rôôð !Ø$Ø-ñÐ òN)òbòE
òP$ôNDôN ôFG-óT*+r   