Question: Write a function entropy(dataList) to return the entropy of a list of class labels of objects. Entropy = -P; * log2(Pi) where the sum is

 Write a function entropy(dataList) to return the entropy of a list

Write a function entropy(dataList) to return the entropy of a list of class labels of objects. Entropy = -P; * log2(Pi) where the sum is over all the classes, and the pi are the probability (or fraction ) of the i" class in the set. Entropy of the list of labels: ['Apple', 'Grape', 'Apple', 'Apple', 'Grape', 'Orange', 'Grape') should be about 1.45

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!