R 基于螺旋线数据的指数预测

R 基于螺旋线数据的指数预测,r,computer-science,data-manipulation,R,Computer Science,Data Manipulation,每个坐标(x,y)对应一个索引。例如:(0,0)有索引0,(1,0)有索引1 X <-c(0,1,1,0,-1,-1,-1,0,1,2,2,2,2,1,0,-1,-2) Y <- c(0,0,1,1,1,0,-1,-1,-1,-1,0,1,2,2,2,2,2) Z<- as.factor(0:16) df <- data.frame(X,Y,Z) library(e1071) model <- svm(Z ~ X+Y, xyz, kernel = "ra

每个坐标(x,y)对应一个索引。例如:(0,0)有索引0,(1,0)有索引1

 X <-c(0,1,1,0,-1,-1,-1,0,1,2,2,2,2,1,0,-1,-2)
 Y <- c(0,0,1,1,1,0,-1,-1,-1,-1,0,1,2,2,2,2,2)
 Z<- as.factor(0:16)
 df <- data.frame(X,Y,Z)
 library(e1071)
 model <- svm(Z ~ X+Y, xyz, kernel = "radial")
 predict(model, xyz[1:4,1:2]) #1.647681 3.859354 5.908940 4.151374 
# From the last code, it appears that it does not predict well for its own data 
X