I'm new in R, so help me please to understand what is wrong. I'm trying to predict some data, but object that predict function returns (it is strange class (factor)) contains low data. Test set size is 5886 obs. of 160 variables, when predict object lenght is 110... I expected vector of predicted classes or data frame back. What do I understand wrong?
library(MASS)
library(e1071)
set.seed(333)
data <- read.csv(file="D:\\MaсhLearningAssign\\pml-training.csv", head=TRUE, sep=",")
index <- 1:nrow(data)
testindex <- sample(index, trunc(length(index)*30/100))
train <- data[-testindex, ]
test <- data[testindex, ]
model <- svm(classe~., data = train, kernel="radial", gamma=0.001, cost=10)
prediction <- predict(model, test)
summary(prediction)
Output:
A B C D E
28 24 25 12 22