从this question,我想知道是否有可能提取二次判别分析(QDA)的分数,并在像PCA分数后重用它们。如何绘制质量:qda分数
## follow example from ?lda
Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
Sp = rep(c("s","c","v"), rep(50,3)))
set.seed(1) ## remove this line if you want it to be pseudo random
train <- sample(1:150, 75)
table(Iris$Sp[train])
## your answer may differ
## c s v
## 22 23 30
使用QDA这里
z <- qda(Sp ~ ., Iris, prior = c(1,1,1)/3, subset = train)
## get the whole prediction object
pred <- predict(z)
## show first few sample scores on LDs
在这里,你可以看到,它不工作。
head(pred$x)
# NULL
plot(LD2 ~ LD1, data = pred$x)
# Error in eval(expr, envir, enclos) : object 'LD2' not found
这就是为什么我问这个问题,我不知道在哪里或如何获得通常存储在'predict'函数'x'中的分数。 –
'predict.qda'_clearly__states_返回'class'(MAP分类)和'posterior'(类别的后验概率)的帮助。 – hrbrmstr
是的,但我想知道排序分数在哪里... –