You might have heard the term Neural Networks thrown around when discussing AI (Artificial Intelligence), but what are they? How do Neural Networks help shape what the AI model creates?
This video will set you up to properly understand Neural Networks and the mathematical forms used in AI models, including image-generating and large language models.
▶️ Watch our other AI videos: • AI Industry Overview - Introduction
Key Sections 0:10 - What is a Neural Network? 0:28 - What are the 3 steps for AI models? 0:52 - What are input variables? 1:25 - How to structure unstructured data 2:47 - Mathematical Forms and Neural Networks 4:09 - What are Deep Learning Neural Networks? 4:37 - How are the values of each neuron determined? 5:54 - Setting training parameters 6:46 - Applying the Neural Network
📚 Want to learn more? This video is an excerpt from the AI Industry Learning Primer, meticulously curated by the digital e-learning content provider, Primerli: https://www.primerli.com/. The full module, comprising 10 bite-sized videos and quick quizzes, is tailored to empower professionals to grasp the industry intricacies in under an hour.
Do you have a favorite AI service? Let us know in the comments.
Enjoyed this video? Subscribe here: / @primerli ✅ Connect with us on LinkedIn: / primerli
Neural networks are one of the hottest topics in AI.
These are the mathematical forms used in the most advanced AI models,
including image generating models and large language models.
To better understand the neural network,
let's build a simple one for our T-NoT image recognition model.
Recall the three steps in building an AI model.
Choosing the input variables,
choosing the mathematical form,
and then finding the optimal parameters by training on a set of sample images.
Let's start with the first step,
selecting the input variables.
The input is clear,
an image that either does or doesn't contain the letter T.
But what are the input variables?
The inputs we considered in our store sales regression
were simple numerical values,
store size and zip code, for example.
This data was easy to assemble into a data table.
Each row was a sample store,
each column a different input variable.
This is called structured data.
In our T-NoT model,
each individual image file cannot directly become a row in a table.
Data of this type is called unstructured.
Images, text, and video are all unstructured.
To be usable in an AI model,
unstructured data must first be structured,
transformed into numerical values in a rows and columns friendly format.
In the case of an image,
this is done by rearranging the pixel data.
Let's assume our model uses very simple images,
just 4 by 4 pixels in black or white.
We can represent each image as a matrix of 16 entries.
One means black,
zero means white.
Structuring this data means turning it into one long row with 16 columns.
This would be 16 different input variables.
Easy, right?
Well, real-world images would be much larger,
3,000 to 4,000 pixels in each dimension and in color.
Transforming a 3,000 by 3,000 image with 3 pixel colors in the same way
leads to a row with 27 million columns.
That's a lot of input variables.
And more variables mean much more computational complexity.
When each data point is represented by a large number of attributes,
the data is described as high-dimensional.
Real-world pictures and other unstructured data,
like text, are indeed high-dimensional.
In our simple example, however,
we can represent each image with 16 dimensions or input variables.
Next, the form.
We know the form will be a neural network,
but this is a broad term.
We have a few specific design choices to make.
Any neural network will consist of layers of neurons.
The purpose of this network is to transform data over a series of steps
from the input layer to an output layer.
This is loosely inspired by how the biological neurons in the human brain work.
Since we have 16 input variables,
our input layer will have 16 neurons.
We can label them X1 to X16.
Our output layer, in this case,
can be a single variable designed to reveal the model's answer.
Is the input image a T or not?
We can call this neuron Y1.
In practice, this would likely be the probability
that the image is a T from 0 to 100%.
We could interpret anything above a threshold,
say 75%, as meaning, yes, it's a T.
Any layers or neurons assembled in between are called hidden layers.
The number of layers and neurons on each layer is a design choice.
The point of neurons on the hidden layers
is to create more opportunities for intermediate calculations.
More layers, more calculations, more encoded complexity.
Neural networks with more than two hidden layers are described as being deep.
This is the domain of deep learning.
Real-world deep learning neural networks often contain dozens of these layers,
with hundreds of neurons on each.
Let's keep it simple and just add one hidden layer with three neurons,
H1, H2, and H3.
So how is the value of each neuron determined?
This is also a design choice,
but generally, the value of each neuron is derived
from the value of the neurons in the layer before.
One approach is to make each neuron
the weighted sum of the neurons on the previous layer.
The weights in this sum,
which will show us connections between the nodes, are the parameters.
We'll optimize these during training.
The specific formula used, called the activation function,
can get much more complex than simple addition.
In our case, though, here's how the weighted sum works.
H1 is calculated by multiplying each x value
against its corresponding weight and adding it all up.
Basically, a sum product of all the x's and weights.
H2 and H3 are calculated in the same way.
Each node on this hidden layer introduces another 16 weights.
So now we have a total of 48 weights between the first two layers alone.
We need to repeat the process between each layer.
To calculate the output node,
we need a single sum using three new weights.
So, in total, this model has 48 plus 3 weights.
Remember, we don't know the values of these weights yet.
This takes us to our final step of the model build, training it.
This means to find the optimal values for the weights,
i.e. the parameters based on the training images.
This is a supervised learning example.
Our training set is labeled.
We know if they are Ts or not.
So we can give the model an initial set of weights
and see how well the predicted outputs match the known outputs.
Say we fed it 100 images and it got 30 right.
This is a 30% accuracy rate.
We can then tweak the weight values, i.e. the parameters,
until this accuracy rate is optimized.
There are many algorithms that can be used to do this tweaking,
but all of them work iteratively via some form of trial and error.
This topic gets deep quickly.
Training algorithms are a major research focus and beyond our scope here.
Now that the model has been built,
applying it means inputting another image.
The model will decide Ts or not.
Real-world image recognition models are of course more complicated
and they use a more complicated but similar neural network architecture
known as the convolutional neural network or CNN.
And when image models are used to generate pictures and videos,
different architecture must be used.
For example, so-called diffusion models.
Similarly, text-based models like ChatGPT
use their own unique flavors of the neural network.