Determine types based on features

Find out the decisive features to complete the partition of the data subset distributed on all branches. If the data subset on a branch belongs to the same type, it is not divided, otherwise it is divided repeatedly until all the data subset of the same type belong to the same branch

Here we have the entropy method and then we have the Gini unpurity method (which measures the probability of being misclassified into other groups)

TypeError: ‘dict_keys’ object does not support indexing

This paper links: blog.csdn.net/a070220106/… Import random outcomes = {‘ heads’ :0, ‘tails’ :0} sides = outcomes. Keys () print(sides[0]) TypeError: ‘dict_keys’ object does not support indexing

This is because Python3 changed dict.keys to return dict_keys, which supports iterable but does not support indexable, and we can explicitly convert it to list:

Import random outcomes = {‘ heads’ :0, ‘tails’ :0} sides = list(outcomes. Keys ()) print(sides[0]) # print tails

The original link: blog.csdn.net/a070220106/…