diff --git a/lab3/assignment4.R b/lab3/assignment4.R index 6a5e365cbb7246e0842937a91e4463d10d3b1949..13c46136fc89f23224ea89fba4dae9ed0216339b 100644 --- a/lab3/assignment4.R +++ b/lab3/assignment4.R @@ -80,4 +80,25 @@ points(mydata1[,1],prediciton, col="red", cex = 1) # Part 4 +nn$weights + +# Part 5 + + + +Var2 <- runif(500, 0, 10) + +mydata2 <- data.frame(Sin2=sin(Var2), Var2) + +formula1 <- Sin2 ~ Var2 + +nn2 <- neuralnet( formula1 , data = mydata2, hidden = c(10), startweights = winit) + + + + + +plot(mydata2, cex=2, main = "500 random points reverse", ylim = c(-2,10)) +points(mydata2, col = "blue", cex=1) +points(mydata2[,1],predict(nn2,mydata2), col="red", cex = 1)