Train a classification tree classifier, and
then cross validate it using a custom k-fold loss
function.
Load Fisher’s iris data set.
Train a classification tree classifier.
Mdl
is a ClassificationTree
model.
Cross validate Mdl
using the default
10-fold cross validation. Compute the classification error (proportion
of misclassified observations) for the out-of-fold observations.
Examine the result when the cost of misclassifying a flower
as 'versicolor'
is 10
, and any
other error is 1
. Write a function called noversicolor.m
that
attributes a cost of 1
for misclassification, but 10
for
misclassifying a flower as versicolor
, and save
it on your MATLAB® path.
Compute the mean misclassification error with the noversicolor
cost.