19/5/2022
As we've covered the basic definitions of artificial intelligence and machine learning in the last blog, this article will provide you with explanations of each attributes that make up machine learning models. We will cover terms that have to do with normal neural networks, neural nets for image classification, natural language processing, and tabular data processing.
In the last article we have shed light on basic terms like loss, gradients, models, etc., we will also go over them again in detail in this blog.
Models are essentially the whole neural network, the arrangemets of neurons, distributions of weights, layers, input and output, are all part of the machine learning model. There are many components in a machine learning model.
A neuron is a mathematical function that collects and classifies information according to a specific architecture.
When neurons are interconnected together, it is called a layer. When multiple layers are connected together, the input layer takes in input patterns, the output layer gives out signals or classifications of a specified purpose, and probably some other layers inbetween, we call that a Multi-layered perceptron.
A dataset is a collection of data that will be used to train, validate, and test our models. A dataset consists of features and labels. The neural network learns to predict the labels from the input features.
Datasets, when loaded into a model, should be split into a training set, a validation set, and a test set. The training set contains data that will train our neural network. The input gets sent through the neurons and the network outputs a prediction, which will then be used to calculate the loss, make a gradient descent, and optimize the model again. After each training loop, the model gets a validation set input, which will be used to find metric scores, and further improve the model's functions.
After all training loops, when we're confident that we've got a good enough model, we will do a final sanity check with our test set, which will determine our model's accuracy, or any other metrics that we're interested in.
Dataloaders are tools that we use to load data into our training environment, to make sure we are passing in the input data in the correct format, in the correct shape.
Don't have enough data to train on? We can augment our already existing data to make even more data to train on. Data augmentation is essentially giving our data modifications so that they look slightly different from our old data.
The trainer is a program that will pass the inputs from the datasets into our model, it will take care of handling losses, optimizing models, tracking the gradient descent, etc.There are a lot of components in the trainer that we will go over.
The loss functin in the neural network gives the difference of the model predictions to the real labels. From the loss function that gets put out in every training loop, we can track the changes in the loss value to make a gradient descent.
The activation function recieves the data from the hidden layers to generate an output. There are many activation functions that we can use for many appliations. ReLU (Rectified Linear Unit) is a popular activation function used to essentially remove negative units by turning them into 0
Metrics are the values we use to measure the quality of our model. The most common metrics used to evaluate models are loss, accuracy, and f1-score.
An optimizer in the model is a class that updates the weights in our model using the loss and gradient descents by doing operations to the weights with the gradient value.
This has been a deeper look into the terminologies as I understand it, in the next blog I will write about getting our data to train.
12/5/2022
This blog will cover the basic terminologies and definitions conerning artificial intelligence. To pave a good foundation towards higher understanding forward, we should have a good understanding of what AI is, and what it isn't.
In the public understanding, there are 3 major terms regarding AI: artificial intelligence, machine learning, and deep learning. These three are closely related, yet very distinct and very defind of their own. All the three terms AI, ML and DL are often used interchangeably and at times can be confusing. In summary, AI is a very broad term used to describe any system that can perform tasks that usually require the intelligence of a human. ML is a subset of AI whilst DL is a subset of ML algorithms.
Now that we've established a general understanding of the definitions, we can get into what really matters in this course, machine learning! Using neural networks!
Neural nets are essentially a product that humans made up to imitate the brain. As our brains have neurons with connections to each other, sending signals through electricity, neural nets do essentially the same. They are literally neurons that can communicate with each other, placed in layers. The neural nets will have at least an input and output layer. When neural networks are constructed, the neurons are literally blank, and requires learning to tune the model to give off useful output.
Neural networks go through training to tunr their neurons (a.k.a weights) to give accurate output. The training is conducted in loops, and in each loop a lot of cool things happen.
Dataloader
, which essentially will give off the data in batches to trainloss function
. The function calculates how far the predictions are off from the correct labels (less is better).
4.Calculate gradients: When the model gets the loss values of all the batches, it will calculate the Gradients
, which is like a map of how much the model has improved. The gradient will then be passed into an Optimizer, which will update the weights.Going through steps 1-4, with each batch, is called an iteration. and for the batch that gets passed in every iteration, is called an epoch. 1 training loop is literally 1 epoch.
After the training is finished, the model will have to evaluate itself with the data it has never seen before, called a Validation set
. This is intended to make the model prove that it really fulfills the objective, and not just exploiting certain irrelevant features in the training set.
In this blog, we have gone through the definitions of what ML really is, and explored a bit into how it trains. Next time, we're going to talk about what these seemingly simple models are truly capable of.
Content
Copyright © urseamajoris 2022, all rights reserved.