Description Usage Arguments Value Examples
View source: R/Classif.quantile.R
Quantile classifier
1 | Classif.quantile(obj, testset, testlabel, weighted = obj$weighted)
|
obj |
An FOBJ for classification |
testset |
Must be a matrix of testset. Each row is an observation of curve. In terms of the prediction to single curve, view |
testlabel |
Testlabel, which length should be equal to the number of rows of testset |
weighted |
Logical. It is to define whether weight is to be used. Default the same to |
A list containing the classification result
MCR |
The total misclassification |
pre |
The predictive result |
FP |
False positive rate if only two groups |
FN |
False negative rate if only two groups |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | rm(list = ls())
library(refund)
data(DTI)
X <- DTI$cca
y <- DTI$case
t <- seq(0, 1, length.out = ncol(X))
#not run
#datacheck(X, y, t)
allData <- cbind(X, y)
allData <- allData[which(DTI$visit == 1), ]
allData <- na.omit(allData)
y <- allData[, ncol(allData)]
X <- allData[, -ncol(allData)]
t <- seq(0, 1, length.out = ncol(X))
datacheck(X, y, t)
Index_0 <- which(y == 0)
Index_1 <- which(y == 1)
SplitPara <- 0.8 #Split parameter
trainIndex_0 <- sample(Index_0, SplitPara * length(Index_0))
testIndex_0 <- Index_0[-trainIndex_0]
trainIndex_1 <- sample(Index_1, SplitPara * length(Index_1))
testIndex_1 <- numeric()
for(i in Index_1){
if(i %in% trainIndex_1 ==FALSE){
testIndex_1 <- append(testIndex_1, i)
}
}
trainset <- X[c(trainIndex_0, trainIndex_1), ]
trainlabel <- y[c(trainIndex_0, trainIndex_1)]
testset <- X[c(testIndex_0, testIndex_1), ]
testlabel <- y[c(testIndex_0, testIndex_1)]
w1 <- FOBJ(trainset, trainlabel, t)
c1 <- Classif.quantile(w1, testset, testlabel, weighted = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.