Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In homework exercises we wrote (at least I did, and posted it) a function gini(dataList) to return the gini impurity index associated with a list
In homework exercises we wrote (at least I did, and posted it) a function gini(dataList) to return the
gini impurity index associated with a list of objects belonging to multiple classes.
Write a function entropy(dataList) to return the entropy of a list of class labels of objects.
Entropy = where the sum is over all the classes, and the are the probability (or
fraction ) of the ith 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started