Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

mushroom.csv file here https://drive.google.com/file/d/1M4FMZTKYM1qkInhcDXEvj6z5TErxva3b/view?usp=sharing Your task is the build a classification model that predicts the edibility of mushrooms ( class variable in the dataset). You

mushroom.csv file here https://drive.google.com/file/d/1M4FMZTKYM1qkInhcDXEvj6z5TErxva3b/view?usp=sharing

Your task is the build a classification model that predicts the edibility of mushrooms (class variable in the dataset). You have been provide with a dataset as a mushrooms.csv file.

Here is a description of the attributes

Attribute description:

1. cap-shape: bell=b,conical=c,convex=x,flat=f, knobbed=k,sunken=s

2. cap-surface: fibrous=f,grooves=g,scaly=y,smooth=s

3. cap-color: brown=n,buff=b,cinnamon=c,gray=g,green=r, pink=p,purple=u,red=e,white=w,yellow=y

4. bruises?: bruises=t,no=f

5. odor: almond=a,anise=l,creosote=c,fishy=y,foul=f, musty=m,none=n,pungent=p,spicy=s

6. gill-attachment: attached=a,descending=d,free=f,notched=n

7. gill-spacing: close=c,crowded=w,distant=d

8. gill-size: broad=b,narrow=n

9. gill-color: black=k,brown=n,buff=b,chocolate=h,gray=g, green=r,orange=o,pink=p,purple=u,red=e, white=w,yellow=y

10. stalk-shape: enlarging=e,tapering=t

11. stalk-root: bulbous=b,club=c,cup=u,equal=e, rhizomorphs=z,rooted=r,missing=?

12. stalk-surface-above-ring: fibrous=f,scaly=y,silky=k,smooth=s

13. stalk-surface-below-ring: fibrous=f,scaly=y,silky=k,smooth=s

14. stalk-color-above-ring: brown=n,buff=b,cinnamon=c,gray=g,orange=o, pink=p,red=e,white=w,yellow=y

15. stalk-color-below-ring: brown=n,buff=b,cinnamon=c,gray=g,orange=o, pink=p,red=e,white=w,yellow=y

16. veil-type: partial=p,universal=u

17. veil-color: brown=n,orange=o,white=w,yellow=y

18. ring-number: none=n,one=o,two=t

19. ring-type: cobwebby=c,evanescent=e,flaring=f,large=l, none=n,pendant=p,sheathing=s,zone=z

20. spore-print-color: black=k,brown=n,buff=b,chocolate=h,green=r, orange=o,purple=u,white=w,yellow=y

21. population: abundant=a,clustered=c,numerous=n, scattered=s,several=v,solitary=y

22. habitat: grasses=g,leaves=l,meadows=m,paths=p, urban=u,waste=w,woods=d

23. class: p = poisonous, e=edible

Build a classification tree. Random_state =2020. Training partition 0.7. stratify = y, max_depth = 6, use Entropy

A.Print the confusion matrix. Also visualize the confusion matrix using plot_confusion_matrix from sklearn.metrics

B.What was the accuracy on the training partition?

C.What was the accuracy on the test partition?

D.Show the classification tree.

E.List the top three most important features in your decision tree for determining toxicity.

F.Classify the following mushroom.

class

?

cap-shape

x

cap-surface

s

cap-color

n

bruises

t

odor

y

gill-attachment

f

gill-spacing

c

gill-size

n

gill-color

k

stalk-shape

e

stalk-root

e

stalk-surface-above-ring

s

stalk-surface-below-ring

s

stalk-color-above-ring

w

stalk-color-below-ring

w

veil-type

p

veil-color

w

ring-number

o

ring-type

p

spore-print-color

r

population

s

habitat

u

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

When are internal & external evaluations used in program management

Answered: 1 week ago