Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Zadanie 3
- depression <- c(6,4,0,4,0,11,11,5,8,4,12,8,9,8,11)
- anxiety <- c(8,3,2,1,8,9,6,7,6,9,11,8,6,10,4)
- chaos <- c(9,3,8,6,4,9,6,4,5,4,6,5,7,8,3)
- group <- c("g1", "g1", "g1", "g1", "g1", "g2", "g2", "g2", "g2", "g2", "g3", "g3", "g3", "g3", "g3")
- data.set <- data.frame(depression, anxiety, chaos, group)
- ctrl.loo <- trainControl(method = "LOOCV", search = "grid")
- # metoda liniowa
- model.lda <- train(group ~ depression + anxiety + chaos,
- data = data.set,
- method = 'lda',
- trControl = ctrl.loo)
- # metoda kwadratowa
- model.qda <- train(group ~ depression + anxiety + chaos,
- data = data.set,
- method = 'qda',
- trControl = ctrl.loo)
- # bayes
- model.nb <- train(group ~ depression + anxiety + chaos,
- data = data.set,
- method = 'nb',
- trControl = ctrl.loo,
- tuneGrid = data.frame(usekernel = FALSE, fL = 0, adjust = 1))
- #LDA
- 1 - model.lda$results[2]
- #QDA
- 1 - model.qda$results[2]
- #BAYES
- 1 - model.nb$results[4]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement