<div dir="ltr">Hi all,<div><br></div><div>Thanks for the suggestion. </div><div><br><div>I have a related question on tree visualization</div></div><div><br></div><div>I have 2 classes to predict: 0 and 1 (it comes up as a numeric field when I load the dataset)</div><div><br></div><div>I have given the class_names as "NotPresent" and "Ispresent" which I believe it will map to 0 and 1. is that correct?</div><div><br></div><div><br></div><div>How do I interpret the nodes and value present in each nodes in the accompanying diagram?</div><div><br></div><div>Regards,</div><div>Sanant</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 24, 2016 at 9:17 PM, Sebastian Raschka <span dir="ltr"><<a href="mailto:se.raschka@gmail.com" target="_blank">se.raschka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, Greg,<br>
if you provide the `class_names` argument, a “class” label of the majority class will be added at the bottom of each node. For instance, if you have the Iris dataset, with class labels 0, 1, 2, you can provide the `class_names` as ['setosa', 'versicolor', 'virginica’], where  0 -> ‘setosa’, 1 -> ‘versicolor’, 2 -> ‘virginica’.<br>
<br>
Best,<br>
Sebastian<br>
<br>
> On Oct 24, 2016, at 10:18 AM, greg g <<a href="mailto:greg315@hotmail.fr">greg315@hotmail.fr</a>> wrote:<br>
><br>
> bLaf1ox-forefront-antispam-<wbr>report: EFV:NLI; SFV:NSPM; SFS:(10019020)(98900003);<br>
> DIR:OUT; SFP:1102; SCL:1; SRVR:DB5EUR03HT168;<br>
> H:<a href="http://DB3PR04MB0780.eurprd04.prod.outlook.com" rel="noreferrer" target="_blank">DB3PR04MB0780.eurprd04.prod.<wbr>outlook.com</a>; FPR:; SPF:None; LANG:en;<br>
> x-ms-office365-filtering-<wbr>correlation-id: 319900b9-973c-49bb-8e9a-<wbr>08d3fc1895c4<br>
> x-microsoft-antispam: UriScan:; BCL:0; PCL:0;<br>
> RULEID:(1601124038)(<wbr>1603103081)(1601125047); SRVR:DB5EUR03HT168;<br>
> x-exchange-antispam-report-<wbr>cfa-test: BCL:0; PCL:0;<br>
> RULEID:(432015012)(82015046); SRVR:DB5EUR03HT168; BCL:0; PCL:0; RULEID:;<br>
> SRVR:DB5EUR03HT168;<br>
> x-forefront-prvs: 0105DAA385<br>
> X-OriginatorOrg: <a href="http://outlook.com" rel="noreferrer" target="_blank">outlook.com</a><br>
> X-MS-Exchange-CrossTenant-<wbr>originalarrivaltime: 24 Oct 2016 14:18:11.0102 (UTC)<br>
> X-MS-Exchange-CrossTenant-<wbr>fromentityheader: Internet<br>
> X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-<wbr>aaaaaaaaaaaa<br>
> X-MS-Exchange-Transport-<wbr>CrossTenantHeadersStamped: DB5EUR03HT168<br>
<div class="HOEnZb"><div class="h5">><br>
><br>
> Hi,<br>
>  I just begin with scikit-learn and would like to visualize a classification tree with class names displayed in the leaves as shown in the SCIKITLEARN.TREE documentation <a href="http://scikit-learn.org/stable/modules/tree.html" rel="noreferrer" target="_blank">http://scikit-learn.org/<wbr>stable/modules/tree.html</a> where we find class=’virginica’ etc…<br>
> I made a tree providing a 2D array X (n1 samples , n2 features) and 1D array Y (n1 corresponding classes ) such that Y(i) is the class of the sample X(i, …)<br>
> After that I have correct predictions using predict()<br>
> Then I use the function<br>
> export_graphviz(clf, out_file=dot_data,feature_<wbr>names=FEATURES)<br>
> with FEATURES being the array of my n2 features names in the same order as in X<br>
> I obtain the tree .png but can’t find a way to have the correct class names in the leaves…<br>
> In export_graphviz() should I use the class_names optional parameter and how ?<br>
> Thanks for any help<br>
><br>
> Gregory, Toulouse FRANCE<br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> scikit-learn mailing list<br>
> <a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scikit-learn</a><br>
<br>
______________________________<wbr>_________________<br>
scikit-learn mailing list<br>
<a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scikit-learn</a><br>
</div></div></blockquote></div><br></div>