Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. data<- pca.train
  2. train<-data.matrix(pca.train, rownames.force = NA)
  3.  
  4. rmse <- function(error)
  5. {
  6. sqrt(mean(error^2))
  7. }
  8.  
  9. f <- function(V1, V2,V3,x,y)
  10. {
  11. V1 <- log10(B1)
  12. V2 <- log10(B2)
  13. V3 <- log10(B3)
  14.  
  15.  
  16. svm.model <- svm(x=train, y=data$y1,scale=F, type= "eps-regression",kernel="radial",cost = V1,epsilon= V2,gamma= V3)
  17. error<- pca.train$y1- svm.model$fitted
  18. return (rmse(error))
  19. }
  20.  
  21. B3<- seq(1, 2,0.1)
  22. B1<- 2^(2:9)
  23. B2 <- seq(0.1,1, 0.1)
  24.  
  25. n <- 50
  26. m.l <- 50
  27. w <- 0.95
  28. c1 <- 0.2
  29. c2 <- 0.2
  30. xmin <- c(-5.12, -5.12)
  31. xmax <- c(5.12, 5.12)
  32. vmax <- c(4, 4)
  33.  
  34.  
  35. 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)
  36. OPTIMIM.VALUE<- f(optimum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement