| Contents | Index |
Predict out-of-bag response of ensemble
[label,score]
= oobPredict(ens)
[label,score]
= oobPredict(ens,Name,Value)
[label,score] = oobPredict(ens) returns class labels and scores for ens for out-of-bag data.
[label,score] = oobPredict(ens,Name,Value) computes labels and scores with additional options specified by one or more Name,Value pair arguments.
ens |
A classification bagged ensemble, constructed with fitensemble. |
Specify optional comma-separated pairs of Name,Value arguments, where Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
'learners' |
Indices of weak learners in the ensemble ranging from 1 to ens.NTrained. oobEdge uses only these learners for calculating loss. Default: 1:NTrained |
Bagging, which stands for "bootstrap aggregation", is a type of ensemble learning. To bag a weak learner such as a decision tree on a dataset, fitensemble generates many bootstrap replicas of the dataset and grows decision trees on these replicas. fitensemble obtains each bootstrap replica by randomly selecting N observations out of N with replacement, where N is the dataset size. To find the predicted response of a trained ensemble, predict take an average over predictions from individual trees.
Drawing N out of N observations with replacement omits on average 37% (1/e) of observations for each decision tree. These are "out-of-bag" observations. For each observation, oobLoss estimates the out-of-bag prediction by averaging over predictions from all trees in the ensemble for which this observation is out of bag. It then compares the computed prediction against the true response for this observation. It calculates the out-of-bag error by comparing the out-of-bag predicted responses against the true responses for all observations used for training. This out-of-bag average is an unbiased estimator of the true ensemble error.
For ensembles, a classification score represents the confidence of a classification into a class. The higher the score, the higher the confidence.
Different ensemble algorithms have different definitions for their scores. Furthermore, the range of scores depends on ensemble type. For example:
AdaBoostM1 scores range from –∞ to ∞.
Bag scores range from 0 to 1.
Find the out-of-bag predictions and scores for the Fisher iris data. Find the scores in the range (0.2,0.8); these are the scores where there is notable uncertainty in the resulting classifications.
load fisheriris
ens = fitensemble(meas,species,'Bag',100,...
'Tree','type','classification');
[label score] = oobPredict(ens);
unsure = ( (score > .2) & (score < .8));
sum(sum(unsure)) % How many uncertain predictions?
ans =
16oobEdge | oobLoss | oobMargin | oobPredict | predict
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |