x.train <-seq(-2,2,length.out=100)
y.train <-tanh(x.train)
m <- IBHM::TrainIBHM(x.train,y.train)
cat('Train MSE:',mean((y.train-predict(m))^2),'\n')
x.test <- runif(100, min=-4, max=4)
yh.test <- predict(m, x.test)
plot(x.test, yh.test)
Run the code above in your browser using DataLab