Guest User

Untitled

a guest
Oct 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. x <- cbind(seq(1, 50, 1), seq(51, 100, 1))
  2.  
  3. y <- x[,1]*x[,2]
  4.  
  5. colnames(x) <- c('x1', 'x2')
  6. names(y) <- 'y'
  7.  
  8. dt <- data.frame(x, y)
  9.  
  10. model <- neuralnet(y~., dt, hidden=10, threshold=0.01)
  11.  
  12. n <- names(dt)
  13. f <- as.formula(paste("y ~", paste(n[!n %in% "y"], collapse = " + ")))
  14. f
  15.  
  16. ## gives
  17. > f
  18. y ~ x1 + x2
  19.  
  20. ## fit model using `f`
  21. model <- neuralnet(f, data = dt, hidden=10, threshold=0.01)
  22.  
  23. > model
  24. Call: neuralnet(formula = f, data = dt, hidden = 10, threshold = 0.01)
  25.  
  26. 1 repetition was calculated.
  27.  
  28. Error Reached Threshold Steps
  29. 1 53975276.25 0.00857558698 1967
  30.  
  31. f <- reformulate(setdiff(colnames(dt), "y"), response="y")
Add Comment
Please, Sign In to add comment