labelError {penaltyLearning} | R Documentation |
Compute incorrect labels
Description
Compute incorrect labels
for several change-point detection
problems and models
. Use this function after having computed
changepoints, loss values, and model selection functions
(see modelSelection
). The next step after labelError is typically
computing target intervals of log(penalty) values that predict
changepoints with minimum incorrect labels
for each problem (see
targetIntervals
).
Usage
labelError(models, labels,
changes, change.var = "chromStart",
label.vars = c("min",
"max"), model.vars = "n.segments",
problem.vars = character(0),
annotations = change.labels)
Arguments
models |
data.frame with one row per (problem,model) combination, typically
the output of modelSelection(...). There is a row for each
changepoint model that could be selected for a particular
segmentation problem. There should be columns |
labels |
data.frame with one row per (problem,region). Each label defines a
region in a particular segmentation problem, and a range of
predicted changepoints which are consistent in that region. There
should be a column "annotation" with takes one of the
corresponding values in the annotation column of |
changes |
data.frame with one row per (problem,model,change), for each
predicted changepoint (in each model and segmentation
problem). Should have columns |
change.var |
character(length=1): column name of predicted change-point
position in |
label.vars |
character(length=2): column names of start and end positions of
|
model.vars |
character: column names used to identify model complexity. The
default "n.segments" is for change-point |
problem.vars |
character: column names used to identify data set / segmentation
problem, should be present in all three data tables ( |
annotations |
data.table with columns annotation, min.changes, max.changes,
possible.fn, possible.fp which is joined to |
Value
list of two data.tables: label.errors has one row for every
combination of models
and labels
, with status column that
indicates whether or not that model commits an error in that
particular label; model.errors has one row per model, with columns
for computing target intervals and ROC curves (see targetIntervals
and ROChange
).
Author(s)
Toby Dylan Hocking
Examples
label <- function(annotation, min, max){
data.frame(profile.id=4, chrom="chr14", min, max, annotation)
}
label.df <- rbind(
label("1change", 70e6, 80e6),
label("0changes", 20e6, 60e6))
model.df <- data.frame(chrom="chr14", n.segments=1:3)
change.df <- data.frame(chrom="chr14", rbind(
data.frame(n.segments=2, changepoint=75e6),
data.frame(n.segments=3, changepoint=c(75e6, 50e6))))
penaltyLearning::labelError(
model.df, label.df, change.df,
problem.vars="chrom", # for all three data sets.
model.vars="n.segments", # for changes and selection.
change.var="changepoint", # column of changes with breakpoint position.
label.vars=c("min", "max")) # limit of labels in ann.