Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data<- pca.train
- train<-data.matrix(pca.train, rownames.force = NA)
- rmse <- function(error)
- {
- sqrt(mean(error^2))
- }
- f <- function(V1, V2,V3,x,y)
- {
- V1 <- log10(B1)
- V2 <- log10(B2)
- V3 <- log10(B3)
- svm.model <- svm(x=train, y=data$y1,scale=F, type= "eps-regression",kernel="radial",cost = V1,epsilon= V2,gamma= V3)
- error<- pca.train$y1- svm.model$fitted
- return (rmse(error))
- }
- B3<- seq(1, 2,0.1)
- B1<- 2^(2:9)
- B2 <- seq(0.1,1, 0.1)
- n <- 50
- m.l <- 50
- w <- 0.95
- c1 <- 0.2
- c2 <- 0.2
- xmin <- c(-5.12, -5.12)
- xmax <- c(5.12, 5.12)
- vmax <- c(4, 4)
- optimum <-psoptim(f, n=n, max.loop=m.l, w=w, c1=c1, c2=c2,xmin=xmin, xmax=xmax, vmax=vmax, seed=5, anim=FALSE)
- OPTIMIM.VALUE<- f(optimum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement