ó
    †ñ:i{  ã                   óÚ   • S SK Jr  S SKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  \R                  " 5       \R                  R!                  S 5      SS	\	R"                  S
SS4S\4S jjrg)é    Né   )ÚExplanation)ÚOpChainé   )Úcolors)Úlabels)Úconvert_orderingé
   Té   Úshap_valuesc	           
      óD  • U R                   n	[        [        U5      [        5      (       a  UR	                  [        U	5      5      n[        [        U5      [
        5      (       a  UR                   nUc  [        R                  " U* 5      nOb[        [        U5      [        5      (       a  UR	                  [        U	5      5      nO)[        US5      (       d  [        S[        U5       S35      eSn
[        X5      n[        R                  " U R                  5      U   nU R                   U   SS2U4   n	X#   nU	R                  S   U:”  aÀ  [        R                  " U	R                  S   U45      nU	SS2SUS-
  24   USS2SS24'   U	SS2US-
  S24   R!                  S5      USS2S4'   [        R                  " U5      nUSUS-
   USS& X$S-
  S R!                  5       US'   / USUS-
   QS	U	R                  S   U-
  S-    S
3PnUn	UnSnUcL  ["        R$                  " 5       R'                  XyR                  S   U-  S-   5        ["        R(                  " 5       n[        R*                  " U	R-                  5       SS/5      u  nnUR/                  U	R0                  SU	R                  S   -  U	R                  S   -  S[3        UU* 5      [5        U* U5      US9  UR6                  R9                  S5        UR:                  R9                  S5        UR<                  SS/   R?                  S5        UR<                  SS/   RA                  U	R                  S   U-
  U* 5        UR<                  SS/   R?                  S5        URC                  SSS9  URE                  U	R                  S   U-
  S5        [        RF                  " U	R                  S   5      nUnUR:                  RI                  S/UQS/UQSS9  UR:                  RK                  5       S   R?                  S5        URM                  SU	R                  S   S-
  5        URO                  U
5        URQ                  SS S!SS"9  U	R0                  R!                  S5      nURS                  U* [        RT                  " U5      R5                  5       -  S#-
  S$SS%9  URW                  UU[        RT                  " U5      R5                  5       -  U	R                  S   -  S&-  SS'S$U	R                  S   S(-  S-
  S)9nU H  nURY                  S5        M     SSK-J.n  UR_                  US*9nURa                  [3        UU* 5      [5        U* U5      /5        ["        Rb                  " U[3        UU* 5      [5        U* U5      /US+S,S-S.9nURe                  [f        S/   S0S1S29  URh                  RC                  S3SS49  URk                  S5        URl                  R?                  S5        U(       a  ["        Rn                  " 5         U$ )5aJ  Create a heatmap plot of a set of SHAP values.

This plot is designed to show the population substructure of a dataset using supervised
clustering and a heatmap.
Supervised clustering involves clustering data points not by their original
feature values but by their explanations.
By default, we cluster using :func:`shap.utils.hclust_ordering`,
but any clustering can be used to order the samples.

Parameters
----------
shap_values : shap.Explanation
    A multi-row :class:`.Explanation` object that we want to visualize in a
    cluster ordering.

instance_order : OpChain or numpy.ndarray
    A function that returns a sort ordering given a matrix of SHAP values and an axis, or
    a direct sample ordering given as an ``numpy.ndarray``.

feature_values : OpChain or numpy.ndarray
    A function that returns a global summary value for each input feature, or an array of such values.

feature_order : None, OpChain, or numpy.ndarray
    A function that returns a sort ordering given a matrix of SHAP values and an axis, or
    a direct input feature ordering given as an ``numpy.ndarray``.
    If ``None``, then we use ``feature_values.argsort``.

max_display : int
    The maximum number of features to display (default is 10).

show : bool
    Whether :external+mpl:func:`matplotlib.pyplot.show()` is called before returning.
    Setting this to ``False`` allows the plot
    to be customized further after it has been created.

plot_width : int, default 8
    The width of the heatmap plot.

ax : matplotlib Axes
    Axes object to draw the plot onto, otherwise uses the current Axes.

Returns
-------
ax: matplotlib Axes
    Returns the :external+mpl:class:`~matplotlib.axes.Axes` object with the plot drawn onto it.

Examples
--------
See `heatmap plot examples <https://shap.readthedocs.io/en/latest/example_notebooks/api_examples/plots/heatmap.html>`_.

NÚ__len__zUnsupported feature_order: Ú!Ú	Instancesr   r   éÿÿÿÿzSum of z other featuresg      à?g      @éc   gffffffæ?Únearest)ÚaspectÚinterpolationÚvminÚvmaxÚcmapÚbottomÚleftÚrightTÚtopFÚbothÚout)ÚaxisÚ	directionéýÿÿÿg      ø¿z$f(x)$é   )Úfontsizeg      à¿z#aaaaaaz--)ÚcolorÚ	linestyleÚ	linewidthg      ø?z#000000)r$   r&   é   Úcenterg      ð?)ÚheightÚalignr$   r   )r   éP   g{®Gáz„?gš™™™™™¹?)ÚticksÚaxr   ÚfractionÚpadÚVALUEé   iöÿÿÿ)ÚsizeÚlabelpadé   )Ú	labelsizeÚlength)8ÚvaluesÚ
issubclassÚtyper   Úapplyr   ÚnpÚargsortÚhasattrÚ	ExceptionÚstrr	   ÚarrayÚfeature_namesÚshapeÚzerosÚsumÚpltÚgcfÚset_size_inchesÚgcaÚnanpercentileÚflattenÚimshowÚTÚminÚmaxÚxaxisÚset_ticks_positionÚyaxisÚspinesÚset_visibleÚ
set_boundsÚtick_paramsÚset_ylimÚarangeÚ	set_ticksÚget_ticklinesÚset_xlimÚ
set_xlabelÚaxhlineÚplotÚabsÚbarhÚset_clip_onÚmatplotlib.cmÚcmÚScalarMappableÚ	set_arrayÚcolorbarÚ	set_labelr   r-   Ú	set_alphaÚoutlineÚshow)r   Úinstance_orderÚfeature_valuesÚfeature_orderÚmax_displayr   ri   Ú
plot_widthr-   r7   ÚxlabelrA   Ú
new_valuesÚnew_feature_valuesÚ
row_heightr   r   Úheatmap_yticks_posÚheatmap_yticks_labelsÚfxÚbar_containerÚbrb   ÚmÚcbs                            ÚV/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/shap/plots/_heatmap.pyÚheatmapr{      s»  € ð~ ×Ñ€FÜ”$�~Ó&¬×0Ñ0Ø'×-Ñ-¬k¸&Ó.AÓBˆÜ”$�~Ó&¬×4Ñ4Ø'×.Ñ.ˆØÑÜŸ
š
 N ?Ó3‰Ü	”D˜Ó'¬×	1Ñ	1Ø%×+Ñ+¬K¸Ó,?Ó@‰Ü�] I×.Ñ.ÜÐ5´c¸-Ó6HÐ5IÈÐKÓLÐLØ€FÜ% nÓB€Nô —H’H˜[×6Ñ6Ó7¸ÑF€MØ×Ñ Ñ/²°=Ð0@ÑA€FØ#Ñ2€Nð ‡|�|�A�˜Ó$Ü—X’X˜vŸ|™|¨A™°Ð<Ó=ˆ
Ø#¢AÐ'8¨°q©Ð'8Ð$8Ñ9ˆ
’1�c�r�c�6ÑØ"¢1 k°A¡oÑ&7Ð#7Ñ8×<Ñ<¸QÓ?ˆ
’1�b�5ÑÜŸXšX kÓ2ÐØ"0Ð1B°;À±?Ð"CÐ˜3˜BÐØ!/¸a±Ð0AÐ!B×!FÑ!FÓ!HÐ˜2Ñð
ØÐ,˜[¨1™_Ð-ð
à�f—l‘l 1‘o¨Ñ3°aÑ7Ð8¸ÐHð
ˆð ˆØ+ˆð €JØ	�zÜ�Š‹	×!Ñ! *¯l©l¸1©oÀ
Ñ.JÈSÑ.PÔQÜ�WŠW‹Yˆô ×!Ò! &§.¡.Ó"2°Q¸°GÓ<�J€Dˆ$Ø‡I�IØ�‰Ø�V—\‘\ !‘_Ñ$ v§|¡|°A¡Ñ6ØÜ�˜�uÓÜ�$�˜ÓØð ñ ð ‡H�H×Ñ Ô)Ø‡H�H×Ñ Ô'Ø‡I�Iˆv�wÐÑ ×,Ñ,¨TÔ2Ø‡I�Iˆv�wÐÑ ×+Ñ+¨F¯L©L¸©O¸jÑ,HÈ:È+ÔVØ‡I�Iˆu�hÐÑ ×,Ñ,¨UÔ3Ø‡N�N˜¨%€NÑ0à‡K�K�—‘˜Q‘ *Ñ,¨bÔ1ÜŸš 6§<¡<°¡?Ó3ÐØ)ÐØ‡H�H×ÑØ	Ð#Ð"Ð#Ø	Ð+Ð*Ð+Øð ñ ð ‡H�H×ÑÓ˜QÑ×+Ñ+¨EÔ2à‡K�K��f—l‘l 1‘o¨Ñ+Ô,Ø‡M�M�&Ôð ‡J�Jˆt˜9°À€JÑDØ	�‰�‰�a‹€BØ‡G�GØ	ˆŒb�fŠf�R‹j�n‰nÓÑ Ñ$ØØð ñ ð —G‘GØØ	œ"Ÿ&š& Ó0×4Ñ4Ó6Ñ	6¸&¿,¹,Àq¹/ÑIÈBÑNØØØØ�\‰\˜!‰_˜sÑ" SÑ(ð ð €Mó ˆØ	�‰�eÖñ õ à
×Ñ˜tÐÐ$€AØ‡K�K”�T˜D˜5Ó!¤3¨ u¨dÓ#3Ð4Ô5Ü	�ŠØ	Ü�4˜$˜Ó¤ d U¨DÓ!1Ð2ØØØØñ
€Bð ‡L�L”˜‘ r°C€LÑ8Ø‡E�E×Ñ ¨1ÐÑ-Ø‡L�L�„OØ‡J�J×Ñ˜5Ô!ö
 Ü�ŠŒ
à€Ió    )Úmatplotlib.pyplotÚpyplotrE   Únumpyr;   Ú r   Úutilsr   r   Ú_labelsr   Ú_utilsr	   Úhclustr^   ÚmeanÚred_white_bluer{   © r|   rz   Ú<module>rˆ      sa   ðÝ Û å Ý Ý Ý Ý $ð
 ×%Ò%Ó'Ø—?‘?×'Ñ'¨Ó*ØØØ	×	Ñ	Ø	ØØñ|Øö|r|   