iris
데이터 세트를 활용하려고 시도했지만 라이브러리에서 작동하도록했습니다. tune
작업 :라이브러리 (e1071), 튜닝 변수 길이가 다릅니다.
library(e1071)
data <- data.frame(iris$Sepal.Width,iris$Petal.Length,iris$Species)
svm_tr <- data[sample(nrow(datasvm), 100), ] #sample 100 random rows
tuned <- tune(svm, svm_tr$iris.Species~.,
data = svm_tr[1:2],
kernel = "linear",
ranges = list(cost=c(.001,.01,.1,1,10,100)))
나는 svm_tr[1:2]
의 열 각각의 길이를 확인하고 그들은 같은 길이입니다. 함수가 직접 데이터 프레임을 가져 가지는 않지만 어쩌면 내가 누락 된 것일 수 있습니다.
두 번째 줄은'data' 변수를 생성하지만 세 번째 줄은'datasvm'을 사용합니다. 그것들은 동일한 것입니까? – G5W
이 복구되었습니다 - 예. – jmb277
''tune (svm, iris.Species ~., data = svm_tr [1 : 3], kernel = "linear", ranges = list (cost = c (.001, .01, .1) , 1,10,100)))'- 수식 인터페이스라면'$ '를 사용하여 변수를 참조하면 안됩니다. 'iris.Species' 컬럼이 발견되도록'1 : 2' 대신'data = svm_tr [1 : 3] '을 만들었습니다. – thelatemail