October 2017
Beginner to intermediate
572 pages
26h 1m
English
In this example, we will provide training data of a number and its square root. Using neuralnet we will generate the square root of any number. Perform the following steps in R:
> install.packages('neuralnet')> library("neuralnet")
Once the package is installed and loaded, we will create sample data of 50 numbers and their square roots in input and output. We combine both in DataFrame using the cbind function:
> input <- as.data.frame(sample(1:100, 50))> output <- sqrt(input)> data <- cbind(input,output)> colnames(data)<-c("Input", "Output")
Now, we will use neuralnet with 10 layers and a threshold for stopping:
> neuralsqrt = neuralnet(output~input,data,hidden=10, threshold =0.01)
We will create a test DataFrame, which will ...
Read now
Unlock full access