risk_calculate: Risk Calculate

Description Usage Arguments Value See Also Examples

View source: R/abcrlda.R

Description

Estimates risk and error by applying a constructed classifier (an object of class abcrlda) to a given set of observations.

Usage

1
risk_calculate(object, x_true, y_true)

Arguments

object

An object of class "abcrlda".

x_true

Matrix of values for x for which true class labels are known.

y_true

A numeric vector or factor of true class labels. Factor should have either two levels or be a vector with two distinct values. If y_true is presented as a vector, it will be coerced into a factor. Length of y_true has to correspond to number of samples in x_test.

Value

A list of parameters where

actual_err0

Error rate for class 0.

actual_err1

Error rate for class 1.

actual_errTotal

Error rate overall.

actual_normrisk

Risk value normilized to be between 0 and 1.

actual_risk

Risk value without normilization.

See Also

Other functions in the package: abcrlda(), cross_validation(), da_risk_estimator(), grid_search(), predict.abcrlda()

Examples

1
2
3
4
5
6
7
data(iris)
train_data <- iris[which(iris[, ncol(iris)] == "virginica" |
                         iris[, ncol(iris)] == "versicolor"), 1:4]
train_label <- factor(iris[which(iris[, ncol(iris)] == "virginica" |
                                 iris[, ncol(iris)] == "versicolor"), 5])
model <- abcrlda(train_data, train_label, gamma = 0.5, cost = 0.75)
risk_calculate(model, train_data, train_label)

abcrlda documentation built on July 2, 2020, 4:13 a.m.