저는 R이 처음이에요. 무엇이 잘못되었는지 이해해주세요. 일부 데이터를 예측하려고하지만 예측 함수가 반환하는 객체 (이상한 클래스 (요소))에 낮은 데이터가 포함되어 있습니다. 테스트 세트 크기는 5886입니다. 예측 된 객체 길이가 110 일 때 160 개의 변수 중 ... 예측 된 클래스 또는 데이터 프레임의 벡터가 기대됩니다. 나는 무엇을 잘못 이해 하는가?R SVM 예측
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
관찰 누락 처리하지 않습니다
[위대한 R 재현 가능한 예제를 만드는 방법?] (http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – zero323
데이터 집합을 추가했습니다 – UndeadDragon