What’s Neural Network?

[This article was first published on Methods – finnstats, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

What’s Neural Network?. A neural network is a biologically inspired method for computers to learn through analyzing data.

When does a neural network become a deep neural network?

Here’s a neural network, and it’s not particularly deep!. Although it just has three layers, the term “deep” usually refers to dozens, if not hundreds, of them.

The circles represent “neurons,” which are devices that receive input (usually from several preceding neurons) and output (which then typically goes on to provide input for other neurons).

The lines depict the links between input (on the left) and output (on the right). The size of the weights is connected to the thickness of the lines and the shades of the lines.

Let’s see how to create a neural network model in R.

Load the data

library(MASS)
library(tidyverse)
data("iris")
iris <- as_tibble(iris)

We can make use of the caret package for the modeling.

Modeling

library(caret)
model <- train(Species ~ ., iris, method='nnet', trace = FALSE)
prediction <- predict(model, iris)
table(prediction, iris$Species)
prediction   setosa versicolor virginica
  setosa         50          0         0
  versicolor      0         47         1
  virginica       0          3        49

Let see the network visually.

Conclusion

Hope you understood what’s neural network & how to model the same in R. Adding one more point, It doesn’t matter how well you perform on the training set; if you work hard enough, you can get the error down to 0%. (or very close to).

However, success on unseen data does not always imply success (which, after all, is what you are interested in).

This is the problem of ‘generalization’ ability, or the capacity to perform effectively on data that hasn’t been seen in training.

Deep Neural Network in R » Keras & Tensor Flow

The post What’s Neural Network? appeared first on finnstats.

To leave a comment for the author, please follow the link and comment on their blog: Methods – finnstats.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)