An Introduction to AI and Machine Learning

Francis Liu
6 min readNov 18, 2020

AI is defined as machines that have the capability to think like humans. In other words, it’s a really broad field. It includes all types of neural networks, machine learning and deep learning, natural language processing, and quite a number of other fields too. Let’s dive right in.

Machine Learning

The basic concept of machine learning is very interesting. Machines are initially built with almost no skill at doing the task — sorting images for example. However, they are all built with slight variations, and if enough of them are built, one will happen to have an attribute that is favorable for accomplishing the task. That one machine will be ever so slightly better than all of the others. Then, another wave of machines will be made, based off of the one machine that performed slightly better last time.

This process continues on, and each time the machine that had the slight advantage is chosen. This almost resembles the process of natural selection that happens in nature, where one individual ends up with an advantageous attribute by random chance, is able to survive, and eventually, the entire population has that trait.

It is by this process that companies determine which ads will pop up on your screen. Machines are created which will show the ads to you, and whichever algorithm is most successful in getting you to click on the ad or buy the product will be the algorithm that is chosen, and future models will be based on it.

(robots don’t actually sit down and read books like this)

Neural Networks

Neural networks are one example of machine learning that is prevalent in today’s world. Neural networks are modeled after the human brain. They are designed to classify and label data, which can be especially useful when there is a large amount of data one needs to analyze, which will be too tedious to do manually or with a traditional program.

So how do they work?

Neural networks are made up of layers of neurons. First, there is an input layer where all of the data is put into the network. Then, there is an output layer where all of the sorted data comes out, and each neuron represents a different category. The output layer has far fewer neurons than the input layer. The layers in between are called hidden layers, and they account for most of the calculations done within the network.

Each neuron contains weights and biases, which determine whether the neuron will be activated, and to what extent the neuron will be activated. The weight is multiplied by the numerical value of the input into the neuron, while the bias is added on at the end. Since the neurons in the hidden layers receives inputs from multiple neurons, the final output has to be determined by an activation function, which uses the values of the inputs, weights and biases. The activation function produces a value between 0 and 1, which becomes the value that represents the neuron. Continuing this process through each layer of the network is called forward propagation. In the end, when the values of the neurons in the output layer are calculated, the neuron with the highest output represents the classification of the input.

So where does the machine learning part come in? What happens when the neural network is incorrect?

When one examines the output layer, each neuron’s value essentially represents a probability. Using the actual results, we can measure the extent to which the predicted result was accurate — the error. Then, one can adjust the weights throughout the neural network so that the error is minimized. This process is called backpropagation. It’s actually a very simple and clever solution in my opinion. It’s like if you are solving a problem and you already have an answer key, so all you have to do is keep adjusting your steps and calculations until you arrive at the correct answer.

Gradient Descent

But arriving at that correct answer is not a simple process. The neural network produces a number of final outputs, and each of them is incorrect by a certain amount. The square of the difference between the actual output and the desired output is defined as the cost. The smaller the cost, the more accurate the neural network.

Therefore, a cost function can be defined as a function where each of the weights and biases is considered the inputs and the cost is the output. The training data provides the data points that make up the function. We want to be able to minimize the cost function.

These cost functions are very complicated, so it is very difficult to find the absolute minimum. However, if one starts at a random point on the function, and moves it according to how the derivative changes as one moves left or right, they can find the closest local minimum — where the derivative will approach 0 as the point approaches the minimum and eventually equal 0 at the local minimum.

Given, if you choose a random point on the function to start at, the local minimum you end up at is very unlikely to be the global minimum. As such, this method is imperfect, but will likely still minimize the function to a great enough extent to be effective.

Where are neural networks used right now?

Neural networks are especially good for images — each pixel can be one input. The Google Translate software that allows you to point your camera at an image and translate it is one example of a neural network. Another one is the Face ID on your iPhone. Neural networks also have the capability to detect patterns and make projections based on past results, and can be used for weather forecasts, election result predictions, and as a tool to advise investors on stocks.

Where is AI being used right now? What’s next in the field of AI?

One of the major areas in which AI is being used right now is in self-driving cars. In fact, Google’s Waymo has set up a completely driverless taxi service in Phoenix, AZ which you can ride right now. Driverless cars will reduce the amount of accidents and drive in a far more efficient manner, saving thousands of lives and helping the environment. Talk about killing two birds with one stone.

Another way AI is being used right now has probably impacted every single person reading this article. Custom recommendations. Whether it’s on Youtube or Netflix, almost every entertainment service has a section which gives you new content to watch that you might like. This is done through AI, which looks through billions upon billions of data points and examines what you watched or liked in the past in order to predict what you might want to watch next.

The spam filter on your email is another example of artificial intelligence. By looking through past data points, the algorithm is able to make a decision on whether an email you received is spam or not based on certain characteristics. It’s extremely accurate as well.

AI is one of the fastest growing fields in the world today, and figures to be a major part of our future. Many jobs — cashiers, babysitters, even therapists — are beginning to get replaced by robots. Personally, I’m very excited for the future. Are you?

--

--