4
$\begingroup$

According to a website (:http://dataaspirant.com/2017/01/30/how-decision-tree-algorithm-works/) , these values are chosen randomly for both gini index and Entropy method: enter image description here

I don't think this is the case with any optimized way of creating a decision tree. In this image(different example) the value is 2.45 for the root node: enter image description here

Was this value chosen randomly like explained in the website? If not and the value is not chosen randomly then how is it calculated?

$\endgroup$
3
$\begingroup$

In principle, it considers all possible splits, ordering the samples by the feature value and calculating the gini index (or other criterion) improvement for each split. It then chooses the cutoff value to achieve the split in the ordered samples.

In practice, some optimization occurs, ignoring constant features, using approximated criterion improvements, etc.

https://github.com/scikit-learn/scikit-learn/blob/7389dbac82d362f296dc2746f10e43ffa1615660/sklearn/tree/_splitter.pyx#L304

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.