Learn R Programming

ddalpha (version 1.3.16)

ddalpha.getErrorRatePart: Test DD-Classifier

Description

Performs a benchmark procedure by partitioning the given data. On each of times steps size observations are removed from the data, the DD-classifier is trained on these data and tested on the removed observations.

Usage

ddalpha.getErrorRatePart(data, size = 0.3, times = 10,  ...)

Value

errors

the part of incorrectly classified data (mean)

errors_sd

the standard deviation of errors

errors_vec

vector of errors

time

the mean training time

time_sd

the standard deviation of training time

Arguments

data

Matrix containing training sample where each of \(n\) rows is one object of the training sample where first \(d\) entries are inputs and the last entry is output (class label).

size

the excluded sequences size. Either an integer between \(1\) and \(n\), or a fraction of data between \(0\) and \(1\).

times

the number of times the classifier is trained.

...

additional parameters passed to ddalpha.train

See Also

ddalpha.train to train the DD\(\alpha\)-classifier, ddalpha.classify for classification using DD\(\alpha\)-classifier, ddalpha.test to test the DD-classifier on particular learning and testing data, ddalpha.getErrorRateCV to get error rate of the DD-classifier on particular data.

Examples

Run this code
# Generate a bivariate normal location-shift classification task
# containing 200 objects
class1 <- mvrnorm(100, c(0,0), 
                  matrix(c(1,1,1,4), nrow = 2, ncol = 2, byrow = TRUE))
class2 <- mvrnorm(100, c(2,2), 
                  matrix(c(1,1,1,4), nrow = 2, ncol = 2, byrow = TRUE))
propertyVars <- c(1:2)
classVar <- 3
data <- rbind(cbind(class1, rep(1, 100)), cbind(class2, rep(2, 100)))

# Train 1st DDalpha-classifier (default settings) 
# and get the classification error rate
stat <- ddalpha.getErrorRatePart(data, size = 10, times = 10)
cat("1. Classification error rate (defaults): ", 
    stat$error, ".\n", sep = "")

# Train 2nd DDalpha-classifier (zonoid depth, maximum Mahalanobis 
# depth classifier with defaults as outsider treatment) 
# and get the classification error rate
stat2 <- ddalpha.getErrorRatePart(data, depth = "zonoid", 
                                outsider.methods = "depth.Mahalanobis", size = 0.2, times = 10)
cat("2. Classification error rate (depth.Mahalanobis): ", 
    stat2$error, ".\n", sep = "")



Run the code above in your browser using DataLab