# What is neural network in machine learning?

what is neural network in machine learning?. A neural network is a biologically inspired method for computers to learn through analyzing data.

what is neural network in machine learning & 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.