Question: Step# 2 - Upload the dataset data = pdread cssel'vertebrate.csv'header = 'infer' ) data Take screenshot of this output Step# 3 - Given the limited

Step#2- Upload the dataset
data = pdread cssel'vertebrate.csv'header='infer')
data
Take screenshot of this output
Step#3-
Given the limited number of training examples, let's convert the problem into a binary classification task
(mammals versus non-mammals).
[Student to code this themselves]
Take screenshot of the original data with the new classification output
Step#4-
We can apply Pandas cross-tabulation to examine the relationship between the Warm-blooded and Gives
Birth attributes with respect to the class.
od,crasstabl[data['Warm-blooded'],data['Gives Birth']],data['Class'])
Take screenshot of this output
Step#5-
In this section, we apply a decision tree classifier to the vertebrate dataset described in the previous
subsection. We're going to use a Python library called "sklearn" which also supports calculating 'gini' as the
impurity measure.
from sklearn import tree
Y= data['Class']
X = datardrop(['Name','Class'],axis=1)
clf = tree.DecisionTreeClassifier(criterion='entropy',max depth=3)
clf =clffiti(x,Y)
The preceding commands will extract the predictor (x) and target class (Y) attributes from the vertebrate
dataset and create a decision tree classifier object using entropy as its impurity measure for splitting
criterion. The classifier above is also constrained to generate trees with a maximum depth equals to 3. Next,
the classifier is trained on the labeled data using the fit() function.
Step# 2 - Upload the dataset data = pdread

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 Programming Questions!