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 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
Get step-by-step solutions from verified subject matter experts
