| cost.curves | R Documentation |
This function plots Cost Curves of several classification predictions.
cost.curves(
predictions,
gt,
methods.names = NULL,
positive = levels(factor(gt))[1],
type = c("auto", "fuzzy", "hard"),
...
)
predictions |
The predictions of one or several classification models. Four shapes are
accepted: a |
gt |
Actual labels of the dataset ( |
methods.names |
The name of the compared methods ( |
positive |
The label of the positive class. Defaults to the first level of |
type |
|
... |
Other parameters, passed to the underlying plot. |
Nothing; the curves are drawn on the current graphics device.
roc.curves, performance
require (datasets)
data (iris)
d = iris
levels (d [, 5]) = c ("+", "+", "-") # Building a two classes dataset
model.nb = NB (d [, -5], d [, 5])
model.lda = LDA (d [, -5], d [, 5])
# From the estimated probabilities (the meaningful version)
cost.curves (predict (model.nb, d [, -5], fuzzy = TRUE), d [, 5])
# From hard labels, for comparison
cost.curves (cbind (predict (model.nb, d [, -5]), predict (model.lda, d [, -5])),
d [, 5], c ("NB", "LDA"), type = "hard")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.