Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up ID3 algorith in scikit-learn?

There is a DecisionTreeClassifier for varios types of trees (ID3,CART,C4.5) but I don't understand what parameters should I pass to emulate conventional ID3 algorithm behaviour?

like image 690
mrgloom Avatar asked Oct 20 '22 03:10

mrgloom


2 Answers

The documentation says

scikit-learn uses an optimised version of the CART algorithm.

so you probably cannot emulate an ID3 as found in the textbooks.

http://scikit-learn.org/stable/modules/tree.html#tree-algorithms-id3-c4-5-c5-0-and-cart

like image 151
Karl Avatar answered Oct 22 '22 10:10

Karl


I'm not sure that it's the only differences between sklearn implementation and ID3 algo, but from what i know you have to change criterion from "gini" to "entropy" for ID3

DecisionTreeClassifier(criterion="entropy")
like image 36
Ibraim Ganiev Avatar answered Oct 22 '22 09:10

Ibraim Ganiev