I'm trying to understand some basics of neural nets and am trying to build one that can predict the function $y = 2*x$ in R:
library(caret) library(nnet) v1 <- 1:1000 v2 <- v1 * 2 df <- data.frame(v1, v2) mod <- train(v2 ~ v1, data = df, method = "nnet") predict(mod, df)
I end up getting all 1's for the answers. I'm able to predict other, more complex functions using a neural net, but, for some reason, I can't predict this function.
Does anyone happen to know why that might be?