What Exactly are Neural Networks?

Adrian Javorski
5 min readOct 29, 2020

--

Artificial Neural Networks (ANN), or more commonly known just as neural networks (NN), are a group of machine learning systems that simulate the structure and functionality of a brain. Neural networks utilize various nodes, often referred to as neurons, to process information and output the results. By creating these artificial neurons and using the connections between them (known as weights), Artificial Neural Networks are effective methods for solving adaptive control or predictive modeling problems when fed training datasets.

Neurons

Now, you may be wondering how you would even start using Neural networks in your future projects, and lucky for you; I’m here to teach you how to begin your journey down the rabbit hole!

A Deep Feedforward Neural Network

Before we begin our journey using Brain.js, a simple and straightforward javascript library that provides the tools and resources to begin creating Neural networks and machine learning applications, let's go over a crash course on the different types of Neural Networks!

The first and simplest type of Neural Network is the Perceptron.

Perceptron

Perceptrons consist of only inputs and an output, without any extra hidden layers of neurons available for processing information to create an output. The different n amount of inputs are classified by varying weights used in determining the model's output. Although the Perceptron model is considered the fundamental model of Neural Networks, Perceptron models are limited to only a single layer of complexity.

The next type of Neural Network often seen is the Feed Forward Model.

FeedForward Neural Network Example

Feedforward Neural Network models are similar to Perceptron models, though they can process information from their inputs with a secondary layer of complexity, known as the hidden layer. With the Feedforward model, providing training data to refine outputs better is essential. This hidden layer is based on the training data that set weights for the artificial intelligence model's various neurons.

Furthermore, when additional hidden layers are added to a Feedforward model, it is considered a Deep feedforward neural network type! With each additional hidden layer added, more levels of complexity can be implemented during the process of finding an optimal output, though drawbacks of this include longer or more complex training being required, as well as the application becoming more resource-intensive, which could become an issue for resource-limited systems. (An example visual of a Deep Feedforward network can be found towards the top of this article if you're interested!)

All of these Feedforward types of Neural Network models are based on the first type of Neural Network; the Perceptron model, though Feedforward Neural Networks include more complexity levels than a Perceptron Neural Network.

When processing input information, such as images or videos, other Neural Networks named Convolutional Neural Networks, become the better option for finding desired outputs. Convolutional Neural Network models similar to the Feedforward models allow for added layers of complexity not available to a simple Perceptron model. These complexity layers include pooling layers and filters to understand better possible outputs that come from viewing pixels within images and videos.

Convolutional Neural Networks first filter information from the image or video input using the given filters and then using pooling layers to sort that information with different pooling methods provided to the application. By providing access to filters and pooling methods, Convolutional Neural Networks become the first choice of Neural Networks when questions or problems arise, with only images or videos being a source of input.

The final type of Neural Network that is commonly used is the Recurrent Neural Network.

Recurrent Neural Network models use previous historical data to predict and process information for the output. Recurrent Neural Network models are often used for problems or challenges arising in the stock market or other real-time environments where massive amounts of historical information exist, and a machine learning application can find patterns or trends.

Now, you may be asking, what is the difference between Recurrent Neural Network models and other Neural Network model types? Recurrent Neural Network models can remember previous data that has been processed by the machine learning application. This allows Recurrent Neural Networks to become more efficient and accurate; the more data fed through the model.

Previous data fed into a Recurrent Neural Network is known as State Matrices, which act the same way as a hidden layer within a Feedforward Neural Network model, though are weighted differently based on the information stored from previous runs of the model.

Now that we are through the small crash course on the various Neural Network models let's set up a simple Feedforward neural network using Brain.js!

Brain.js, as previously stated, is a simple Javascript library that provides the frameworks to set up and use the various neural network models quickly.

Once installed using npm, using Brain.js is as simple as importing the Brain module into the javascript file.

With the newly initialized Neural Network stored in the constant variable “network,” methods such as train() become available to customize and set up our neural network, which we will use to provide past match data from two sports teams.

The output is an index of provided possible outputs.

The context of this example is two teams that have five categories in which they can win. Team 1 (index 0) or team 2 (index 1) can be a possible output based on the provided training data.

From this training, our Neutral Network becomes better at finding patterns from the seemingly random information, which allows it to find a predicted winner if these two teams were to compete in the future.

Here is a full example of the program I made that takes five categories and predicts which one of the two teams inputted is more likely to win the next game. (Disclosure: this neural network focuses on the pattern more than actual statistical data from the two teams' matches. Especially since this data is made up and not from actual teams or sports)

For more information on Brain.js, visit the home page for Brain.js. You will find information on other methods available to be utilized in programs and other potential Machine learning models you could use to suit your needs better!

--

--