Hi, Greg,
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’.

Best,
Sebastian

> On Oct 24, 2016, at 10:18 AM, greg g <greg...@hotmail.fr> wrote:
> 
> bLaf1ox-forefront-antispam-report: EFV:NLI; SFV:NSPM; 
> SFS:(10019020)(98900003);
> DIR:OUT; SFP:1102; SCL:1; SRVR:DB5EUR03HT168;
> H:DB3PR04MB0780.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en;
> x-ms-office365-filtering-correlation-id: 319900b9-973c-49bb-8e9a-08d3fc1895c4
> x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
> RULEID:(1601124038)(1603103081)(1601125047); SRVR:DB5EUR03HT168;
> x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
> RULEID:(432015012)(82015046); SRVR:DB5EUR03HT168; BCL:0; PCL:0; RULEID:;
> SRVR:DB5EUR03HT168;
> x-forefront-prvs: 0105DAA385
> X-OriginatorOrg: outlook.com
> X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Oct 2016 14:18:11.0102 (UTC)
> X-MS-Exchange-CrossTenant-fromentityheader: Internet
> X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
> X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT168
> 
> 
> Hi,
>  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 
> http://scikit-learn.org/stable/modules/tree.html where we find 
> class=’virginica’ etc…
> 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, 
> …)
> After that I have correct predictions using predict()
> Then I use the function 
> export_graphviz(clf, out_file=dot_data,feature_names=FEATURES)
> with FEATURES being the array of my n2 features names in the same order as in 
> X 
> I obtain the tree .png but can’t find a way to have the correct class names 
> in the leaves…
> In export_graphviz() should I use the class_names optional parameter and how ?
> Thanks for any help
>  
> Gregory, Toulouse FRANCE
> 
> 
> 
> _______________________________________________
> scikit-learn mailing list
> scikit-learn@python.org
> https://mail.python.org/mailman/listinfo/scikit-learn

_______________________________________________
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn

Reply via email to