ó
    †ñ:iï  ã                   óÂ   • S SK r S SKrS SKrS SKrS SKrSSKJr   S SKJ	r	  S SKJ
r  Sr       SS jrSS	 jrS
 rSS jrS rS rS rS rS rg! \ a    Sr N3f = f)é    Né   )Úcolors)ÚHTML)ÚdisplayTFc                 óà  • S nSR                  [        R                  " [        R                  SS95      n	[        U R                  5      S:X  Ga  U R                  b  [        U R                  [        5      (       aÕ  SnSnSn[        U 5       Hy  u  p«[        U5      u  pÍ[        UR                  XÂX=5      u  pìnU
S:X  a  U" XËR                  5      u  pEnMI  U" XËR                  5      u  nnnUU:  a  UnUU:”  a  UnUU:”  d  Mw  UnM{     Sn[        U 5       H!  u  p«USU
 S	3-  nU[        UUUUUUUS
S9-  nM#     U(       a  [!        U5        gU$ [        U R                  5      S:X  Gaº  U R                  Gb¬  SnSnSn[#        U R                  S   5       Hx  n
[        U SS2U
4   5      u  pÍ[        U SS2U
4   R                  XÂX=5      u  pìnU" XÀSS2U
4   R                  5      u  nnnUb  UU:  a  UnUb  UU:”  a  UnUb  UU:”  d  Mv  UnMz     Uc  UnUc  UnUc  UnSR                  / SPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PSPU	 PS PU	 PS!PU	 PS"PU	 PS#PU	 PSPU	 PS$P5      nU R$                  R'                  S5      U R                  -   n[(        R*                  " [(        R,                  " U5      5      n[        U R                  5       Hq  u  n
nS%S%UU
   -  US&-   -  -   n[.        R0                  " U5      nUS   S'-  US(   S'-  US   S'-  US)   4nUS*U
S:X  a  S+OS, S-U S.U	 S/U
 S0U	 S1U
 S2U	 S1U
 S3U S43-  nMs     US5-  n[        U R                  5       Hd  u  n
nUS6U	 S/U
 S7U
S:X  a  S8OS, S93-  nU[        U SS2U
4   UUUUUUS
S9-  nUS4-  nUS6U	 S/U
 S:3-  nU[        U SS2U
4   UUUS
S;9-  nUS4-  nMf     US4-  nU(       a  [!        U5        gU$ [        U R                  5      S):X  Ga  SnSnSn[#        U R                  S   5       Hš  n
[#        U R                  S   5       H{  n[        U USS2U
4   5      u  pÍ[        U USS2U
4   R                  XÂX=5      u  pìnU" XÀUSS2U
4   R                  5      u  nnnUb  UU:  a  UnUb  UU:”  a  UnUb  UU:”  d  My  UnM}     Mœ     Uc  UnUc  UnUc  UnSn[        U 5       H!  u  p«US<U
 S=3-  nU[        UUUUUUUS
S9-  nM#     U(       a  [!        U5        gU$ U" U R$                  U R                  5      u  nnnUc  UnUc  UnUc  Un[        U 5      u  pÍ[        U R                  XÂX=5      u  pìn[(        R2                  " [(        R,                  " U5      * 5      SU n SnU V!s/ s H5  n!U!R5                  S>S?5      R5                  S@SA5      R5                  SBS5      PM7     n"n![        U R                  [        5      (       a  U R                  OSn#U[7        UU R                  U R                  UR'                  5       -   U"U	UUU#5      -  nUSC-  n[        U5       GH;  u  n
n$S%S%XÊ   -  US&-   -  -   n[.        R0                  " U5      nUS   S'-  US(   S'-  US   S'-  US)   4nS,n%SDn&U
U ;   a  S8n%SEn&Sn'Xú   S(:X  a  [        XÊ   R9                  S)5      5      n'O-[        XÊ   R9                  S)5      5      SF-   [        Xú   5      -   n'USR                  / SGPU& PSHPU% PSIPU' PSJPU	 PSKPU
 PSLPU PSMPU	 PSKPU
 PSNPU	 PSKPU
 PSOPU	 PSKPU
 PSPPU	 PSKPU
 PSQPU$R5                  S>S?5      R5                  S@SA5      R5                  SBS5       PSRP5      -  nGM>     US4-  nU(       a  [!        U5        gU$ s  sn!f )SaL  Plots an explanation of a string of text using coloring and interactive labels.

The output is interactive HTML and you can click on any token to toggle the display of the
SHAP value assigned to that token.

Parameters
----------
shap_values : [numpy.array]
    List of arrays of SHAP values. Each array has the shap values for a string (#input_tokens x output_tokens).

num_starting_labels : int
    Number of tokens (sorted in descending order by corresponding SHAP values)
    that are uncovered in the initial view.
    When set to 0, all tokens are covered.

grouping_threshold : float
    If the component substring effects are less than a ``grouping_threshold``
    fraction of an unlowered interaction effect, then we visualize the entire group
    as a single chunk. This is primarily used for explanations that were computed
    with fixed_context set to 1 or 0 when using the :class:`.explainers.Partition`
    explainer, since this causes interaction effects to be left on internal nodes
    rather than lowered.

separator : string
    The string separator that joins tokens grouped by interaction effects and
    unbroken string spans. Defaults to the empty string ``""``.

xmin : float
    Minimum shap value bound.

xmax : float
    Maximum shap value bound.

cmax : float
    Maximum absolute shap value for sample. Used for scaling colors for input tokens.

display: bool
    Whether to display or return html to further manipulate or embed. Default: ``True``

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

c                 ó*  • XR                  5       -   nX U S:„     R                  5       -
  nX U S:     R                  5       -
  n[        [        U R                  5       5      [        U R                  5       5      5      nXC-
  nUSU-  -  nUSU-  -  nX4U4$ )zUsed to pick our axis limits.r   gš™™™™™¹?)ÚsumÚmaxÚabsÚmin)ÚvaluesÚbase_valuesÚfxÚxminÚxmaxÚcmaxÚds          ÚS/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/shap/plots/_text.pyÚvalues_min_maxÚtext.<locals>.values_min_maxL   s’   € àŸ:™:›<Ñ'ˆØ˜6 A™:Ñ&×*Ñ*Ó,Ñ,ˆØ˜6 A™:Ñ&×*Ñ*Ó,Ñ,ˆÜ”3�v—z‘z“|Ó$¤c¨&¯*©*«,Ó&7Ó8ˆØ‰KˆØ��a‘‰ˆØ��a‘‰ˆà˜4ÐÐó    Ú é   ©Úké   Nr   a/  
    <br>
    <hr style="height: 1px; background-color: #fff; border: none; margin-top: 18px; margin-bottom: 18px; border-top: 1px dashed #ccc;"">
    <div align="center" style="margin-top: -35px;"><div style="display: inline-block; background: #fff; padding: 5px; color: #999; font-family: monospace">[z#]</div>
    </div>
                F)Únum_starting_labelsÚgrouping_thresholdÚ	separatorr   r   r   r   éÿÿÿÿz2<div align='center'>
<script>
    document._hover_z = '_tp_z_output_0';
    document._zoom_z+ = undefined;
    function _output_onclick_zC(i) {
        var next_id = undefined;

        if (document._zoom_zE !== undefined) {
            document.getElementById(document._zoom_zC+ '_zoom').style.display = 'none';

            if (document._zoom_z
 === '_tp_zH_output_' + i) {
                document.getElementById(document._zoom_zR).style.display = 'block';
                document.getElementById(document._zoom_z€+'_name').style.borderBottom = '3px solid #000000';
            } else {
                document.getElementById(document._zoom_zQ).style.display = 'none';
                document.getElementById(document._zoom_zZ+'_name').style.borderBottom = 'none';
            }
        }
        if (document._zoom_z
 !== '_tp_z,_output_' + i) {
            next_id = '_tp_a$  _output_' + i;
            document.getElementById(next_id).style.display = 'none';
            document.getElementById(next_id + '_zoom').style.display = 'block';
            document.getElementById(next_id+'_name').style.borderBottom = '3px solid #000000';
        }
        document._zoom_z3 = next_id;
    }
    function _output_onmouseover_z%(i, el) {
        if (document._zoom_z8 !== undefined) { return; }
        if (document._hover_zF !== undefined) {
            document.getElementById(document._hover_z] + '_name').style.borderBottom = 'none';
            document.getElementById(document._hover_zI).style.display = 'none';
        }
        document.getElementById('_tp_zu_output_' + i).style.display = 'block';
        el.style.borderBottom = '3px solid #000000';
        document._hover_zc_output_' + i;
    }
</script>
<div style="color: rgb(120,120,120); font-size: 12px;">outputs</div>ç      à?ç:Œ0âŽyE>éÿ   r   é   z-
<div style="display: inline; border-bottom: z3px solid #000000Únonez; background: rgbaz,; border-radius: 3px; padding: 0px" id="_tp_Ú_output_z$_name"
    onclick="_output_onclick_Ú(z()"
    onmouseover="_output_onmouseover_z
, this);">ú</div>z<br><br>z<div id='_tp_z' style='display: Úblockz';>z_zoom' style='display: none;'>)r   r   r   r   a#  
<br>
<hr style="height: 1px; background-color: #fff; border: none; margin-top: 18px; margin-bottom: 18px; border-top: 1px dashed #ccc;"">
<div align="center" style="margin-top: -35px;"><div style="display: inline-block; background: #fff; padding: 5px; color: #999; font-family: monospace">[z]</div>
</div>
            Ú<ú&lt;Ú>ú&gt;ú ##zj<div align='center'><div style="color: rgb(120,120,120); font-size: 12px; margin-top: -15px;">inputs</div>Úinlineúinline-blockú / ú<div style='display: z1; text-align: center;'
    ><div style='display: ú3; color: #999; padding-top: 0px; font-size: 12px;'>z</div
        ><div id='_tp_Ú_ind_z6'
            style='display: inline; background: rgbaaÉ  ; border-radius: 3px; padding: 0px'
            onclick="
            if (this.previousSibling.style.display == 'none') {
                this.previousSibling.style.display = 'block';
                this.parentNode.style.display = 'inline-block';
            } else {
                this.previousSibling.style.display = 'none';
                this.parentNode.style.display = 'inline';
            }"
            onmouseover="document.getElementById('_fb_z3').style.opacity = 1; document.getElementById('_fs_zL').style.opacity = 1;"
            onmouseout="document.getElementById('_fb_z3').style.opacity = 0; document.getElementById('_fs_z ').style.opacity = 0;"
        >z</div></div>)ÚjoinÚrandomÚchoicesÚstringÚascii_lowercaseÚlenÚshapeÚoutput_namesÚ
isinstanceÚstrÚ	enumerateÚ unpack_shap_explanation_contentsÚprocess_shap_valuesÚdatar   ÚtextÚ_ipython_display_htmlÚranger   r	   Únpr
   r   r   Úred_transparent_blueÚargsortÚreplaceÚsvg_force_plotÚround)(Úshap_valuesr   r   r   r   r   r   r   r   ÚuuidÚiÚvr   Ú
clusteringÚtokensÚgroup_sizesÚxmin_iÚxmax_iÚcmax_iÚoutÚxmin_computedÚxmax_computedÚcmax_computedÚoutput_valuesÚ
output_maxÚnameÚscaled_valueÚcolorÚjÚxmin_newÚxmax_newÚcmax_newÚtop_indsÚtÚencoded_tokensÚoutput_nameÚtokenÚlabel_displayÚwrapper_displayÚvalue_labels(                                           r   rC   rC      s•  € òn
 ð �7‰7”6—>’>¤&×"8Ñ"8¸BÑ?Ó@€Dô ˆ;×ÑÓ Ô"¨×(@Ñ(@Ñ(HÌJÐWb×WoÑWoÔqt×LuÑLuØˆØˆØˆä˜kÖ*‰DˆAÜ!AÀ!Ó!DÑˆFÜ*=¸a¿f¹fÀfÐbkÓ*xÑ'ˆF˜Kà�A‹vÙ#1°&¿-¹-Ó#HÑ �˜DÙá%3°F¿M¹MÓ%JÑ"ˆF�F˜FØ˜‹}Ø�Ø˜‹}Ø�Ø˜�}Ø’ñ +ð ˆÜ˜kÖ*‰DˆAØð ]ð ^_ð  ]`ð `ðñ ˆCð ”4ØØ$7Ø#5Ø#ØØØØñ	ñ 	ŠCñ +ö" Ü! #Ô&ØàˆJä
ˆ;×ÑÓ Ô" {×'?Ñ'?Ò'KØˆØˆØˆä�{×(Ñ(¨Ñ,Ö-ˆAÜ!AÀ+ÊaÐQRÈdÑBSÓ!TÑˆFÜ*=ØšA˜q˜DÑ!×&Ñ&¨ÀIó+Ñ'ˆF˜Kñ &4°FÊÈ1ÈÑ<M×<YÑ<YÓ%ZÑ"ˆF�F˜FØÑ$¨°Ó(>Ø &�ØÑ$¨°Ó(>Ø &�ØÑ$¨°Õ(>Ø &’ñ! .ð$ ‰<Ø ˆDØ‰<Ø ˆDØ‰<Ø ˆD÷%Jó %Jð ð %Jà�Fð%Jà"ð%Jà#' &ð%Jð)ð%Jð �6ð%Jðð%Jð #˜Vð	%Jð$ð	%Jð !˜6ð%Jð"4ð%Jð 59°6ð%Jð: ð%Jð !%˜vð%Jð &0ð%Jð 15¨vð%Jð68ð%Jð 9=°vð%Jð>8ð%Jð 9=°vð%Jð>8ð%Jð 9=°vð%Jð>8ð%Jð 9=°vð%Jð>ð%Jð$ !˜6ð%%Jð$ ",ð%%Jð$ -1¨6ð%%Jð$2ð%%Jð& !˜6ð'%Jð&"ð'%Jð0 �vð1%Jð0"ð1%Jð4 #' ð5%Jð4(ð5%Jð6 !˜6ð7%Jð6"ð7%Jð8 "˜Fð9%Jð8#5ð9%Jð: 6:°Fð;%Jð:;5ð;%Jð< 6:°Fð=%Jð<;&ð=%Jð@ '+ VðA%Jð@,ðA%JðD ˜ðE%JðD 'ðE%JðD (, fðE%JðD-GôE%JˆðL $×*Ñ*×.Ñ.¨qÓ1°K×4KÑ4KÑKˆÜ—V’VœBŸFšF =Ó1Ó2ˆ
Ü  ×!9Ñ!9Ö:‰GˆAˆtØ  }°QÑ'7Ñ!7¸:ÈÑ;LÑ!MÑMˆLÜ×/Ò/°Ó=ˆEØ˜1‘X ‘^ U¨1¡X°¡^°U¸1±XÀ±^ÀUÈ1ÁXÐNˆEàð -ØDEÈÃFÑ-@ÐPVÐ,WÐWiÐjoÐipð  q]ð  ^bð  ]cð  ckð  lmð  knð nØ"˜V 1 Q Cð (&Ø&* V¨1¨Q¨C¨z¸$¸¸vðIñ IŠCñ ;ð 	ˆzÑˆÜ  ×!9Ñ!9Ö:‰GˆAˆtØ�] 4 &¨°°Ð3EÐQRÐVWÓQWÁgÐ]cÐEdÐdgÐhÑhˆCØ”4ØšA˜q˜DÑ!Ø$7Ø#5Ø#ØØØØñ	ñ 	ˆCð �8‰OˆCØ�] 4 &¨°°Ð3QÐRÑRˆCØ”4ØšA˜q˜DÑ!Ø$7Ø#5Ø#Øññ ˆCð �8‰OŠCñ+ ;ð, 	ˆx‰ˆÞÜ! #Ô&ØàˆJô ˆ;×ÑÓ Ô"ØˆØˆØˆä�{×(Ñ(¨Ñ,Ö-ˆAÜ˜;×,Ñ,¨QÑ/Ö0�Ü%EÀkÐRSÒUVÐXYÐRYÑFZÓ%[Ñ"�Ü.AØ ¢1 a Ñ(×-Ñ-¨vÈ9ó/Ñ+� ñ *8¸ÈAÊqÐRSÈGÑ@T×@`Ñ@`Ó)aÑ&�˜ Ø Ñ(¨F°]Ó,BØ$*�MØ Ñ(¨F°]Ó,BØ$*�MØ Ñ(¨F°]Õ,BØ$*’Mó 1ñ .ð ‰<Ø ˆDØ‰<Ø ˆDØ‰<Ø ˆDàˆÜ˜kÖ*‰DˆAØð Yð Z[ð  Y\ð \ðñ ˆCð ”4ØØ$7Ø#5Ø#ØØØØñ	ñ 	ŠCñ +ö" Ü! #Ô&ØàˆJñ $2°+×2DÑ2DÀk×F]ÑF]Ó#^Ñ €Hˆh˜Ø�|ØˆØ�|ØˆØ�|Øˆä9¸+ÓFÑ€FÜ"5Ø×Ñ˜&°ió#Ñ€F�Kô
 �zŠzœ2Ÿ6š6 &›>˜/Ó*Ð+?Ð,?Ð@€HØ
€Cñ _eÓeÒ^dÐYZ�a—i‘i  VÓ,×4Ñ4°S¸&ÓA×IÑIÈ%ÐQSÖTÑ^d€NÐeÜ.8¸×9QÑ9QÔSV×.WÑ.W�+×*Ò*Ð]_€KØŒ>ØØ×ÑØ×Ñ &§*¡*£,Ñ.ØØØØØó	ñ 	€Cð Øvñ€Cô ˜f×%‰ˆˆ5Ø˜S 6¡9™_°°t±Ñ<Ñ<ˆÜ×+Ò+¨LÓ9ˆØ�q‘˜C‘  q¡¨C¡°°q±¸C±ÀÀqÁÐJˆð ˆØ"ˆØ�‹=Ø#ˆMØ,ˆOð ˆØ‰>˜QÓÜ˜f™iŸo™o¨aÓ0Ó1‰Kä˜f™iŸo™o¨aÓ0Ó1°EÑ9¼CÀÁÓ<OÑOˆKð 	÷ ]ó ]Ð(ð ]¨Ð(9ð ]ð :ð ]Ø(˜/ð]Ø)\ð]Ø]hÐ\ið]ðjð]à�fð]à!ð]à"# ð]ð%5ð]ð 6;°Gð]ð	<7ð]ð 8<°fð]ð =Bð]ð CDÀð]ð Exð]ð y}Ðw}ð]ð ~Cð]ð DEð  CFð]ðF6ð]ð 7;°Vð]ð <Að]ð BCÀð]ð Dwð]ð x|Ðv|ð]ð }Bð]ð CDð  BEð]ðE
ð]ð �-‰-˜˜VÓ
$×
,Ñ
,¨S°&Ó
9×
AÑ
AÀ%ÈÓ
LÐ	Mð]ð NZô]ñ 	]‹ñ) &ðF ˆ8�O€CæÜ˜cÔ"Øàˆ
ùòq fs   ×<_+c                 óz  ^ ^^^^^^^^^^^^• [        T 5      m[        T5      T:w  Ga:  Tc  [        S5      e[        T5       Vs/ s H  of/PM     snm[        R                  " [        T5      5      nTS T US T& [        R                  " [        T5      5      m[        R
                  " TS T 5      TS T& [        TR                  S   5       H�  n[        TUS4   5      n[        TUS4   5      n	TR                  TU   TU	   -   5        Xx   Xy   -   TTU-      -   UTU-   '   [        [        TTU-      5      [        TTU-      5      -  TU   TU	   5      TUT-   '   M‘     [        R                  " [        T5      5      n
SUUU4S jjmT" U
T[        T5      S-
  5        Xz-   m/ n/ n/ n[        R                  " T45      m/ mUUUUUUUUUUU U4S jmT" X¼U[        T5      S-
  5        [        R                  " U5      m [        R                  " U5      m[        R                  " U5      n[        R                  " T5      m[        R                  " T5      m[        T 5      mOB[        R                  " T5      n[        R                  " T5      m[        R                  " T5      mU(       a  T TUTT4$ T TU4$ s  snf )Nz¯The length of the attribution values must match the number of tokens if shap_values.clustering is None! When passing hierarchical attributions the clustering is also required.r   r   c                 ó¬   >• UT:  a  X0U'   g [        XT-
  S4   5      n[        XT-
  S4   5      nX0U'   UTU   -  nT" XXCS-  5        T" XXSS-  5        g ©Nr   r   r!   )Úint)	Úupper_valuesrP   rN   ÚvalueÚliÚriÚMÚlower_creditr   s	         €€€r   rt   Ú)process_shap_values.<locals>.lower_credit—  sq   ø€ Ø�1‹uØ"'˜Q‘ØÜ�Z A¡ q Ñ)Ó*ˆBÜ�Z A¡ q Ñ)Ó*ˆBØ#˜‰OØ�V˜A‘YÑˆEñ ˜°2¸s±{ÔCÙ˜°2¸s±{ÕCr   c           
      ó>  >• UT:  aV  US:¼  aP  U R                  TU   5        UR                  TU   5        UR                  S5        T
R                  U5        UTU'   g [        T	UT-
  S4   5      n[        T	UT-
  S4   5      n[        TU   5      [        TU   5      -  n[	        TU   TU   5      UT-  :  aÈ  U R                  TR                  TU    Vs/ s H  nTU   PM
     sn5      T-   TR                  TU    Vs/ s H  nTU   PM
     sn5      -   5        UR                  TU   5        UR                  [        TU   5      5        T
R                  U5        TU    H  nUTU'   M
     TU    H  nUTU'   M
     g T" XX$5        T" XX%5        g s  snf s  snf ©Nr   r   )Úappendrn   r   r:   r
   r5   )Ú
new_tokensÚ
new_valuesrR   rN   rq   rr   ÚdvÚgrs   rP   Úcollapsed_node_idsÚgroup_valuesr   ÚgroupsÚ
max_valuesÚmerge_tokensr   Útoken_id_to_node_id_mappingrQ   r   s           €€€€€€€€€€€€r   r�   Ú)process_shap_values.<locals>.merge_tokens²  sµ  ø€ à�1‹u˜˜a›Ø×!Ñ! &¨¡)Ô,Ø×!Ñ! ,¨q¡/Ô2Ø×"Ñ" 1Ô%ð #×)Ñ)¨!Ô,Ø12Ð+¨AÒ.ô ˜ A¨¡E¨1 HÑ-Ó.�Ü˜ A¨¡E¨1 HÑ-Ó.�Ü˜ ™“^¤c¨&°©)£nÑ4�ô �z "‘~ z°"¡~Ó6¸Ð>PÑ9PÓPØ×%Ñ%Ø!Ÿ™¸6À"º:Ó'Fº:°a¨¨q¬	¹:Ñ'FÓGØ#ñ$à#Ÿ.™.¸VÀBºZÓ)HºZ¸¨&°¬)¹ZÑ)HÓIñJôð
 ×%Ñ% l°1¡oÔ6Ø×&Ñ&¤s¨6°!©9£~Ô6ð '×-Ñ-¨aÔ0Ø# BœZ˜Ø9:Ð3°AÓ6ñ (ð $ BœZ˜Ø9:Ð3°AÓ6ò (ñ
 ! ¸ÔIÙ  ¸ÕIùò' (Gùâ)Hs   ÃFÄF©r   )r:   Ú
ValueErrorrE   rF   Úzerosr   r;   rn   rx   r
   ÚarrayÚonesÚarange)rQ   r   r   r   rP   Úreturn_meta_datarN   Úlower_valuesrq   rr   ro   ry   rz   rR   rs   r}   r~   r   rt   r€   r�   r‚   s   `````         @@@@@@@@r   rA   rA   z  s�  ÿü€ ô 	ˆF‹€AÜ
ˆ6ƒ{�aÔàÑÜð@óð ô  % QœxÓ(šx˜!“#™xÑ(ˆÜ—x’x¤ F£Ó,ˆØ! " 1˜:ˆ�R�aÐÜ—X’Xœc &›kÓ*ˆ
ÜŸš  r¨ 
Ó+ˆ
�2�AˆÜ�z×'Ñ'¨Ñ*Ö+ˆAÜ�Z  1 Ñ%Ó&ˆBÜ�Z  1 Ñ%Ó&ˆBØ�M‰M˜& ™* v¨b¡zÑ1Ô2Ø".Ñ"2°\Ñ5EÑ"EÈÈqÐSTÉuÉÑ"UˆL˜˜Q™ÑÜ #¤C¨¨q°1©u©Ó$6¼¸VÀAÈÁE¹]Ó9KÑ$KÈZÐXZÉ^Ð]gÐhjÑ]kÓ lˆJ�q˜1‘uÓñ ,ô —x’x¤ F£Ó,ˆ÷	Dñ 	Dñ 	�\ :¬s°6«{¸Q©Ô?ð $Ñ2ˆð ˆ
Øˆ
Øˆô ')§h¢h°¨t£nÐ#ØÐ÷'	J÷ '	Jð '	JñR 	�Z¨[¼#¸lÓ:KÈaÑ:OÔPô —’˜*Ó%ˆÜ—’˜*Ó%ˆÜ—h’h˜{Ó+ˆô ')§h¢hÐ/JÓ&KÐ#ÜŸXšXÐ&8Ó9Ðä�‹K‰ä—g’g˜a“jˆÜ&(§i¢i°£lÐ#ÜŸYšY q›\ÐæØ�v˜{Ð,GÐI[Ð[Ð[à�v˜{Ð*Ð*ùòO )s   ÁJ8c                 óÔ  ^^^• UU4S jmSnUS-  nUS-  nSQU4S jjn	[        TT-   S-  [        [        S[        R                  " TT-
  S-   5      -
  5      5      5      n
X‰" U
5      -  n[        TT-
  S	-  [        [        S[        R                  " TT-
  S-   5      -
  5      5      5      nTT-
  S
-  n[	        SS5       H  nX­U-  -
  nUTU-   :  a    OX‰" U5      -  nM!     [	        SS5       H  nX­U-  -   nUTU-
  :”  a    OX‰" U5      -  nM!     X‰" USSS9-  nX‰" USSU S3SS9-  n[        [        R                  S-  5      nSnX U S:„     R                  5       -
  nSX S:„     R                  5       -  TT-
  S-   -  nUST" U5       SU SU S3-  nUnUn[        R                  " [        R                  " U 5      * 5       Vs/ s H  oÐU   S:”  d  M  UPM     nn[        U5       H¶  u  nnU U   nUU-  nUST" U5       ST" U5       SU SU SU S3-  nUS T" U5      T" U5      -   S-   S!U SU S"U S#U U   R                  S$5       S%3-  nUS&T" U5       S'T" U5      T" U5      -
   S(3-  nUS)-  nUS*UU   R                  5        S%3-  nUS+-  nUS,-  nUnM¸     Un[        U5       H°  u  nnU U   nUU-  nUS:w  aC  [	        S-5       H4  nUS.SU-  S/-
   S03-  nUS1T" U5       S23-  nUS3U S43-  nUS+-  nUS5-  nM6     US-   [        U5      :w  aC  [	        S-5       H4  nUS.SU-  S-
   S03-  nUS1T" U5       S23-  nUS3U S43-  nUS+-  nUS5-  nM6     UnM²     US6T" U5       S7U S83-  nX U S:„     R                  5       -
  nUS9-  nUS1T" U5       S23-  nUS:-  nUS+-  nUS5-  nUnUn[        U5       HÈ  u  nnU U   nUU-  nUS-   [        U5      :w  a'  US;-  nUS1T" U5       S23-  nUS3U S43-  nUS+-  nUS5-  nUST" U5       S'T" U5      T" U5      -
   S<3-  nUS=-  nUS>U SU S?3-  nUS@U SU SA3-  nUSBU SU SA3-  nUSC-  nUSD-  nUS>U SU SE3-  nUS@U SU SF3-  nUSBU SU SF3-  nUSG-  nUnMÊ     [        [        R                  S-  5      nSHnSX S:     R                  5       * -  TT-
  S-   -  nUST" U5       SU SU S3-  nUnUn[        R                  " [        R                  " U 5      * 5       Vs/ s H  oÐU   S:  d  M  UPM     nn[        U5       H¶  u  nnU U   nUU-  nUST" U5       ST" U5       SU SU SU S3-  nUS T" U5      T" U5      -   S-   SIU SJU SU S#U U   R                  S$5       S%3-  nUS&T" U5       S'T" U5      T" U5      -
   S(3-  nUS)-  nUS*UU   R                  5        S%3-  nUS+-  nUS,-  nUnM¸     Un[        U5       H°  u  nnU U   nUU-  nUS:w  aC  [	        S-5       H4  nUS.SKU-  S-    S03-  nUS1T" U5       S23-  nUSLU S43-  nUS+-  nUS5-  nM6     US-   [        U5      :w  aC  [	        S-5       H4  nUSMSU-  S/-    S03-  nUS1T" U5       S23-  nUSLU S43-  nUS+-  nUS5-  nM6     UnM²     USNT" U5       S7U S83-  nX U S:     R                  5       -
  nUSO-  nUS1T" U5       S23-  nUSP-  nUS+-  nUS5-  nUnUn[        U5       HÈ  u  nnU U   nUU-  nUS-   [        U5      :w  a'  USO-  nUS1T" U5       S23-  nUSLU S43-  nUS+-  nUS5-  nUST" U5       S'T" U5      T" U5      -
   S<3-  nUS=-  nUS>U SU S?3-  nUS@U SU SA3-  nUSBU SU SA3-  nUSC-  nUSD-  nUS>U SU SE3-  nUS@U SU SF3-  nUSBU SU SF3-  nUSG-  nUnMÊ     US,-  nU$ s  snf s  snf )RNc                 ó&   >• SU T-
  -  TT-
  S-   -  $ )Néd   r"   © )Úxvalr   r   s    €€r   ÚxposÚsvg_force_plot.<locals>.xposó  s    ø€ Ø�d˜T‘kÑ" d¨T¡k°DÑ&8Ñ9Ð9r   r   z <svg width="100%" height="80px">zX<line x1="0" y1="33" x2="100%" y2="33" style="stroke:rgb(150,150,150);stroke-width:1" />c                 ó*  >• SnUST" U 5       ST" U 5       S3-  nU(       d.  U(       a  UST" U 5       SU S S3-  nUST" U 5       S	U S S3-  nO-U(       a  UST" U 5       S
U S S3-  nUST" U 5       SU S S3-  nUb  UST" U 5       SU S3-  nU$ )Nr   ú
<line x1="z%" y1="33" x2="z<%" y2="37" style="stroke:rgb(150,150,150);stroke-width:1" />ú	<text x="zŒ%" y="27" font-size="13px" style="stroke:#ffffff;stroke-width:8px;" fill="rgb(255,255,255)" dominant-baseline="bottom" text-anchor="middle">r|   ú</text>zc%" y="27" font-size="12px" fill="rgb(120,120,120)" dominant-baseline="bottom" text-anchor="middle">zŸ%" y="27" font-size="13px" style="stroke:#ffffff;stroke-width:8px;" font-weight="bold" fill="rgb(255,255,255)" dominant-baseline="bottom" text-anchor="middle">zp%" y="27" font-size="13px" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="bottom" text-anchor="middle">zc%" y="10" font-size="12px" fill="rgb(120,120,120)" dominant-baseline="bottom" text-anchor="middle">r�   )r�   ÚlabelÚboldÚbackingÚsr‘   s        €r   Údraw_tick_markÚ&svg_force_plot.<locals>.draw_tick_markÿ  sh  ø€ ØˆØ	ˆz™$˜t›*˜ _±T¸$³Z°LÐ@|Ð}Ñ}ˆÞÞØ�y¡ d£ ð  -yð  z~ð  @ð  yAð  AHð  Iñ  I�Ø�9™T $›Z˜Lð  )Lð  MQð  RSð  LTð  T[ð  \ñ  \‰AæØ�y¡ d£ ð  -Lð  MQð  RSð  LTð  T[ð  \ñ  \�Ø�9™T $›Z˜Lð  )Yð  Z^ð  _`ð  Yað  ahð  iñ  iˆAØÑØ�9™T $›Z˜Lð  )Lð  MRð  LSð  SZð  [ñ  [ˆAØˆr   r   r   r"   é   é   é
   z
base valueT)r—   r™   z-f<tspan baseline-shift="sub" font-size="8px">z</tspan>(inputs))r˜   r—   r™   r#   )r#   éÃ   éÕ   r   rŽ   z	<rect x="z
%" width="z%%" y="40" height="18" style="fill:rgbz'; stroke-width:0; stroke:rgb(0,0,0)" />r”   z%" x2="z%" y1="60" y2="60" id="_fb_r4   z" style="stroke:rgbz;stroke-width:2; opacity: 0"/>r•   z#%" y="71" font-size="12px" id="_fs_z" fill="rgbzE" style="opacity: 0" dominant-baseline="middle" text-anchor="middle">r$   r–   z<svg x="z%" y="40" height="20" width="z%">z.  <svg x="0" y="0" width="100%" height="100%">zq    <text x="50%" y="9" font-size="12px" fill="rgb(255,255,255)" dominant-baseline="middle" text-anchor="middle">z  </svg>z</svg>é   z<g transform="translate(é   z,0)">z
  <svg x="z4%" y="40" height="18" overflow="visible" width="30">z@    <path d="M 0 -9 l 6 18 L 0 25" fill="none" style="stroke:rgbz;stroke-width:2" />z</g>z%<rect transform="translate(-8,0)" x="z/%" y="40" width="8" height="18" style="fill:rgbz"/>z"<g transform="translate(-11.5,0)">zs    <path d="M 10 -9 l 6 18 L 10 25 L 0 25 L 0 -9" fill="#ffffff" style="stroke:rgb(255,255,255);stroke-width:2" />z!<g transform="translate(-1.5,0)">z%"z      onmouseover="zdocument.getElementById('_tp_z&').style.textDecoration = 'underline';zdocument.getElementById('_fs_z').style.opacity = 1;zdocument.getElementById('_fb_Ú"z      onmouseout="z!').style.textDecoration = 'none';z').style.opacity = 0;z" style="fill:rgb(0,0,0,0)" />)éÐ   éæ   éú   z$%" y="71" font-size="12px" fill="rgbz
" id="_fs_éþÿÿÿzA    <path d="M 8 -9 l -6 18 L 8 25" fill="none" style="stroke:rgbz<g transform="translate(-z$<rect transform="translate(0,0)" x="z!<g transform="translate(-6.0,0)">zt    <path d="M 8 -9 l -6 18 L 8 25 L 20 25 L 20 -9" fill="#ffffff" style="stroke:rgb(255,255,255);stroke-width:2" />)NFF)rK   rn   rF   Úlog10rE   Útupler   Úred_rgbr	   rH   r   r?   Ústripr:   Úblue_rgb)r   r   r   rQ   rM   r   r   rf   rš   r›   ÚxcenterÚtick_intervalÚside_bufferrN   ÚposÚredÚ	light_redÚxÚwÚlast_posÚindsÚindrO   r_   ÚblueÚ
light_bluer‘   s        ``                   @r   rJ   rJ   ò  s   ú€ ö:ð 	€AØÐ	+Ñ+€Að
 Ð	cÑc€A÷ô �T˜D‘[ AÑ%¤s¬5°´R·X²X¸dÀT¹kÈDÑ>PÓ5QÑ1QÓ+RÓ'SÓT€GØˆ˜Ó	 Ñ €Aô ˜4 $™;¨!Ñ+¬S´°q¼2¿8º8ÀDÈ4ÁKÐRVÑDVÓ;WÑ7WÓ1XÓ-YÓZ€Mð ˜$‘; "Ñ$€KÜ�1�bŽ\ˆØ˜MÑ)Ñ)ˆØ�˜Ñ#Ó#ÙØ	ˆ^˜CÓ Ñ Šñ	 ô
 �1�bŽ\ˆØ˜MÑ)Ñ)ˆØ�˜Ñ#Ó#ÙØ	ˆ^˜CÓ Ñ Šñ	 ð
 ˆ˜¨<ÀÑ	FÑF€AØˆØ
�ÐLÈ[ÈMÐYiÐjÐtxñ
ñ €Aô ”—‘ Ñ$Ó
%€CØ€Ið 	�F˜Q‘JÑ×#Ñ#Ó%Ñ%€AØˆf˜a‘ZÑ ×$Ñ$Ó&Ñ&¨$°©+¸Ñ*<Ñ=€AØˆ9‘T˜!“W�I˜Z¨ sÐ*OÐPSÈuÐT{Ð	|Ñ|€Að €CØ€HÜ—z’z¤2§6¢6¨&£> /Ô2ÓDÒ2�!¸Q±iÀ!±m�AÑ2€DÐDÜ˜D–/‰ˆˆ3Ø�3‰KˆØˆq‰ˆð 	
ˆz™$˜s›)˜ G©D°«NÐ+;Ð;VÐW[ÐV\Ð\aÐbeÐafÐfyÐz}Ðy~ð  ]ð  ^ñ  	^ˆð 	
ˆy™$˜x›.©4°«9Ñ4¸Ñ9Ð:Ð:]Ð^bÐ]cÐchÐilÐhmÐmxÐy|Ðx}ð  ~Cð  DJð  KNñ  DO÷  DUñ  DUð  VWó  DXð  CYð  Y`ð  añ  	aˆð 	
ˆx™˜S›	�{Ð"?ÁÀXÃÑQUÐVYÓQZÑ@ZÐ?[Ð[^Ð_Ñ_ˆØ	Ð=Ñ=ˆØ	ð  Að  BHð  ILñ  BM÷  BSñ  BSó  BUð  AVð  V]ð  ^ñ  	^ˆØ	ˆZ‰ˆØ	ˆX‰ˆàŠñ# "ð( €CÜ˜D–/‰ˆˆ3Ø�3‰KˆØˆq‰ˆà�‹6Ü˜1–X�ØÐ/°°A±¸±	¨{¸%Ð@Ñ@�Ø�z¡$ x£.Ð!1Ð1eÐfÑf�ØÐWÐX[ÐW\Ð\oÐpÑp�Ø�Z‘�Ø�V‘’ñ ð ˆq‰5”C˜“IÓÜ˜1–X�ØÐ/°°A±¸±	¨{¸%Ð@Ñ@�Ø�z¡$ s£) Ð,`ÐaÑa�ØÐWÐX[ÐW\Ð\oÐpÑp�Ø�Z‘�Ø�V‘’ñ ð Šñ) "ð. Ð0±°b³°
Ð:iÐjmÐinÐnqÐ	rÑr€Að �f˜q‘jÑ!×%Ñ%Ó'Ñ
'€CØÐ	-Ñ-€AØˆ:‘d˜3“i�[Ð TÐ	UÑU€AØÐ	~Ñ~€AØˆ�O€AØˆ�K€Að €CØ€HÜ˜D–/‰ˆˆ3Ø�3‰KˆØˆq‰ˆð ˆq‰5”C˜“IÓØÐ4Ñ4ˆAØ�:™d 8›nÐ-Ð-aÐbÑbˆAØÐSÐT]ÐS^Ð^qÐrÑrˆAØ�‰OˆAØ�‰KˆAð 	
ˆy™˜c›˜Ð#@ÁÀhÃÑRVÐWZÓR[ÑA[Ð@\Ð\^Ð_Ñ_ˆØ	Ð"Ñ"ˆØ	Ð,¨T¨F°%¸°uÐ<bÐcÑcˆØ	Ð,¨T¨F°%¸°uÐ<QÐRÑRˆØ	Ð,¨T¨F°%¸°uÐ<QÐRÑRˆØ	ˆS‰ˆØ	Ð!Ñ!ˆØ	Ð,¨T¨F°%¸°uÐ<]Ð^Ñ^ˆØ	Ð,¨T¨F°%¸°uÐ<QÐRÑRˆØ	Ð,¨T¨F°%¸°uÐ<QÐRÑRˆØ	Ð-Ñ-ˆàŠñ3 "ô: ”—‘ 3Ñ&Ó'€DØ €Jð 	ˆv˜q‘jÑ!×%Ñ%Ó'Ð'Ñ'¨4°$©;¸Ñ+=Ñ>€AØˆ9‘T˜"“X�J˜j¨¨Ð+PÐQUÐPVÐV}Ð	~Ñ~€Að €CØ€HÜ—z’z¤2§6¢6¨&£> /Ô2ÓDÒ2�!¸Q±iÀ!±m�AÑ2€DÐDÜ˜D–/‰ˆˆ3Ø�3‰KˆØˆq‰ˆð 	
ˆz™$˜x›.Ð)¨±°c³°Ð;VÐW[ÐV\Ð\aÐbeÐafÐfyÐz~Ðyð  @^ð  _ñ  	_ˆð 	
ˆy™$˜x›.©4°«9Ñ4¸Ñ9Ð:Ð:^Ð_cÐ^dÐdnÐosÐntÐtyÐz}Ðy~ð  Dð  EKð  LOñ  EP÷  EVñ  EVð  WXó  EYð  DZð  Zað  bñ  	bˆð 	
ˆx™˜X›Ð'Ð'DÁTÈ#ÃYÑQUÐV^ÓQ_ÑE_ÐD`Ð`cÐdÑdˆØ	Ð=Ñ=ˆØ	ð  Að  BHð  ILñ  BM÷  BSñ  BSó  BUð  AVð  V]ð  ^ñ  	^ˆØ	ˆZ‰ˆØ	ˆX‰ˆàŠñ# "ð( €CÜ˜D–/‰ˆˆ3Ø�3‰KˆØˆq‰ˆà�‹6Ü˜1–X�ØÐ/°°Q±¸±
¨|¸5ÐAÑA�Ø�z¡$ x£.Ð!1Ð1eÐfÑf�ØÐXÐY]ÐX^Ð^qÐrÑr�Ø�Z‘�Ø�V‘’ñ ð ˆq‰5”C˜“IÓÜ˜1–X�ØÐ0°°Q±¸±°¸5ÐAÑA�Ø�z¡$ s£) Ð,`ÐaÑa�ØÐXÐY]ÐX^Ð^qÐrÑr�Ø�Z‘�Ø�V‘’ñ ð Šñ) "ð. Ð/±°R³¨zÐ9hÐimÐhnÐnqÐ	rÑr€Að �f˜q‘jÑ!×%Ñ%Ó'Ñ
'€CØÐ	,Ñ,€AØˆ:‘d˜3“i�[Ð TÐ	UÑU€AØÐ	Ñ€AØˆ�O€AØˆ�K€Að €CØ€HÜ˜D–/‰ˆˆ3Ø�3‰KˆØˆq‰ˆð ˆq‰5”C˜“IÓØÐ4Ñ4ˆAØ�:™d 3›i˜[Ð(\Ð]Ñ]ˆAØÐTÐU_ÐT`Ð`sÐtÑtˆAØ�‰OˆAØ�‰KˆAð 	
ˆy™˜h›Ð(Ð(EÁdÈ3ÃiÑRVÐW_ÓR`ÑF`ÐEaÐacÐdÑdˆØ	Ð"Ñ"ˆØ	Ð,¨T¨F°%¸°uÐ<bÐcÑcˆØ	Ð,¨T¨F°%¸°uÐ<QÐRÑRˆØ	Ð,¨T¨F°%¸°uÐ<QÐRÑRˆØ	ˆS‰ˆØ	Ð!Ñ!ˆØ	Ð,¨T¨F°%¸°uÐ<]Ð^Ñ^ˆØ	Ð,¨T¨F°%¸°uÐ<QÐRÑRˆØ	Ð,¨T¨F°%¸°uÐ<QÐRÑRˆØ	Ð-Ñ-ˆàŠñ3 "ð6 ˆ�M€Aà€Hùòq EùòB Es   Ç_ Ç_ Ô_%Ô#_%c           
      óì  ^ ^^^^^^^^^^• [         R                  " S[        5        [        T5      m[        T 5      T:w  Gaá  Tc  [	        S5      e[        T5       Vs/ s H  of/PM     snm[        R                  " [        T 5      5      nT ST UST& [        R                  " [        T 5      5      m[        R                  " T ST 5      TST& [        TR                  S   5       H}  nTUS4   nTUS4   n	TR                  TU   TU	   -   5        Xx   Xy   -   T TU-      -   UTU-   '   [        [        T TU-      5      [        TTU-      5      -  TU   TU	   5      TUT-   '   M     [        R                  " [        T 5      5      n
S&UUU 4S jjmT" U
T[        T 5      S-
  5        Xz-   m/ n/ n/ nUUUUUUUUU U4
S jmT" X¼U[        T5      S-
  5        [        R                  " U5      m[        R                  " U5      m [        R                  " U5      n[        T5      mO[        R                  " T5      n[        R                  " [        R                  " T 5      * 5      SU nT R                  5       nT R                  5       nSn[        T5       GHM  nS	S	T U   -  [        [        U5      [        U5      5      -  -   n[         R"                  " U5      nUS   S
-  US   S
-  US   S
-  US   4nSnSnXn;   a  SnSnSnXÖ   S:X  a  [%        T U   R'                  S5      5      nO3[%        T U   XÖ   -  R'                  S5      5      S-   [%        XÖ   5      -   nUSU-   S-   S-   U-   S-   U-   S-   S-   S-   [%        U5      -   S-   S-   S-   S-   S-   S-   S-   S-   S -   S!-   TU   R)                  S"S#5      R)                  S!S$5      R)                  S%S5      -   S-   S-   -  nGMP     [+        U5      $ s  snf )'zÏPlots an explanation of a string of text using coloring and interactive labels.

The output is interactive HTML and you can click on any token to toggle the display of the
SHAP value assigned to that token.
zÀThis function is not used within the shap library and will therefore be removed in an upcoming release. If you rely on this function, please open an issue: https://github.com/shap/shap/issues.Nz«The length of the attribution values must match the number of tokens if partition_tree is None! When passing hierarchical attributions the partition_tree is also required.r   r   c                 óˆ   >• UT:  a  X0U'   g XT-
  S4   nXT-
  S4   nX0U'   UTU   -  nT" XXCS-  5        T" XXSS-  5        g rm   r�   )	ro   Úpartition_treerN   rp   rq   rr   rs   rt   rL   s	         €€€r   rt   Útext_old.<locals>.lower_credit  se   ø€ Ø�1‹uØ"'˜Q‘ØØ A¡ q Ñ)ˆBØ A¡ q Ñ)ˆBØ#˜‰OØ�[ ‘^Ñ#ˆEá˜°rÀ3¹;ÔGÙ˜°rÀ3¹;ÕGr   c           
      ó¦  >
• UT:  a@  US:¼  a:  U R                  TU   5        UR                  T	U   5        UR                  S5        g TUT-
  S4   nTUT-
  S4   n[        TU   5      [        TU   5      -  nUT
[        TU   TU   5      -  :”  a¤  U R                  TR	                  TU    Vs/ s H  nTU   PM
     sn5      T-   TR	                  TU    Vs/ s H  nTU   PM
     sn5      -   5        UR                  T	U   [        TU   5      -  5        UR                  [        TU   5      5        g T" XX$5        T" XX%5        g s  snf s  snf rw   )rx   r   r:   r
   r5   )ry   rz   rR   rN   rq   rr   r{   r|   rs   r~   r   r   r€   r�   r½   r   rL   rQ   s           €€€€€€€€€€r   r�   Útext_old.<locals>.merge_tokens*  sZ  ø€ à�1‹u˜˜a›Ø×!Ñ! &¨¡)Ô,Ø×!Ñ! ,¨q¡/Ô2Ø×"Ñ" 1Õ%ð $ A¨¡E¨1 HÑ-�Ø# A¨¡E¨1 HÑ-�Ü˜ Q™Ó(¬3¨v°a©y«>Ñ9�ð Ð*¬S°¸B±ÀÈBÁÓ-PÑPÓPØ×%Ñ%Ø!Ÿ™¸6À"º:Ó'Fº:°a¨¨q¬	¹:Ñ'FÓGØ#ñ$à#Ÿ.™.¸VÀBºZÓ)HºZ¸¨&°¬)¹ZÑ)HÓIñJôð
 ×%Ñ% l°1¡o¼¸FÀ1¹I»Ñ&FÔGØ×&Ñ&¤s¨6°!©9£~Õ6ñ ! ¸ÔIÙ  ¸ÕIùò (Gùâ)Hs   Â/E	ÃEr   r!   r#   r   r$   r%   r/   r)   r0   r1   r2   z; text-align: center;'>r3   r(   z<div z(style='display: inline; background: rgbaz#; border-radius: 3px; padding: 0px'z<onclick="if (this.previousSibling.style.display == 'none') {z-this.previousSibling.style.display = 'block';z/this.parentNode.style.display = 'inline-block';z} else {z,this.previousSibling.style.display = 'none';z)this.parentNode.style.display = 'inline';Ú}r¤   r,   r*   r+   r-   r.   r„   )ÚwarningsÚwarnÚFutureWarningr:   r…   rE   rF   r†   r   r;   rx   r
   r‡   rˆ   rH   r   r   rG   r>   rK   rI   rD   )rL   rQ   r½   r   r   r   rN   r‹   rq   rr   ro   ry   Únew_shap_valuesrR   rc   ÚmaxvÚminvrV   r]   r^   rh   ri   rj   rs   r~   r   rt   r€   r�   s   ``` ``                 @@@@@@r   Útext_oldrÈ   í  s—  ÿú€ ô ‡M‚Mð	cäôô
 	ˆF‹€AÜ
ˆ;Ó˜1ÔàÑ!ÜðDóð ô  % QœxÓ(šx˜!“#™xÑ(ˆÜ—x’x¤ KÓ 0Ó1ˆØ& r¨˜?ˆ�R�aÐÜ—X’Xœc +Ó.Ó/ˆ
ÜŸš ¨B¨Q Ó0ˆ
�2�AˆÜ�~×+Ñ+¨AÑ.Ö/ˆAØ  1 Ñ%ˆBØ  1 Ñ%ˆBØ�M‰M˜& ™* v¨b¡zÑ1Ô2Ø".Ñ"2°\Ñ5EÑ"EÈÐTUÐXYÑTYÑHZÑ"ZˆL˜˜Q™ÑÜ #¤C¨°A¸±EÑ(:Ó$;¼cÀ&ÈÈQÉÁ-Ó>PÑ$PÐR\Ð]_ÑR`ÐblÐmoÑbpÓ qˆJ�q˜1‘uÓñ 0ô —x’x¤ KÓ 0Ó1ˆ÷
	Hñ 
	Hñ 	�\ >´3°{Ó3CÀaÑ3GÔHð $Ñ2ˆð ˆ
ØˆØˆ÷	Jö 	Jñ4 	�Z°+¼sÀ<Ó?PÐSTÑ?TÔUô —’˜*Ó%ˆÜ—h’h˜Ó/ˆÜ—h’h˜{Ó+ˆÜ�‹K‰ä—g’g˜a“jˆô �zŠzœ2Ÿ6š6 +Ó.Ð.Ó/Ð0DÐ1DÐE€HØ�?‰?Ó€DØ�?‰?Ó€DØ
€CÜ�1�XˆØ˜S ;¨q¡>Ñ1´C¼¸D»	Ä3ÀtÃ9Ó4MÑMÑMˆÜ×+Ò+¨LÓ9ˆØ�q‘˜C‘  q¡¨C¡°°q±¸C±ÀÀqÁÐJˆð ˆØ"ˆØ‹=Ø#ˆMØ,ˆOð ˆØ‰>˜QÓÜ˜k¨!™n×2Ñ2°1Ó5Ó6‰Kä˜{¨1™~°±Ñ>×EÑEÀaÓHÓIÈEÑQÔTWÐXcÑXfÓTgÑgˆKð 	Ø#Øñà'ñ(ð &ñ&ð ñ	ð
 DñDð ñð ñð ñð 9ñ	9ô �%‹jñ
ð 4ñ4ð NñNð >ñ>ð @ñ@ð ñð  =ñ!=ð" :ñ#:ð$ ñ%ð& ñ'ð( ñ)ð* �Q‰i×Ñ  VÓ,×4Ñ4°S¸&ÓA×IÑIÈ%ÐQSÓTñ+Uð, ñ-ð. ñ/ñ	
‹ñ) ô^ ! Ó%Ð%ùò{ )s   ÁO1c                 ó  • SR                  [        R                  " [        R                  SS95      n[        U 5      n[        U 5      nSU SU SU SU SU S	U S
U SU SU SU SU S3nSU SU SU SU S3	n[        XT-   5        g )Nr   r   r   z
    <html>
    <div id="z _viz_container">
      <div id="zª_viz_header" style="padding:15px;border-style:solid;margin:5px;font-family:sans-serif;font-weight:bold;">
        Visualization Type:
        <select name="viz_type" id="z#_viz_type" onchange="selectVizType_zÌ(this)">
          <option value="heatmap" selected="selected">Input/Output - Heatmap</option>
          <option value="saliency-plot">Saliency Plot</option>
        </select>
      </div>
      <div id="zT_content" style="padding:15px;border-style:solid;margin:5px;">
          <div id = "z!_saliency_plot_container" class="z4_viz_container" style="display:none">
              z(
          </div>

          <div id = "z_heatmap_container" class="z_viz_container">
              z:
          </div>
      </div>
    </div>
    </html>
    z-
    <script>
        function selectVizType_zl(selectObject) {

          /* Hide all viz */

            var elements = document.getElementsByClassName("a  _viz_container")
          for (var i = 0; i < elements.length; i++){
              elements[i].style.display = 'none';
          }

          var value = selectObject.value;
          if ( value === "saliency-plot" ){
              document.getElementById('z”_saliency_plot_container').style.display  = "block";
          }
          else if ( value === "heatmap" ) {
              document.getElementById('zW_heatmap_container').style.display  = "block";
          }
        }
    </script>
    )r5   r6   r7   r8   r9   Úsaliency_plotÚheatmaprD   )rL   rM   Úsaliency_plot_markupÚheatmap_markupÚhtmlÚ
javascripts         r   Útext_to_textrÐ   …  sø   € à�7‰7”6—>’>¤&×"8Ñ"8¸BÑ?Ó@€Dä(¨Ó5ÐÜ˜[Ó)€NðàˆVð Øˆvð %à%) FÐ*MÈdÈVð Tð
 ˆvð Ø�VÐ<¸T¸Fð CØ#Ð$ð %ð �VÐ6°t°fð =ØÐð ð!€Dð. à $˜vð &=ð >B¸Fð C(ð )- vð .(ð )- vð .ð!€Jô, ˜*Ñ+Õ,r   c           
      ó  ^• SR                  [        R                  " [        R                  SS95      n[        U 5      u  p#[        U R                  US S 2S4   SSUS5      u  pEpgnS n	U	" U R                  U5      mU4S jn
U R                  nU
" U 5      nS	nUS
-  nUS-  n[        TR                  S   5       H`  nUSXN   R                  SS5      R                  SS5      R                  SS5      R                  SS5      R                  SS5      -   S-   -  nMb     US-  n[        TR                  S   5       H¹  nUS
-  nUSX¿   R                  SS5      R                  SS5      R                  SS5      R                  SS5      R                  SS5      -   S-   -  n[        TR                  S   5       H3  nUSUU   U   -   S-   [        [        TU   U   S5      5      -   S-   -  nM5     US-  nM»     US-  nSU SU SU S3nU$ )Nr   r   r   r   r   Tc                 ó  • [         R                  " UR                  S   U R                  S   45      nSn[        [	        U5      5       H2  n[         R
                  " XX1U   -   2S S 24   SS9X$S S 24'   X1U   -  nM4     U$ )Nr   r   )Úaxis)rF   r†   r;   rE   r:   r	   )Úshap_matrixrR   Úcompressed_matrixÚcounterÚindexs        r   Úcompress_shap_matrixÚ+saliency_plot.<locals>.compress_shap_matrixÄ  sŠ   € ÜŸHšH k×&7Ñ&7¸Ñ&:¸K×<MÑ<MÈaÑ<PÐ%QÓRÐØˆÜœ3˜{Ó+Ö,ˆEÜ*,¯&ª&°ÀwÐ]bÑQcÑGcÐ=cÒefÐ=fÑ1gÐnoÑ*pÐ¢Q˜hÑ'Ø 5Ñ)Ñ)ŠGñ -ð !Ð r   c           
      óÜ  >• / n[        [        TR                  5       5      [        TR                  5       5      5      n[        TR                  S   5       H’  n/ n[        TR                  S   5       H`  nSSTX54   -  U-  -   n[
        R                  " U5      nS[        US   S-  US   S-  US   S-  US   45      -   nUR                  U5        Mb     UR                  U5        M”     U$ )Nr   r   r!   Úrgbar#   r   r$   )	r
   r   r   rE   r;   r   rG   r>   rx   )	rL   Úinput_colorsr   Ú	row_indexÚinput_colors_rowÚ	col_indexr]   r^   Úcompressed_shap_matrixs	           €r   Ú
get_colorsÚ!saliency_plot.<locals>.get_colorsÑ  sý   ø€ ØˆÜ”3Ð-×1Ñ1Ó3Ó4´cÐ:P×:TÑ:TÓ:VÓ6WÓXˆÜÐ5×;Ñ;¸AÑ>Ö?ˆIØ!ÐÜ"Ð#9×#?Ñ#?ÀÑ#BÖC�	Ø" SÐ+AÀ)ÐBVÑ+WÑ%WÐZ^Ñ%^Ñ^�Ü×3Ò3°LÓA�Ø¤ e¨A¡h°¡n°e¸A±hÀ±nÀeÈAÁhÐQTÁnÐV[Ð\]ÑV^Ð%_Ó!`Ñ`�Ø ×'Ñ'¨Ö.ñ	 Dð
 ×ÑÐ 0Ö1ñ @ð Ðr   za<table border = "1" cellpadding = "5" cellspacing = "5" style="overflow-x:scroll;display:block;">z<tr>z	<th></th>z<th>r*   r+   r,   r-   r.   õ   â–�õ   Ä z</th>z</tr>z<th style="background:z">r$   z</table>ú
        <div id="z_saliency_plot" class="a3  _viz_content">
            <div style="margin:5px;font-family:sans-serif;font-weight:bold;">
                <span style="font-size: 20px;"> Saliency Plot </span>
                <br>
                x-axis: Output Text
                <br>
                y-axis: Input Text
            </div>
            z
        </div>
    )r5   r6   r7   r8   r9   r@   rA   rB   r   r<   rE   r;   rI   r>   rK   )rL   rM   Úunpacked_valuesrP   rQ   r   rR   r‚   r}   rØ   rá   Úmodel_outputrÜ   rV   r_   rÝ   rß   Úsaliency_plot_htmlrà   s                     @r   rÊ   rÊ   ¼  sv  ø€ Ø�7‰7”6—>’>¤&×"8Ñ"8¸BÑ?Ó@€Dä"BÀ;Ó"OÑ€OÜSfØ×Ñ˜/ª!¨Q¨$Ñ/°°B¸
ÀDóTÑP€F�KÐ>Pò!ñ 2°+×2DÑ2DÀkÓRÐõð ×+Ñ+€Lá˜kÓ*€Là
m€Cð ˆ6�M€CØˆ;Ñ€CäÐ)×/Ñ/°Ñ2Ö3ˆØØØ‰i×Ñ  VÓ,×4Ñ4°S¸&ÓA×IÑIÈ%ÐQSÓT×\Ñ\Ð]bÐdfÓg×oÑoÐptÐvxÓyñzàññ	
Šñ 4ð ˆ7�N€CäÐ1×7Ñ7¸Ñ:Ö;ˆ	Øˆv‰ˆØØØÑ%ß‰W�S˜&Ó!ß‰W�S˜&Ó!ß‰W�U˜BÓß‰W�U˜BÓß‰W�T˜2Óñð ññ		
ˆô Ð5×;Ñ;¸AÑ>Ö?ˆIØØ(Ø˜yÑ)¨)Ñ4ñ5àñô ”eÐ2°9Ñ=¸iÑHÈ!ÓLÓMñNð ñ	ñŠCñ @ð 	ˆw‰Šñ) <ð, ˆ:Ñ€CðØ�Ð.¨t¨fð 5ð ˆEð ðÐð Ðr   c                 ó€
  ^^^ ^!• SmSmSR                  [        R                  " [        R                  SS95      m!S nS nU R
                  nU R                  nU" U 5      u  pV0 n0 n0 n	[        [        U R                  R                  5       5      [        U R                  R                  5       5      U5      n
[        [        U5      5       H›  n0 n0 n[        [        U5      5       Hh  nS[        U" U R                  U   U   U
5      5      -   UT!S	-   [        U5      -   '   [        U R                  U   U   S
5      UT!S-   [        U5      -   '   Mj     XÇT! SU S3'   XØT! SU S3'   M�     [        [        U5      5       GHG  n0 n0 n[        X^   S   R                  S   5       H   nS[        U" X^   S   U   U
5      5      -   UT!S-   [        X^   S   U   5      -   S-   '   [        [        X^   S   U   S
5      5      nX^   S   U   S:”  a  US[        X^   S   U   5      -   -  nUUT!S-   [        X^   S   U   5      -   S-   '   M¢     XÇT!S	-   [        U5      -   '   XØT!S	-   [        U5      -   '   0 n[!        X^   S   R#                  5       5       H   u  nnT! S[%        U5       S3UT! SU S3'   M"     UU	T!S	-   [        U5      -   '   GMJ     [&        R(                  " U5      n[&        R(                  " U5      n[&        R(                  " U	5      nST! SU ST! SU ST! SU S3nUU4S jnU" U 5      nSnUUU U!4S jm T " [+        UR-                  5       5      S   UU5      nSn[        [        U5      5       Hz  nUST! SU ST! S	U ST! S T! S!T! S"3UU   R/                  S#S$5      R/                  S%S&5      R/                  S'S5      R/                  S(S5      R/                  S)S5      -   S*-   S+-   -  nM|     S,T! S-T! S.T! S/T! S0T! S1T! S2T! S3T! S4T! S5U S6T! S7T! S8T! S9U S:3nSR                  / S;PT! PS<PT! PS=PT! PS>PT! PS?PT! PS@PT! PSAPT! PSBPT! PSCPT! PSDPT! PSEPT! PSFPT! PSGPT! PS@PT! PSHPT! PSIPT! PSCPT! PSDPT! PSEPT! PSFPT! PSJPT! PS@PT! PSKPT! PSLPT! PSMPT! PSNPT! PSOPT! PSPPT! PSQPT! PSRPT! PSDPT! PSSPT! PSTPT! PSDPT! PSUPT! PSVPT! PSWPT! PSXPT! PSYPT! PSZPT! PSFPT! PS[PT! PS\PT! PS]PT! PS^PT! PS_PT! PS`PT! PSaPT! PSbPT! PS\PT! PScPT! PSdPT! PSeP5      nUU-   U-   $ )fNrQ   Úchildrenr   r   r   c                 ó~   • SSU -  U-  -   n[         R                  " U5      nUS   S-  US   S-  US   S-  US   4nU$ )Nr!   r   r#   r   r   r$   )r   rG   )Ú
shap_valuer   r]   r^   s       r   Ú	get_colorÚheatmap.<locals>.get_color   sU   € Ø˜S :Ñ-°Ñ4Ñ4ˆÜ×+Ò+¨LÓ9ˆØ�q‘˜C‘  q¡¨C¡°°q±¸C±ÀÀqÁÐJˆØˆr   c           	      ó"  • / n[        U 5      u  p#Sn[        U R                  5       Hc  u  pV[        U R                  US S 2U4   SSUS5      u  pxpšnUUU	U
US.nUR                  U5        [        U[        R                  " U5      5      nMe     X4$ )Nr   r   r   T)rQ   r   rR   r‚   r}   )r@   r?   r<   rA   rB   rx   r
   rF   )rL   Úprocessed_valuesræ   rP   Úmax_valr×   Úoutput_tokenrQ   r   rR   r‚   r}   Úprocessed_values                r   Ú process_text_to_text_shap_valuesÚ1heatmap.<locals>.process_text_to_text_shap_values&  sª   € ØÐä&FÀ{Ó&SÑ#ˆØˆä#,¨[×-EÑ-EÖ#FÑˆEÜ[nØ× Ñ  /²!°U°(Ñ";¸QÀÀJÐPTó\ÑXˆF˜KÐFXð !Ø Ø*Ø/JØ&8ñˆOð ×#Ñ# OÔ4Ü˜'¤2§6¢6¨&£>Ó2ŠGñ $Gð  Ð(Ð(r   rÛ   Ú_output_flat_token_r$   Ú_output_flat_value_label_Ú_input_node_Ú_contentr}   r   r   rR   r   Ú/Ú_labelr‚   z<script> colors_z = z
 shap_values_z
 token_id_to_node_id_mapping_z
</script> 
 c                 óv  >• [        U R                  5      n0 n[        U5       H)  n0 nU R                  U   UT'   0 UT
'   XB[        U5      '   M+     UnU R                   HV  n[        [        US   5      5      n[        [        US   5      5      n0 n	XrU   X‚U   0U	T
'   X’[        U5      '   US-  nX'	 X(	 MX     U$ rw   )r:   rB   rE   r>   rP   rn   )rL   Ú
num_tokensÚ
token_listr×   Únode_contentrÖ   ÚpairÚ
first_nodeÚsecond_nodeÚnew_node_contentÚTREE_NODE_KEY_CHILDRENÚTREE_NODE_KEY_TOKENSs             €€r   Úgenerate_treeÚheatmap.<locals>.generate_tree…  sã   ø€ Ü˜×)Ñ)Ó*ˆ
Øˆ
ä˜:Ö&ˆEØˆLØ1<×1AÑ1AÀ%Ñ1HˆLÐ-Ñ.Ø35ˆLÐ/Ñ0Ø%1”s˜5“zÓ"ñ	 'ð ˆØ×*Ô*ˆDÜœS  a¡›\Ó*ˆJÜœc $ q¡'›lÓ+ˆKà!Ðà zÑ2Ø¨Ñ4ð8ÐÐ3Ñ4ð
 (8”s˜7“|Ñ$Ø�q‰LˆGàÐ&ØÒ'ñ +ð  Ðr   c                 óÎ  >• X   nUST	 SU  S3-  nUST	 SU  S3-  nUS-  nX   T   (       a?  UST	 SU  S3-  nX   T   R                  5        H  u  pET" XAU    T   U5      nM     US-  nOrUST	 SU  ST	 ST	 S	T	 S
3-  nUUT   R                  SS5      R                  SS5      R                  SS5      R                  SS5      R                  SS5      -  nUS-  nUS-  nU$ )Nz	<div id="rø   z5_container" style="display:inline;text-align:center">z@_label" style="display:none; padding-top: 0px; font-size:12px;">r(   z"_content" style="display:inline;">z™_content"style='display: inline; background:transparent; border-radius: 3px; padding: 0px;cursor: default;cursor: pointer;'onmouseover="onMouseHoverFlat_ú&(this.id)" onmouseout="onMouseOutFlat_ú%(this.id)" onclick="onMouseClickFlat_ú(this.id)" >r*   r+   r,   r-   r.   r   rã   rä   )ÚitemsrI   )
Úinput_indexÚtoken_list_subtreeÚinput_text_htmlÚcontentÚchild_indexÚchild_contentr  r  Úpopulate_input_treerM   s
         €€€€r   r  Ú$heatmap.<locals>.populate_input_tree©  sl  ø€ Ø$Ñ1ˆØØ˜�v˜\¨+¨Ð6kÐlñ	
ˆð 	Ø˜�v˜\¨+¨Ð6vÐwñ	
ˆð 	˜8Ñ#ˆàÑ*Ð+A×BØ ¨4¨&°¸[¸MÐIkÐlÑlˆOØ.@Ñ.MÐNdÑ.e×.kÑ.kÖ.mÑ*�Ù"5Ø°KÑ!@ÐAWÑ!XÐZió#’ñ /nð ˜xÑ'‰OàØ˜D˜6 ¨k¨]ð ;1à15°ð 7.Ø.2¨Vð 4-Ø-1¨Fð 3ð	ñˆOð ØÐ,Ñ-ß‘˜˜fÓ%ß‘˜˜fÓ%ß‘˜ Ó#ß‘˜ Ó#ß‘˜˜rÓ"ñˆOð ˜xÑ'ˆOà˜8Ñ#ˆàÐr   z9<div style='display:inline; text-align:center;'><div id='zT'style='display:none;color: #999; padding-top: 0px; font-size:12px;'></div><div id='z‘'style='display: inline; background:transparent; border-radius: 3px; padding: 0px;cursor: default;cursor: pointer;'onmouseover="onMouseHoverFlat_r	  r
  r  r*   r+   r,   r-   r.   rã   rä   z </div>r(   rå   z_heatmap" class="z"_viz_content">
          <div id="a[  _heatmap_header" style="padding:15px;margin:5px;font-family:sans-serif;font-weight:bold;">
            <div style="display:inline">
              <span style="font-size: 20px;"> Input/Output - Heatmap </span>
            </div>
            <div style="display:inline;float:right">
              Layout :
              <select name="alignment" id="z&_alignment" onchange="selectAlignment_zê(this)">
                <option value="left-right" selected="selected">Left/Right</option>
                <option value="top-bottom">Top/Bottom</option>
              </select>
            </div>
          </div>
          <div id="z>_heatmap_content" style="display:flex;">
            <div id="ze_input_container" style="padding:15px;border-style:solid;margin:5px;flex:1;">
              <div id="z¥_input_header" style="margin:5px;font-weight:bold;font-family:sans-serif;margin-bottom:10px">
                Input Text
              </div>
              <div id="zN_input_content" style="margin:5px;font-family:sans-serif;">
                  z>
              </div>
            </div>
            <div id="zf_output_container" style="padding:15px;border-style:solid;margin:5px;flex:1;">
              <div id="z§_output_header" style="margin:5px;font-weight:bold;font-family:sans-serif;margin-bottom:10px">
                Output Text
              </div>
              <div id="zO_output_content" style="margin:5px;font-family:sans-serif;">
                  zM
              </div>
            </div>
          </div>
        </div>
    z7
        <script>
            function selectAlignment_z›(selectObject) {
                var value = selectObject.value;
                if ( value === "left-right" ){
                  document.getElementById('zž_heatmap_content').style.display  = "flex";
                }
                else if ( value === "top-bottom" ) {
                  document.getElementById('z__heatmap_content').style.display  = "inline";
                }
            }

            var zC_heatmap_flat_state = null;

            function onMouseHoverFlat_z(id) {
                if (zH_heatmap_flat_state === null) {
                    setBackgroundColors_zˆ(id);
                    document.getElementById(id).style.backgroundColor  = "grey";
                }

                if (getIdSide_z(id) === 'input' && getIdSide_r'   zh_heatmap_flat_state) === 'output'){

                    label_content_id = token_id_to_node_id_mapping_Ú[aW  _heatmap_flat_state][id];

                    if (document.getElementById(label_content_id).previousElementSibling.style.display == 'none'){
                        document.getElementById(label_content_id).style.textShadow = "0px 0px 1px #000000";
                    }

                }

            }

            function onMouseOutFlat_zI_heatmap_flat_state === null) {
                    cleanValuesAndColors_z�(id);
                    document.getElementById(id).style.backgroundColor  = "transparent";
                }

                if (getIdSide_aM  _heatmap_flat_state][id];

                    if (document.getElementById(label_content_id).previousElementSibling.style.display == 'none'){
                        document.getElementById(label_content_id).style.textShadow = "inherit";
                    }

                }

            }

            function onMouseClickFlat_zâ_heatmap_flat_state === id) {

                    // If the clicked token was already selected

                    document.getElementById(id).style.backgroundColor  = "transparent";
                    cleanValuesAndColors_z(id);
                    z]_heatmap_flat_state = null;
                }
                else {
                    if (z�_heatmap_flat_state === null) {

                        // No token previously selected, new token clicked on

                        cleanValuesAndColors_z(id)
                        z–_heatmap_flat_state = id;
                        document.getElementById(id).style.backgroundColor  = "grey";
                        setLabelValues_z2(id);
                        setBackgroundColors_z](id);
                    }
                    else {
                        if (getIdSide_z#_heatmap_flat_state) === getIdSide_z (id)) {

                            // User clicked a token on the same side as the currently selected token

                            cleanValuesAndColors_zI_heatmap_flat_state)
                            document.getElementById(zY_heatmap_flat_state).style.backgroundColor  = "transparent";
                            zž_heatmap_flat_state = id;
                            document.getElementById(id).style.backgroundColor  = "grey";
                            setLabelValues_z6(id);
                            setBackgroundColors_zi(id);
                        }
                        else{

                            if (getIdSide_zc(id) === 'input') {
                                label_content_id = token_id_to_node_id_mapping_a=  _heatmap_flat_state][id];

                                if (document.getElementById(label_content_id).previousElementSibling.style.display == 'none') {
                                    document.getElementById(label_content_id).previousElementSibling.style.display = 'block';
                                    document.getElementById(label_content_id).parentNode.style.display = 'inline-block';
                                    document.getElementById(label_content_id).style.textShadow = "0px 0px 1px #000000";
                                  }
                                else {
                                    document.getElementById(label_content_id).previousElementSibling.style.display = 'none';
                                    document.getElementById(label_content_id).parentNode.style.display = 'inline';
                                    document.getElementById(label_content_id).style.textShadow  = "inherit";
                                  }

                            }
                            else {
                                if (document.getElementById(id).previousElementSibling.style.display == 'none') {
                                    document.getElementById(id).previousElementSibling.style.display = 'block';
                                    document.getElementById(id).parentNode.style.display = 'inline-block';
                                  }
                                else {
                                    document.getElementById(id).previousElementSibling.style.display = 'none';
                                    document.getElementById(id).parentNode.style.display = 'inline';
                                  }
                            }

                        }
                    }

                }
            }

            function setLabelValues_z6(id) {
                for(const token in shap_values_zR[id]){
                    document.getElementById(token).innerHTML = shap_values_zy[id][token];
                    document.getElementById(token).nextElementSibling.title = 'SHAP Value : ' + shap_values_zW[id][token];
                }
            }

            function setBackgroundColors_z1(id) {
                for(const token in colors_zZ[id]){
                    document.getElementById(token).style.backgroundColor  = colors_zX[id][token];
                }
            }

            function cleanValuesAndColors_zÙ[id]){
                    document.getElementById(token).innerHTML = "";
                    document.getElementById(token).nextElementSibling.title = "";
                }
                 for(const token in colors_a®  [id]){
                    document.getElementById(token).style.backgroundColor  = "transparent";
                    document.getElementById(token).previousElementSibling.style.display = 'none';
                    document.getElementById(token).parentNode.style.display = 'inline';
                    document.getElementById(token).style.textShadow  = "inherit";
                }
            }

            function getIdSide_z«(id) {
                if (id === null) {
                    return 'null'
                }
                return id.split("_")[1];
            }
        </script>
    )r5   r6   r7   r8   r9   rB   r<   r
   r   r   r   rE   r:   r>   rK   r;   r?   Útolistrn   ÚjsonÚdumpsÚlistÚkeysrI   )"rL   rí   rô   Úmodel_inputrç   rð   rñ   Úcolors_dictÚshap_values_dictr‚   r   rÝ   Úcolor_valuesÚshap_values_listrß   Úshap_label_value_strÚ token_id_to_node_id_mapping_dictr×   Únode_idÚcolors_jsonÚshap_values_jsonÚ token_id_to_node_id_mapping_jsonÚjavascript_valuesr  Útreer  Úoutput_text_htmlrN   Úheatmap_htmlÚheatmap_javascriptr  r  r  rM   s"                                 @@@@r   rË   rË     st  û€ ð $ÐØ'Ðà�7‰7”6—>’>¤&×"8Ñ"8¸BÑ?Ó@€Dòò)ð0 ×"Ñ"€KØ×+Ñ+€Lá @ÀÓ MÑÐð €KØÐØ"$ÐÜŒs�;×%Ñ%×)Ñ)Ó+Ó,¬c°+×2DÑ2D×2HÑ2HÓ2JÓ.KÈWÓU€Dô œ3˜{Ó+Ö,ˆ	ØˆØÐäœs <Ó0Ö1ˆIØJPÔSVÙ˜+×,Ñ,¨YÑ7¸	ÑBÀDÓIóTñ KˆL˜Ð 5Ñ5¼¸I»ÑFÑGô UZØ×"Ñ" 9Ñ-¨iÑ8¸!óUÐ˜TÐ$?Ñ?Ä#ÀiÃ.ÑPÓQñ	 2ð AM�t�f˜L¨¨°8Ð<Ñ=ØEU˜D˜6 ¨i¨[¸ÐAÓBñ -ô" œ3˜|Ó,×-ˆ	ØˆØÐäÐ/Ñ:Ð;OÑP×VÑVÐWXÑYÖZˆIð œ™YÐ'7Ñ'BÀ8Ñ'LÈYÑ'WÐY]Ó^Ó_Ñ_ð Ø�~Ñ%¬Ð,<Ñ,GÐH\Ñ,]Ð^gÑ,hÓ(iÑiÐlvÑvñô $'¤uÐ-=Ñ-HÈÑ-RÐS\Ñ-]Ð_`Ó'aÓ#bÐ ØÑ*¨=Ñ9¸)ÑDÀqÓHØ$¨¬cÐ2BÑ2MÈmÑ2\Ð]fÑ2gÓ.hÑ(hÑhÐ$ð %ð Ø�~Ñ%¬Ð,<Ñ,GÐH\Ñ,]Ð^gÑ,hÓ(iÑiÐltÑtóñ [ð FR�DÐ0Ñ0´3°y³>ÑAÑBØJZ˜Ð 5Ñ5¼¸I»ÑFÑGà+-Ð(ä'Ð(8Ñ(CÐDaÑ(b×(iÑ(iÓ(kÖl‰NˆE�7à�&˜¤S¨£\ N°(Ð;ð -°¨v°\À%ÀÈÐ-QÓRñ mð
 VvÐ# DÐ+@Ñ$@Ä3ÀyÃ>Ñ$QÔRñ5 .ô: —*’*˜[Ó)€KÜ—z’zÐ"2Ó3ÐÜ'+§z¢zÐ2MÓ'NÐ$ð	Ø��s˜;˜-ð (Ø�v˜SÐ!1Ð 2ð 3(Ø(, v¨SÐ1QÐ0Rð Sð	ð öñ: ˜Ó%€Dð
 €O÷(ð (ñT *¬$¨t¯y©y«{Ó*;¸AÑ*>ÀÀoÓV€Oð Ðä”3�|Ó$Ö%ˆØðØ�vÐ6°q°cð :ð �vÐ0°°ð 4-à-1¨Fð 3*Ø*.¨ð 0)Ø)-¨ð /ð	ð ˜1‰oß‰W�S˜&Ó!ß‰W�S˜&Ó!ß‰W�U˜BÓß‰W�U˜BÓß‰W�T˜2Óñð  ñ!ð" ñ#ñ	
Òñ &ð,Ø�Ð(¨¨ð /Ø�6ð ,ð -1¨6Ð1WÐX\ÐW]ð ^ð �6ð Ø�Vð Ø�vð ð �vð Ø"Ð#ð $ð �Vð Ø�vð ð �vð Ø#Ð$ð %ð9!€L÷FUó Uð &ð Uà&* VðUð,,ðUð
 -1¨6ðUð
2,ðUð -1¨6ðUð2ðUð �ðUð'ðUð (, fðUð-ðUð �FðUð)ðUð  *.¨ð!Uð /ð!Uð(  $˜fð)Uð( %Cð)Uð( DHÀ&ð)Uð( IJð)Uð( KOÈð)Uð(PDð)Uð, EIÀ6ð-Uð, JKð-Uð, LPÈ&ð-Uð,
Q%ð-Uð@ &* FðAUð@+ðAUðB �FðCUðB*ðCUðD +/¨ðEUðD0ðEUðL  $˜fðMUðL %CðMUðL DHÀ&ðMUðL IJðMUðL KOÈðMUðLPDðMUðP EIÀ6ðQUðP JKðQUðP LPÈ&ðQUðP
Q'ðQUðd (, fðeUðd-ðeUðf �FðgUðf*ðgUðp +/¨ðqUðp0ðqUðr �FðsUðrðsUðx ˜ðyUðx.ðyUð@ /3¨VðAUð@4ðAUðB ˜ðCUðB(ðCUðF )- vðGUðF.-ðGUðH .2¨FðIUðH3'ðIUðN (, fðOUðN -.ðOUðN /3¨VðOUðN 4WðOUðN X\ÐV\ðOUðN]2ðOUðV 37°ðWUðV 89ðWUðV :>¸ðWUðV?5ðWUðX 6:°FðYUðX;ðYUðZ "˜Fð[UðZ#,ð[Uð^ -1¨6ð_Uð^21ð_Uð` 26°ðaUð`7+ðaUðh ,0¨&ðiUðh1PðiUðj QUÈvðkUðj VWðkUðj X\ÐV\ðkUðj]%ðkUðh &* FðiUðh+0ðiUðj 15¨vðkUðj6LðkUðl MQÈ6ðmUðlRmðmUðn nrÐlrðoUðns*ðoUðv +/¨ðwUðv0+ðwUðx ,0¨&ðyUðx1TðyUðz UYÐSYð{UðzZ+ð{UðB ,0¨&ðCUðB10ðCUðD 15¨vðEUðD6,ðEUðL -1¨6ðMUðL2 ðMUð\ !%˜vð]Uð\&ô]UÐðn Ð,Ñ,Ð/@Ñ@Ð@r   c                 ó„   • [        U SS 5      nUc  U R                  n[        U SS 5      n[        R                  " U5      U4$ )NÚhierarchical_valuesrP   )Úgetattrr   rF   r‡   )rL   r   rP   s      r   r@   r@   «  sC   € Ü�[Ð"7¸Ó>€FØ�~Ø×#Ñ#ˆÜ˜ l°DÓ9€Jä�8Š8�FÓ˜ZÐ'Ð'r   c                 óZ   • [         (       d  Sn[        U5      e[        [        U 5      5      $ )z-Check IPython is installed, then display HTMLz`IPython is required for this function but is not installed. Fix this with `pip install ipython`.)Úhave_ipythonÚImportErrorÚipython_displayr   )rB   Úmsgs     r   rD   rD   ´  s&   € çŠ<ØpˆÜ˜#ÓÐÜœ4 ›:Ó&Ð&r   )r   g{®Gáz„?r   NNNT)NF)Nr   r   r   )r  r6   r8   rÂ   ÚnumpyrF   r   r   ÚIPython.displayr   r   r1  r/  r0  rC   rA   rJ   rÈ   rÐ   rÊ   rË   r@   rD   r�   r   r   Ú<module>r5     s�   ðÛ Û Û Û ã å ðÝ$Ý:à€Lð ØØØ	Ø	Ø	ØôbôJu+òpxôvU&òp4-ònYòxPAòf(ó'øðK- ó Ø‚Lðús   œA ÁAÁA