Description Format Usage Arguments Details Fields Methods Examples
This class logs the out of bag risk for a specific loss function. It is also possible to use custom losses to log performance measures. For details see the use case or extending compboost vignette.
S4
object.
1 2 | LoggerOobRisk$new(use_as_stopper, used_loss, eps_for_break, oob_data,
oob_response)
|
use_as_stopper
[logical(1)
]Boolean to indicate if the logger should also be used as stopper.
used_loss
[Loss
object]The loss used to calculate the empirical risk by taking the mean of the returned defined loss within the loss object.
eps_for_break
[numeric(1)
]This argument is used if the loss is also used as stopper. If the relative
improvement of the logged inbag risk falls above this boundary the stopper
returns TRUE
.
oob_data
[list
]A list which contains data source objects which corresponds to the source data of each registered factory. The source data objects should contain the out of bag data. This data is then used to calculate the prediction in each step.
oob_response
[numeric
]Vector which contains the response for the out of bag data given within
the list
.
This logger computes the risk for a given new dataset \mathcal{D}_\mathrm{oob} = \{(x^{(i)},\ y^{(i)})\ |\ i \in I_\mathrm{oob}\} and stores it into a vector. The OOB risk \mathcal{R}_\mathrm{oob} for iteration m is calculated by:
\mathcal{R}_\mathrm{oob}^{[m]} = \frac{1}{|\mathcal{D}_\mathrm{oob}|}∑\limits_{(x,y) \in \mathcal{D}_\mathrm{oob}} L(y, \hat{f}^{[m]}(x))
Note:
If m=0 than \hat{f} is just the offset.
The implementation to calculate \mathcal{R}_\mathrm{emp}^{[m]} is done in two steps:
Calculate vector risk_temp
of losses for every observation for
given response y^{(i)} and prediction \hat{f}^{[m]}(x^{(i)}).
Average over risk_temp
.
This procedure ensures, that it is possible to e.g. use the AUC or any arbitrary performance measure for risk logging. This gives just one value for risk_temp and therefore the average equals the loss function. If this is just a value (like for the AUC) then the value is returned.
This class is a wrapper around the pure C++
implementation. To see
the functionality of the C++
class visit
https://schalkdaniel.github.io/compboost/cpp_man/html/classlogger_1_1_oob_risk_logger.html.
This class doesn't contain public fields.
summarizeLogger()
Summarize the logger object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Define data:
X1 = cbind(1:10)
X2 = cbind(10:1)
data.source1 = InMemoryData$new(X1, "x1")
data.source2 = InMemoryData$new(X2, "x2")
oob.list = list(data.source1, data.source2)
set.seed(123)
y.oob = rnorm(10)
# Used loss:
log.bin = LossBinomial$new()
# Define logger:
log.oob.risk = LoggerOobRisk$new(FALSE, log.bin, 0.05, oob.list, y.oob)
# Summarize logger:
log.oob.risk$summarizeLogger()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.