Answered step by step
Verified Expert Solution
Link Copied!

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
image text in transcribed
2. 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 - E-pi* log2(Pi) where the sum is over all the classes, and the p; are the probability (or fraction of the in 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions