# How to Train an Artificial Neural Network Part I by Ray Sulewksi

Published on: 7/10/2018
Author: Ray Sulewksi, Senior Consultant, Award Solutions

Part 1: The Need for Data

So, how do you train an Artificial Neural Network (ANN)?

When building a neural network, you need to identify what kind of network you want to build based on the problem you are trying to solve. You also need to determine the types of data needed, the structure of the network, and which algorithms to use.

Our Problem: We want to train our ANN to recognize and classify critters as dogs, cats, or squirrels.

Our Approach:

For the purposes for this article we developed a simple ANN model called Critters. Our Critters model is trained to recognize and classify three types of critters: dogs, cats and squirrels. It is a monolayer, FeedForward Network (FFN).

A FeedForward Network is designed to have data flowing forward in the trained model, and there is no cycling of data backwards between layers or within a layer. The monolayer descriptor suggests that there is only an input and output layer (i.e., there are no hidden layers). This type of model, with no hidden layers, would not normally be used for the majority of real Artificial Intelligence (AI) applications, but it is great for this simple demonstration.

Visually, our Critters model looks like this:

The input layer provides the input data for each of the features to each of the neurons in the next layer. Note the mesh connections between the input layer and the output layer. We’ll describe each layer, their connections and their calculations as we step through this example model.

The Types of Data Needed

As with all ANNs, some human intervention is required before the network can start learning how to categorize its data (in our case, before it can classify the critters). So, before machine learning starts, the critters must be described in some fashion by input data. This can be done using pictures, characteristic descriptions, sounds, or other ways.

For the input data, we used descriptive information about the critters: tail length, ear size, shoulder height, weight, lifespan, hair length, temperament, and whether it's deemed indoor or outdoor. These are the features. A subset of our data is shown in the table below.

Each row in our table represents a training sample that includes eight critter features. (Please note that we only displayed six of fifteen training samples in the table above. Most neural network models would actually include hundreds, thousands, or even more training samples!)

How to Normalize the Data

All data used to describe the critters has to be converted into an associated number value before being placed into the input layer of the ANN. After converting the feature descriptions to a number, the subset of data will look like this:

The training data set is then normalized into a range of 0 to 1 using this formula:

In our example, if we selected Cat1 Critter Shoulder Height the equation would read: (15 - 2) / (45 - 2) = 0.3023)

Applying this equation across the entire table, the normalized data set would become:

We will also need to consider weighted values for each feature, but we’ll discuss these weights when we explain the activation formulas in the Critters model.

Input Layer

Now that we have training data, what does the start of this machine look like? Since we have eight features for each training data set, we have eight input neurons or cells in the input layer. Each cell represents the data for one feature.

Now that we have defined the data that will be used to train the network, the next step is to focus on the method that will be used to train the model. Details about this will be included in a subsequent article.