This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

kfoldMargin

Classification margins for observations not used for training

Syntax

M = kfoldMargin(obj)

Description

M = kfoldMargin(obj) returns classification margins obtained by cross-validated classification model obj. For every fold, this method computes classification margins for in-fold observations using a model trained on out-of-fold observations.

Input Arguments

obj

A partitioned classification model of type ClassificationPartitionedModel or ClassificationPartitionedEnsemble.

Output Arguments

M

The classification margin.

Examples

expand all

Find the k-fold margins for an ensemble that classifies the ionosphere data.

Load the ionosphere data set.

load ionosphere

Create a template tree stump.

t = templateTree('MaxNumSplits',1);

Train a classification ensemble of decision trees. Specify t as the weak learner.

Mdl = fitcensemble(X,Y,'Method','AdaBoostM1','Learners',t);

Cross validate the classifier using 10-fold cross validation.

cvens = crossval(Mdl);

Compute the k-fold margins. Display summary statistics for the margins.

m = kfoldMargin(cvens);
marginStats = table(min(m),mean(m),max(m),...
    'VariableNames',{'Min','Mean','Max'})
marginStats=1×3 table
      Min       Mean      Max  
    _______    ______    ______

    -11.312    7.3236    23.517

More About

expand all