CostLines: Plotting Cost Curves based on Cost or Skew

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Function to plot cost lines based on cost or skew.

Usage

1
2
3
CostLines(predictions,classes,uniquec=FALSE, loss2skew=FALSE, hold=FALSE,
          gridOFF=TRUE, legendOFF=FALSE, main, xlab, ylab, namesClassifiers,
           lwd, lty, col, xPosLegend,yPosLegend, cexL)

Arguments

predictions

A list with predicted scores.

classes

A list with labels, (only binary classes).

uniquec

If TRUE, the same array classes is used for each array in a list predictions.

loss2skew

If TRUE, loss by Skew is plotted otherwise loss by cost is plotted.

hold

If it is TRUE, the plot is maintained open allowing to insert new curves on the same plot.

gridOFF

Disable/enable grid visualization.

legendOFF

Disable/enable legend visualization.

main

title.

xlab

x label.

ylab

y label.

namesClassifiers

An array with names of each classifier.

lwd

Line width.

lty

Line type.

col

Line color.

xPosLegend

x coordinate to be used to position the legend.

yPosLegend

y coordinate to be used to position the legend.

cexL

size of box legend.

Details

The loss which is produced at a decision threshold t and a cost proportion c is given by formula:

Loss by Cost:

2(c*pi0(1-F0(t))+(1-c)pi1*F1(t))

The loss which is produced at a decision threshold t and a skew z is given by formula:

Loss by Skew:

z(1-F0(t))+(1-z)F1(t))

Where:

c: cost values of x_axis between [0, 1].
z: skew values of x_axis between [0, 1].
t: threshold.
pi0: negative class proportion (Y==0)/length(Y).
pi1: positive class proportion (Y==1)/length(Y).
F1(t): false positive rate of specific threshold.
1-F0(t): true positive rate of specific threshold.

Value

No return value.

Author(s)

Paulina Morillo: paumoal@inf.upv.es

References

Hernandez-Orallo, J., Flach, P., & Ferri, C. (2013). ROC curves in cost space. Machine learning, 93(1), 71-91.

See Also

BrierCurves, CostCurves, KendallCurves, predictions, RateDrivenCurves, TestOptimal, TP_FP.rates, TrainOptimal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(predictions)
#Loss by cost
CostLines(list(predictions$A, predictions$B), list(predictions$classes),
			uniquec=TRUE)

#Loss by skew
CostLines(list(predictions$A, predictions$B), list(predictions$classes),
			uniquec=TRUE, loss2skew = TRUE)

#names legend
CostLines(list(predictions$A, predictions$B), list(predictions$classes,
			predictions$classes), loss2skew = TRUE, col=c("blue", "red"), lty=c(1, 2),
            namesClassifiers = c("A","B"))

#LegendOFF
CostLines(list(predictions$A, predictions$B), list(predictions$classes),
			uniquec=TRUE, loss2skew = TRUE, legendOFF=TRUE, lty=5)

paumoal/costcurvespkg documentation built on May 30, 2019, 4:05 p.m.