Logistic discrimination


In [7]:
load("PCA.rda")
load("DP.rda")
suppressMessages(library(caret))
set.seed(201703)

In [10]:
options(warn=-1)
# Logistic Discrimination
pca_ld_s = train(response~., data = pca_train, method = "glm", family = "binomial", trControl = trainControl(method = "LOOCV"))
pca_ld_te = predict(pca_ld_s, data.frame(pca_test_s))
pca_ld_ac = mean(pca_ld_te == golub_test_r)
pca_ld_re = c(LOOCV = pca_ld_s$results$Accuracy, Test = pca_ld_ac)

In [11]:
pca_ld_re


LOOCV
1
Test
0.970588235294118