§
    rŠtj±T  ã                   ót  — d Z ddlmZ ddlmZmZ ddlmZ ddlZ	ddl
Z
ddlmZ ddlmZ ddlmZ dd	lmZmZmZmZmZ dd
lmZ dZdZddgddgddgddgddgddggZg d¢ZddgddgddgddgddgddggZg d¢Zg d¢Zd„ Z d„ Z!e
j"         #                    de$e	j%        g¦  «        d„ ¦   «         Z&d„ Z'e
j"         #                    deez   ¦  «        d„ ¦   «         Z(d„ Z)d„ Z*d„ Z+e
j"         #                    de$e	j%        g¦  «        d„ ¦   «         Z,d „ Z-e
j"         #                    d!g d"¢¦  «        d#„ ¦   «         Z.d$„ Z/dS )%zG
Testing for export functions of decision trees (sklearn.tree.export).
é    )ÚStringIO)ÚfinditerÚsearch)ÚdedentN)ÚRandomState)Úis_classifier)ÚNotFittedError)ÚDecisionTreeClassifierÚDecisionTreeRegressorÚexport_graphvizÚexport_textÚ	plot_tree©Ú_rgb_to_hexstring)ÚginiÚlog_loss)Úsquared_errorÚabsolute_errorÚpoissonéþÿÿÿéÿÿÿÿé   é   )r   r   r   r   r   r   é   )r   r   r   ç      à?r   r   )r   r   r   r   r   r   c                  ó0   — t          d¦  «        dk    sJ ‚dS )zÃ
    Test that _rgb_to_hexstring correctly converts an RGB tuple to a hex color string.

    A previous bug caused incorrect hex color string generation for zero values
    in the RGB tuple.
    )r   éÿ   r   z#00ff00Nr   © ó    ú\/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sklearn/tree/tests/test_export.pyÚtest_rgb_to_hexstringr!   #   s#   € õ ˜[Ñ)Ô)¨YÒ6Ð6Ð6Ð6Ð6Ð6r   c            
      ó&  — t          dddd¬¦  «        } |                      t          t          ¦  «         t	          | d ¬¦  «        }d}||k    sJ ‚t	          | ddgd ¬	¦  «        }d
}||k    sJ ‚t	          | ddgd ¬	¦  «        }d}||k    sJ ‚t	          | ddgd ¬¦  «        }d}||k    sJ ‚t	          | ddgd ¬¦  «        }d}||k    sJ ‚t	          | dddddd d¬¦  «        }d}||k    sJ ‚t	          | ddd ¬¦  «        }d}||k    sJ ‚t	          | ddd d¬¦  «        }d}||k    sJ ‚t          dddd¬¦  «        } |                      t          t
          t          ¬¦  «        } t	          | ddd ¬ ¦  «        }d!}||k    sJ ‚t          ddd"d¬¦  «        } |                      t          t          ¦  «         t	          | ddd ddd¬#¦  «        }d$}||k    sJ ‚t          d¬%¦  «        } |                      t          t          ¦  «         t	          | dd ¬&¦  «        }d'}d S )(Nr   r   r   ©Ú	max_depthÚmin_samples_splitÚ	criterionÚrandom_state©Úout_filea„  digraph Tree {
node [shape=box, fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="x[0] <= 0.0\ngini = 0.5\nsamples = 6\nvalue = [3, 3]"] ;
1 [label="gini = 0.0\nsamples = 3\nvalue = [3, 0]"] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="gini = 0.0\nsamples = 3\nvalue = [0, 3]"] ;
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
}Úfeature0Úfeature1©Úfeature_namesr)   áˆ  digraph Tree {
node [shape=box, fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="feature0 <= 0.0\ngini = 0.5\nsamples = 6\nvalue = [3, 3]"] ;
1 [label="gini = 0.0\nsamples = 3\nvalue = [3, 0]"] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="gini = 0.0\nsamples = 3\nvalue = [0, 3]"] ;
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
}z
feature"0"z
feature"1"aŒ  digraph Tree {
node [shape=box, fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="feature\"0\" <= 0.0\ngini = 0.5\nsamples = 6\nvalue = [3, 3]"] ;
1 [label="gini = 0.0\nsamples = 3\nvalue = [3, 0]"] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="gini = 0.0\nsamples = 3\nvalue = [0, 3]"] ;
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
}ÚyesÚno©Úclass_namesr)   áª  digraph Tree {
node [shape=box, fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="x[0] <= 0.0\ngini = 0.5\nsamples = 6\nvalue = [3, 3]\nclass = yes"] ;
1 [label="gini = 0.0\nsamples = 3\nvalue = [3, 0]\nclass = yes"] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="gini = 0.0\nsamples = 3\nvalue = [0, 3]\nclass = no"] ;
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
}z"yes"z"no"a¶  digraph Tree {
node [shape=box, fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="x[0] <= 0.0\ngini = 0.5\nsamples = 6\nvalue = [3, 3]\nclass = \"yes\""] ;
1 [label="gini = 0.0\nsamples = 3\nvalue = [3, 0]\nclass = \"yes\""] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="gini = 0.0\nsamples = 3\nvalue = [0, 3]\nclass = \"no\""] ;
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
}TFÚsans)ÚfilledÚimpurityÚ
proportionÚspecial_charactersÚroundedr)   Úfontnameaí  digraph Tree {
node [shape=box, style="filled, rounded", color="black", fontname="sans"] ;
edge [fontname="sans"] ;
0 [label=<x<SUB>0</SUB> &le; 0.0<br/>samples = 100.0%<br/>value = [0.5, 0.5]>, fillcolor="#ffffff"] ;
1 [label=<samples = 50.0%<br/>value = [1.0, 0.0]>, fillcolor="#e58139"] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label=<samples = 50.0%<br/>value = [0.0, 1.0]>, fillcolor="#399de5"] ;
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
}r   )r$   r2   r)   zâdigraph Tree {
node [shape=box, fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="x[0] <= 0.0\ngini = 0.5\nsamples = 6\nvalue = [3, 3]\nclass = y[0]"] ;
1 [label="(...)"] ;
0 -> 1 ;
2 [label="(...)"] ;
0 -> 2 ;
})r$   r5   r)   Únode_idsa;  digraph Tree {
node [shape=box, style="filled", color="black", fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="node #0\nx[0] <= 0.0\ngini = 0.5\nsamples = 6\nvalue = [3, 3]", fillcolor="#ffffff"] ;
1 [label="(...)", fillcolor="#C0C0C0"] ;
0 -> 1 ;
2 [label="(...)", fillcolor="#C0C0C0"] ;
0 -> 2 ;
})Úsample_weight)r5   r6   r)   aÏ  digraph Tree {
node [shape=box, style="filled", color="black", fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="x[0] <= 0.0\nsamples = 6\nvalue = [[3.0, 1.5, 0.0]\n[3.0, 1.0, 0.5]]", fillcolor="#ffffff"] ;
1 [label="samples = 3\nvalue = [[3, 0, 0]\n[3, 0, 0]]", fillcolor="#e58139"] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="x[0] <= 1.5\nsamples = 3\nvalue = [[0.0, 1.5, 0.0]\n[0.0, 1.0, 0.5]]", fillcolor="#f1bd97"] ;
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
3 [label="samples = 2\nvalue = [[0, 1, 0]\n[0, 1, 0]]", fillcolor="#e58139"] ;
2 -> 3 ;
4 [label="samples = 1\nvalue = [[0.0, 0.5, 0.0]\n[0.0, 0.0, 0.5]]", fillcolor="#e58139"] ;
2 -> 4 ;
}r   )r5   Úleaves_parallelr)   Úrotater9   r:   aT  digraph Tree {
node [shape=box, style="filled, rounded", color="black", fontname="sans"] ;
graph [ranksep=equally, splines=polyline] ;
edge [fontname="sans"] ;
rankdir=LR ;
0 [label="x[0] <= 0.0\nsquared_error = 1.0\nsamples = 6\nvalue = 0.0", fillcolor="#f2c09c"] ;
1 [label="squared_error = 0.0\nsamples = 3\nvalue = -1.0", fillcolor="#ffffff"] ;
0 -> 1 [labeldistance=2.5, labelangle=-45, headlabel="True"] ;
2 [label="squared_error = 0.0\nsamples = 3\nvalue = 1.0", fillcolor="#e58139"] ;
0 -> 2 [labeldistance=2.5, labelangle=45, headlabel="False"] ;
{rank=same ; 0} ;
{rank=same ; 1; 2} ;
}©r$   )r5   r)   z¾digraph Tree {
node [shape=box, style="filled", color="black", fontname="helvetica"] ;
edge [fontname="helvetica"] ;
0 [label="gini = 0.0\nsamples = 6\nvalue = 6.0", fillcolor="#ffffff"] ;
})	r
   ÚfitÚXÚyr   Úy2Úwr   Ú
y_degraded)ÚclfÚ	contents1Ú	contents2s      r    Útest_graphviz_toyrI   .   s:  € å
 Ø q°FÈðñ ô €Cð ‡G‚G�A�q�M„M€Mõ   ¨dÐ3Ñ3Ô3€Ið	ð ð ˜	Ò!Ð!Ð!Ð!õ  Ø˜J¨
Ð3¸dðñ ô €Ið	ð ð ˜	Ò!Ð!Ð!Ð!õ  Ø˜L¨,Ð7À$ðñ ô €Ið	ð ð  ˜	Ò!Ð!Ð!Ð!õ   °%¸°ÈÐNÑNÔN€Ið	ð ð" ˜	Ò!Ð!Ð!Ð!õ   °'¸6Ð1BÈTÐRÑRÔR€Ið	ð ð" ˜	Ò!Ð!Ð!Ð!õ  ØØØØØØØØð	ñ 	ô 	€Ið	ð ð$ ˜	Ò!Ð!Ð!Ð!õ   ¨q¸dÈTÐRÑRÔR€Ið		ð ð ˜	Ò!Ð!Ð!Ð!õ  Ø�q °¸tðñ ô €Ið
	ð ð ˜	Ò!Ð!Ð!Ð!õ !Ø q°FÈðñ ô €Cð �'Š'•!•R¥qˆ'Ñ
)Ô
)€Cå ¨D¸5È4ÐPÑPÔP€Ið	ð ð4 ˜	Ò!Ð!Ð!Ð!õ  Ø q°OÐRSðñ ô €Cð ‡G‚G�A�q�M„M€MåØØØØØØØðñ ô €Ið	ð ð. ˜	Ò!Ð!Ð!Ð!õ !¨1Ð
-Ñ
-Ô
-€CØ‡G‚G�A�zÑÔÐå ¨D¸4Ð@Ñ@Ô@€Ið	ð €I€Ir   Úconstructorc                 ó  — t          dddd¬¦  «        }|                     t          t          ¦  «         t	          | | ddg¦  «        d ¬¦  «        }d}||k    sJ ‚t	          | | d	d
g¦  «        d ¬¦  «        }d}||k    sJ ‚d S )Nr   r   r   r#   r*   r+   r,   r.   r/   r0   r1   r3   )r
   r@   rA   rB   r   )rJ   rF   rG   rH   s       r    Ú/test_graphviz_feature_class_names_array_supportrL   ;  sË   € õ !Ø q°FÈðñ ô €Cð ‡G‚G�A�q�M„M€Mõ  Ø˜;˜;¨
°JÐ'?Ñ@Ô@È4ðñ ô €Ið	ð ð ˜	Ò!Ð!Ð!Ð!õ  Ø˜˜ e¨T ]Ñ3Ô3¸dðñ ô €Ið	ð ð" ˜	Ò!Ð!Ð!Ð!Ð!Ð!r   c                  ó,  — t          dd¬¦  «        } t          ¦   «         }t          j        t          ¦  «        5  t          | |¦  «         d d d ¦  «         n# 1 swxY w Y   |                      t          t          ¦  «         d}t          j        t          |¬¦  «        5  t          | d dg¬¦  «         d d d ¦  «         n# 1 swxY w Y   d}t          j        t          |¬¦  «        5  t          | d g d	¢¬¦  «         d d d ¦  «         n# 1 swxY w Y   d
}t          j        t          |¬¦  «        5  t          | d ddg¬¦  «         d d d ¦  «         n# 1 swxY w Y   d}t          j        t          |¬¦  «        5  t          |                      t          t          ¦  «        j        ¦  «         d d d ¦  «         n# 1 swxY w Y   t          ¦   «         }t          j        t          ¦  «        5  t          | |g ¬¦  «         d d d ¦  «         d S # 1 swxY w Y   d S )Nr   r   )r$   r%   z?Length of feature_names, 1 does not match number of features, 2©ÚmatchÚa©r-   z?Length of feature_names, 3 does not match number of features, 2)rP   ÚbÚcz"All feature names must be strings.r   zis not an estimator instance©r2   )r
   r   ÚpytestÚraisesr	   r   r@   rA   rB   Ú
ValueErrorÚ	TypeErrorÚtree_Ú
IndexError)rF   ÚoutÚmessages      r    Útest_graphviz_errorsr]   q  sx  € å
 ¨1ÀÐ
BÑ
BÔ
B€Cõ ‰*Œ*€CÝ	Œ•~Ñ	&Ô	&ð "ð "Ý˜˜SÑ!Ô!Ð!ð"ð "ð "ñ "ô "ð "ð "ð "ð "ð "ð "øøøð "ð "ð "ð "ð ‡G‚G�A�q�M„M€Mð P€GÝ	Œ•z¨Ð	1Ñ	1Ô	1ð 8ð 8Ý˜˜T°#°Ð7Ñ7Ô7Ð7ð8ð 8ð 8ñ 8ô 8ð 8ð 8ð 8ð 8ð 8ð 8øøøð 8ð 8ð 8ð 8ð P€GÝ	Œ•z¨Ð	1Ñ	1Ô	1ð Bð BÝ˜˜T°°°ÐAÑAÔAÐAðBð Bð Bñ Bô Bð Bð Bð Bð Bð Bð Bøøøð Bð Bð Bð Bð 3€GÝ	Œ•z¨Ð	1Ñ	1Ô	1ð ;ð ;Ý˜˜T°#°q°Ð:Ñ:Ô:Ð:ð;ð ;ð ;ñ ;ô ;ð ;ð ;ð ;ð ;ð ;ð ;øøøð ;ð ;ð ;ð ;ð -€GÝ	Œ•y¨Ð	0Ñ	0Ô	0ð -ð -Ý˜Ÿš¥¥1™œÔ+Ñ,Ô,Ð,ð-ð -ð -ñ -ô -ð -ð -ð -ð -ð -ð -øøøð -ð -ð -ð -õ ‰*Œ*€CÝ	Œ•zÑ	"Ô	"ð 2ð 2Ý˜˜S¨bÐ1Ñ1Ô1Ð1ð2ð 2ð 2ñ 2ô 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2øøøð 2ð 2ð 2ð 2ð 2ð 2sk   ¹AÁAÁAÂB>Â>CÃCÃ&DÄDÄDÄ/EÅEÅEÅ83F7Æ7F;Æ>F;Ç)H	È	HÈHr&   c                 ót  — t          ¦   «         }| t          v }|rt          nt          } |d| ¬¦  «        }|rd„ t          D ¦   «         nt          }|                     t          |¦  «         t          ||¬¦  «         t          d| 	                    ¦   «         ¦  «        D ]}| | 
                    ¦   «         v sJ ‚Œd S )Nr   )r'   r&   c                 ó   — g | ]}|d z   ‘ŒS )r   r   )Ú.0Úyis     r    ú
<listcomp>z@test_criterion_in_gradient_boosting_graphviz.<locals>.<listcomp>ž  s   € Ð	Ð	Ð	�Rˆ"ˆq‰&Ð	Ð	Ð	r   r(   z\[.*?samples.*?\])r   ÚREG_CRITERIONSr   r
   rB   r@   rA   r   r   ÚgetvalueÚgroup)r&   Údot_dataÚis_regÚTreerF   Úy_Úfindings          r    Ú,test_criterion_in_gradient_boosting_graphvizrk   –  sÈ   € å‰zŒz€Hà�.Ð(€FØ$*ÐFÕ Ð Õ0F€DØ
ˆ$˜A¨Ð
3Ñ
3Ô
3€Cà!'Ð	.Ð	Ð	�1Ð	Ñ	Ô	Ð	­Q€BØ‡G‚G�Aˆr�N„N€NÝ�C (Ð+Ñ+Ô+Ð+åÐ0°(×2CÒ2CÑ2EÔ2EÑFÔFð ,ð ,ˆØ˜GŸMšM™OœOÐ+Ð+Ð+Ð+Ð+ð,ð ,r   c            
      ó  — t          d¦  «        } t          d¦  «        }t          |                      d¦  «        |                     d¦  «        f|                      d¦  «        |                     dd¬¦  «        ft	          dd	¬
¦  «        t          d	d¬¦  «        f¦  «        D �]b\  }}}|                     ||¦  «         dD �]A}t          |d |d¬¦  «        }t          d|¦  «        D ]L}t          t          d|                     ¦   «         ¦  «                             ¦   «         ¦  «        |d	z   k    sJ ‚ŒMt          |¦  «        rd}nd}t          ||¦  «        D ]L}t          t          d|                     ¦   «         ¦  «                             ¦   «         ¦  «        |d	z   k    sJ ‚ŒMt          d|¦  «        D ]L}t          t          d|                     ¦   «         ¦  «                             ¦   «         ¦  «        |d	z   k    sJ ‚ŒM�ŒC�Œdd S )Nr   é   )é   r   )éè  é   )rn   )ro   )Úsizer   r   )r'   r$   ©r$   r'   )rp   r   T)r)   Ú	precisionr7   zvalue = \d+\.\d+z\.\d+zgini = \d+\.\d+zsquared_error = \d+\.\d+z<= \d+\.\d+)r   ÚzipÚrandom_sampleÚrandintr   r
   r@   r   r   Úlenr   re   r   )	Úrng_regÚrng_clfrA   rB   rF   rs   rf   rj   Úpatterns	            r    Útest_precisionr{   ¦  s0  € Ý˜!‰nŒn€GÝ˜!‰nŒn€GÝØ	×	Ò	˜vÑ	&Ô	&¨×(=Ò(=¸iÑ(HÔ(HÐIØ	×	Ò	˜tÑ	$Ô	$ g§o¢o°a¸g oÑ&FÔ&FÐGå!¨q¸AÐ>Ñ>Ô>Ý"¨Q¸QÐ?Ñ?Ô?ð	
ñô ð "Wñ "W‰	ˆˆ1ˆcð 	�Š��1‰ŒˆØð 	Wñ 	WˆIÝ&Ø˜d¨iÀDðñ ô ˆHõ $Ð$7¸ÑBÔBð Wð W�Ý�6 (¨G¯MªM©O¬OÑ<Ô<×BÒBÑDÔDÑEÔEÈÐUVÉÒVÐVÐVÐVÐVå˜SÑ!Ô!ð 6Ø,��à5�õ $ G¨XÑ6Ô6ð Wð W�Ý�6 (¨G¯MªM©O¬OÑ<Ô<×BÒBÑDÔDÑEÔEÈÐUVÉÒVÐVÐVÐVÐVå# N°HÑ=Ô=ð Wð W�Ý�6 (¨G¯MªM©O¬OÑ<Ô<×BÒBÑDÔDÑEÔEÈÐUVÉÒVÐVÐVÐVÐVñWñ1	Wð"Wð "Wr   c                  ó†  — t          dd¬¦  «        } |                      t          t          ¦  «         d}t	          j        t          |¬¦  «        5  t          | dg¬¦  «         d d d ¦  «         n# 1 swxY w Y   d}t	          j        t          |¬¦  «        5  t          | dg¬	¦  «         d d d ¦  «         d S # 1 swxY w Y   d S )
Nr   r   rr   z,feature_names must contain 2 elements, got 1rN   rP   rQ   zŒWhen `class_names` is an array, it should contain as many items as `decision_tree.classes_`. Got 1 while the tree was fitted with 2 classes.rT   )r
   r@   rA   rB   rU   rV   rW   r   )rF   Úerr_msgs     r    Útest_export_text_errorsr~   Î  sC  € Ý
 ¨1¸1Ð
=Ñ
=Ô
=€CØ‡G‚G�A�q�M„M€MØ<€GÝ	Œ•z¨Ð	1Ñ	1Ô	1ð .ð .Ý�C¨ uÐ-Ñ-Ô-Ð-ð.ð .ð .ñ .ô .ð .ð .ð .ð .ð .ð .øøøð .ð .ð .ð .ð	/ð õ
 
Œ•z¨Ð	1Ñ	1Ô	1ð ,ð ,Ý�C c UÐ+Ñ+Ô+Ð+ð,ð ,ð ,ñ ,ô ,ð ,ð ,ð ,ð ,ð ,ð ,ð ,øøøð ,ð ,ð ,ð ,ð ,ð ,s$   ÁA.Á.A2Á5A2ÂB6Â6B:Â=B:c                  óT  — t          dd¬¦  «        } |                      t          t          ¦  «         t	          d¦  «                             ¦   «         }t          | ¦  «        |k    sJ ‚t          | d¬¦  «        |k    sJ ‚t          | d¬¦  «        |k    sJ ‚t	          d¦  «                             ¦   «         }t          | d¬	¦  «        |k    sJ ‚t	          d
¦  «                             ¦   «         }t          | d¬¦  «        |k    sJ ‚ddgddgddgddgddgddgddgg}g d¢}t          dd¬¦  «        } |                      ||¦  «         t	          d¦  «                             ¦   «         }t          | d¬¦  «        |k    sJ ‚ddgddgddgddgddgddgg}ddgddgddgddgddgddgg}t          dd¬¦  «        }|                     ||¦  «         t	          d¦  «                             ¦   «         }t          |d¬¦  «        |k    sJ ‚t          |dd¬¦  «        |k    sJ ‚dgdgdgdgdgdgg}t          dd¬¦  «        }|                     ||¦  «         t	          d¦  «                             ¦   «         }t          |ddg¬¦  «        |k    sJ ‚t          |dddg¬¦  «        |k    sJ ‚d S )Nr   r   rr   zh
    |--- feature_1 <= 0.00
    |   |--- class: -1
    |--- feature_1 >  0.00
    |   |--- class: 1
    r?   é
   z”
    |--- feature_1 <= 0.00
    |   |--- weights: [3.00, 0.00] class: -1
    |--- feature_1 >  0.00
    |   |--- weights: [0.00, 3.00] class: 1
    T)Úshow_weightsz\
    |- feature_1 <= 0.00
    | |- class: -1
    |- feature_1 >  0.00
    | |- class: 1
    r   )Úspacingr   r   )r   r   r   r   r   r   r   rp   z{
    |--- feature_1 <= 0.00
    |   |--- class: -1
    |--- feature_1 >  0.00
    |   |--- truncated branch of depth 2
    zy
    |--- feature_1 <= 0.0
    |   |--- value: [-1.0, -1.0]
    |--- feature_1 >  0.0
    |   |--- value: [1.0, 1.0]
    )Údecimals)rƒ   r�   zq
    |--- first <= 0.0
    |   |--- value: [-1.0, -1.0]
    |--- first >  0.0
    |   |--- value: [1.0, 1.0]
    Úfirst)rƒ   r-   )rƒ   r�   r-   )r
   r@   rA   rB   r   Úlstripr   r   )rF   Úexpected_reportÚX_lÚy_lÚX_moÚy_moÚregÚX_singles           r    Útest_export_textr�   Ý  sb  € Ý
 ¨1¸1Ð
=Ñ
=Ô
=€CØ‡G‚G�A�q�M„M€Måð	ñô ÷ ‚f�h„hð õ �sÑÔ˜Ò.Ð.Ð.Ð.å�s aÐ(Ñ(Ô(¨OÒ;Ð;Ð;Ð;å�s bÐ)Ñ)Ô)¨_Ò<Ð<Ð<Ð<åð	ñô ÷ ‚f�h„hð õ �s¨Ð.Ñ.Ô.°/ÒAÐAÐAÐAåð	ñô ÷ ‚f�h„hð õ �s AÐ&Ñ&Ô&¨/Ò9Ð9Ð9Ð9à�ˆ8�b˜"�X  B˜x¨!¨Q¨°!°Q°¸!¸Q¸À"ÀaÀÐ
I€CØ
"Ð
"Ð
"€CÝ
 ¨1¸1Ð
=Ñ
=Ô
=€CØ‡G‚GˆC�ÑÔÐÝð	ñô ÷ ‚f�h„hð õ �s aÐ(Ñ(Ô(¨OÒ;Ð;Ð;Ð;à�ˆH�r˜2�h  R ¨1¨a¨&°1°a°&¸1¸a¸&ÐA€DØ�ˆH�r˜2�h  R ¨1¨a¨&°1°a°&¸1¸a¸&ÐA€Då
¨!¸!Ð
<Ñ
<Ô
<€CØ‡G‚GˆD�$ÑÔÐåð	ñô ÷ ‚f�h„hð õ �s QÐ'Ñ'Ô'¨?Ò:Ð:Ð:Ð:Ý�s Q°TÐ:Ñ:Ô:¸oÒMÐMÐMÐMà��r�d˜R˜D 1 #¨ s¨Q¨CÐ0€HÝ
¨!¸!Ð
<Ñ
<Ô
<€CØ‡G‚GˆH�dÑÔÐåð	ñô ÷ ‚f�h„hð õ �s Q°w°iÐ@Ñ@Ô@ÀOÒSÐSÐSÐSå�C !°$ÀwÀiÐPÑPÔPØò	ð 	ð 	ð 	ð 	ð 	r   c                 ót  — t          dd¬¦  «        }|                     t          t          ¦  «         t	          d¦  «                             ¦   «         }t          | | ddg¦  «        ¬¦  «        |k    sJ ‚t	          d¦  «                             ¦   «         }t          | | d	d
g¦  «        ¬¦  «        |k    sJ ‚d S )Nr   r   rr   zX
    |--- b <= 0.00
    |   |--- class: -1
    |--- b >  0.00
    |   |--- class: 1
    rP   rR   rQ   zk
    |--- feature_1 <= 0.00
    |   |--- class: cat
    |--- feature_1 >  0.00
    |   |--- class: dog
    ÚcatÚdogrT   )r
   r@   rA   rB   r   r…   r   )rJ   rF   r†   s      r    Ú2test_export_text_feature_class_names_array_supportr‘   6  sÍ   € õ !¨1¸1Ð
=Ñ
=Ô
=€CØ‡G‚G�A�q�M„M€Måð	ñô ÷ ‚f�h„hð õ �s¨+¨+°s¸C°jÑ*AÔ*AÐBÑBÔBÀoÒUÐUÐUÐUåð	ñô ÷ ‚f�h„hð õ �s¨¨°U¸E°NÑ(CÔ(CÐDÑDÔDÈÒWÐWÐWÐWÐWÐWr   c                 ó   — t          dddd¬¦  «        }|                     t          t          ¦  «         ddg}t	          ||¬¦  «        }t          |¦  «        dk    sJ ‚|d	                              ¦   «         d
k    sJ ‚|d                              ¦   «         dk    sJ ‚|d                              ¦   «         dk    sJ ‚|d                              ¦   «         dk    sJ ‚|d                              ¦   «         dk    sJ ‚d S )Nr   r   Úentropyr#   ú
first featÚsepal_widthrQ   rn   r   z:first feat <= 0.0
entropy = 1.0
samples = 6
value = [3, 3]r   z(entropy = 0.0
samples = 3
value = [3, 0]úTrue  z(entropy = 0.0
samples = 3
value = [0, 3]rp   ú  False)r
   r@   rA   rB   r   rw   Úget_text)ÚpyplotrF   r-   Únodess       r    Útest_plot_tree_entropyr›   R  s!  € õ !Ø q°IÈAðñ ô €Cð ‡G‚G�A�q�M„M€Mð " =Ð1€MÝ�c¨Ð7Ñ7Ô7€EÝˆu‰:Œ:˜Š?ˆ?ˆ?ˆ?àˆaŒ×ÒÑÔØJò	Kð 	Kð 	Kð 	Kð �Œ8×ÒÑÔÐ"NÒNÐNÐNÐNØ�Œ8×ÒÑÔ (Ò*Ð*Ð*Ð*Ø�Œ8×ÒÑÔÐ"NÒNÐNÐNÐNØ�Œ8×ÒÑÔ )Ò+Ð+Ð+Ð+Ð+Ð+r   Úfontsize)Nr€   é   c                 óB  ‡— t          dddd¬¦  «        }|                     t          t          ¦  «         ddg}t	          ||‰¬¦  «        }t          |¦  «        dk    sJ ‚‰�t          ˆfd	„|D ¦   «         ¦  «        sJ ‚|d
                              ¦   «         dk    sJ ‚|d                              ¦   «         dk    sJ ‚|d                              ¦   «         dk    sJ ‚|d                              ¦   «         dk    sJ ‚|d                              ¦   «         dk    sJ ‚d S )Nr   r   r   r#   r”   r•   )r-   rœ   rn   c              3   óH   •K  — | ]}|                      ¦   «         ‰k    V — Œd S ©N)Úget_fontsize)r`   Únoderœ   s     €r    ú	<genexpr>z&test_plot_tree_gini.<locals>.<genexpr>y  s4   øè è € ÐEÐE°t�4×$Ò$Ñ&Ô&¨(Ò2ÐEÐEÐEÐEÐEÐEr   r   z7first feat <= 0.0
gini = 0.5
samples = 6
value = [3, 3]r   z%gini = 0.0
samples = 3
value = [3, 0]r–   z%gini = 0.0
samples = 3
value = [0, 3]rp   r—   )r
   r@   rA   rB   r   rw   Úallr˜   )r™   rœ   rF   r-   rš   s    `   r    Útest_plot_tree_ginir¥   h  sV  ø€ õ !ØØØØð	ñ ô €Cð ‡G‚G�A�q�M„M€Mð " =Ð1€MÝ�c¨ÀÐJÑJÔJ€EÝˆu‰:Œ:˜Š?ˆ?ˆ?ˆ?ØÐÝÐEÐEÐEÐE¸uÐEÑEÔEÑEÔEÐEÐEÐEàˆaŒ×ÒÑÔØGò	Hð 	Hð 	Hð 	Hð �Œ8×ÒÑÔÐ"KÒKÐKÐKÐKØ�Œ8×ÒÑÔ (Ò*Ð*Ð*Ð*Ø�Œ8×ÒÑÔÐ"KÒKÐKÐKÐKØ�Œ8×ÒÑÔ )Ò+Ð+Ð+Ð+Ð+Ð+r   c                 ó¤   — t          ¦   «         }t          j        t          ¦  «        5  t	          |¦  «         d d d ¦  «         d S # 1 swxY w Y   d S r    )r   rU   rV   r	   r   )r™   rF   s     r    Útest_not_fitted_treer§   „  sŒ   € å
Ñ
!Ô
!€CÝ	Œ•~Ñ	&Ô	&ð ð Ý�#‰Œˆðð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð s   ¨AÁA	ÁA	)0Ú__doc__Úior   Úrer   r   Útextwrapr   ÚnumpyÚnprU   Únumpy.randomr   Úsklearn.baser   Úsklearn.exceptionsr	   Úsklearn.treer
   r   r   r   r   Úsklearn.tree._exportr   ÚCLF_CRITERIONSrc   rA   rB   rC   rD   rE   r!   rI   ÚmarkÚparametrizeÚlistÚarrayrL   r]   rk   r{   r~   r�   r‘   r›   r¥   r§   r   r   r    ú<module>r¸      sÖ  ððð ð Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ø €€€Ø $Ð $Ð $Ð $Ð $Ð $à &Ð &Ð &Ð &Ð &Ð &Ø -Ð -Ð -Ð -Ð -Ð -ðð ð ð ð ð ð ð ð ð ð ð ð ð ð 3Ð 2Ð 2Ð 2Ð 2Ð 2à%€Ø?€ð 	ˆ"€X��Bˆx˜"˜b˜ A q 6¨A¨q¨6°A°q°6Ð:€ØÐÐ€Ø	ˆ1€g��Aˆw˜˜Q˜ ! Q ¨!¨Q¨°!°Q°Ð8€ØÐÐ€ØÐÐ€
ð7ð 7ð 7ðJð Jð JðZ „×Ò˜¨¨r¬xÐ(8Ñ9Ô9ð2"ð 2"ñ :Ô9ð2"ðj"2ð "2ð "2ðJ „×Ò˜ n°~Ñ&EÑFÔFð,ð ,ñ GÔFð,ð%Wð %Wð %WðP,ð ,ð ,ðVð Vð Vðr „×Ò˜¨¨r¬xÐ(8Ñ9Ô9ðXð Xñ :Ô9ðXð6,ð ,ð ,ð, „×Ò˜ ^ ^ ^Ñ4Ô4ð,ð ,ñ 5Ô4ð,ð6ð ð ð ð r   