Understanding Machines.

“What do you think about the concept of quantum mechanics?”
“Generate a video of Sam Altman fighting alongside Elon Musk in a trench war — make it look like WWII.”
“Revise my code and improve it using industry-standard engineering practices.”
These are some of the interesting prompts AI chatbots receive daily — and in less than a minute, we have our answers: a concise explanation of quantum mechanics, perhaps simplified for a five-year-old or tailored for an engineering intern; a realistic video of Sam fighting alongside Elon in a trench with high-quality audio; or a newly improved, industry-standard codebase.
But how does this happen? What goes on in the background? How does the AI understand these messages, process them, and generate almost perfect responses? How do machines learn to do this?
The concept of AI or machine learning still feels like a mystery to many people, especially those outside the field. It can almost sound like sorcery when people talk about it. I don’t blame anyone who thinks that way — there’s a lot to unpack, and not many articles truly bridge the knowledge gap from scratch. This article will attempt to provide some foundational understanding of the concepts behind these technologies and offer a clear path to learning how machines learn and become intelligent
Before we dive deeper into Artificial Intelligence (AI), it’s important to understand that everything we see today — chatbots like ChatGPT, self-driving cars, image recognition, and even recommendation systems — can be traced back to a very simple mathematical foundation: the equation of a straight line, written as y = mx + b. This equation, also called a linear equation, is at the heart of linear regression, one of the most basic ideas in machine learning. Even though today’s AI models may seem extremely advanced and complex, they are all built on top of this fundamental concept of learning patterns from data.
In mathematics, this equation is used to draw a straight line on a graph, where y is the output, x is the input, m is the slope (which tells us how steep the line is), and b is the intercept (the point where the line crosses the y-axis). In the world of machine learning, these same terms take on new meaning. y becomes the target — the value we are trying to predict. x represents a feature, which is simply input data. m becomes the weight or coefficient, which determines how strongly a feature influences the output. Finally, b is called the bias, which helps adjust the model to make better predictions. So, although the equation may look simple, it is already teaching a machine how to make predictions.
Let’s bring this into a real-world example. Imagine we want to predict the price of a future MacBook using machine learning. To do this, we would first collect data from the past 20 years of MacBook releases — things like screen size, year of release, processor type, RAM size, storage capacity, and real selling price. If we simplify the problem by using only one feature — for example, the screen size — we can use our equation to build a model: Price = m × ScreenSize + b. After training the model with real data, it might learn values like m = 0.7 and b = 0.3. These numbers are not random; the machine calculates them by analyzing patterns in the data. If we now plug in the feature for a 16-inch MacBook, we get Price = 0.7 × 16 + 0.3 = 11.5 (a simplified example), which represents the model’s price prediction based on what it has learned.
What we are really doing here is teaching the machine to discover patterns from data and use those patterns to make predictions. This process — drawing a line that best fits the data — is called linear regression. It may seem simple, but it was the first step toward machine learning. And even though AI today has evolved far beyond this basic equation, the idea behind it is still the same. Modern AI models like GPT use millions or even billions of versions of x, m, and b, stacked together in complex networks. But at their core, they are still learning patterns just like this simple straight-line model.
That’s why we say that AI began with y = mx + b. Understanding this foundation makes it much easier to understand how machines learn.
Building on this foundation, let’s now see how linear regression can actually make a prediction for a future MacBook model, such as the 2025 or 2026 release. Remember, the machine doesn’t magically “know” the future — it simply learns patterns from past data and uses those patterns to estimate what is likely to happen next.
If we continue with our earlier example, where we collected 20 years of MacBook data, the model has already learned how features like screen size, release year, or processor type affect the price. But to predict the price of a MacBook in 2025 or 2026, we need to add time as a feature. That means instead of using just screen size, our equation now looks like this:
Price = 𝑚1 × Year + 𝑚2 × ScreenSize + 𝑏
Now we’re working with more than one input feature, which is called multiple linear regression. Each feature gets its own weight (slope), because each one affects the price differently. Let’s assume the model has learned the following from past data:
𝑚1 = 120 — meaning every new year, MacBooks get about $120 more expensive on average.
𝑚2 = 250 — meaning each extra inch of screen adds around $250 to the price.
𝑏 = −238,000 — this may look strange, but bias values can be large because they help adjust the equation to fit real-world data.
Now let’s use this to predict the price of a 2025 16-inch MacBook:
Price = 120 × 2025 + 250 × 16 − 238000
Price = 243000 + 4000–238000 = 9000
So based on past trends, the model predicts that a 2025 16-inch MacBook could cost around $9,000 (this is a simplified example, but it demonstrates how prediction works). If we want to estimate the 2026 model, we simply change the year:
Price = 120 × 2026 + 250 × 16 −238000
Price = 243120 + 4000–238000 = 9120
From this, the model predicts the 2026 MacBook might cost slightly more, around $9,120.
Now, of course, Apple doesn’t price their laptops exactly like this. Real models use many more features — processor generation, GPU, inflation rate, demand, production cost, and even marketing strategy. But the goal here is not to get a perfect price; it’s to show how machines learn patterns and make predictions using math.
This is exactly how machine learning started — simple equations that learn from data.
As machines try to get closer to the correct answer (called the ground truth) through their predictions, they will naturally make mistakes — especially when they are still learning. Sometimes the machine may detect the wrong pattern in the data, which causes it to make poor predictions. So how do we measure these mistakes? And more importantly, how do we teach the machine that it is wrong so it can improve?
This is where the concept of a loss function comes in. A loss function is simply a mathematical way of measuring how far a prediction is from the actual correct value. You can think of it as a form of penalty for being wrong. The larger the mistake, the larger the penalty.
There are two simple and common types of loss functions:
- Mean Squared Error (MSE) — This takes the difference between the prediction and the actual value, squares it, and averages it. Because it squares the error, it punishes big mistakes more heavily.
- Mean Absolute Error (MAE) — This takes the absolute difference between the prediction and the actual value and averages it. It treats all errors more fairly, so it is less sensitive to very large mistakes.
In simple terms, a loss function answers this question:
“How wrong was the prediction?”
If the loss is a large number, the prediction was bad.
If the loss is a small number, the prediction was close to correct.
Let’s return to our MacBook example. Suppose the real price (ground truth) of the 2023 MacBook Pro is $1500, but our model predicted $1200.
To measure how bad this prediction is, we calculate the loss:
Error = 1500–1200 = 300
Using MSE, we square the error:
MSE = (300) ^ 2 = 90,000
A high loss value like 90,000 tells the model: “This prediction is far from correct — learn better next time.” The loss function gives feedback to the machine, helping it adjust and improve over time. Without this feedback, the machine would have no way of knowing whether it is learning correctly or drifting far from reality.
Everything explained above represents the basic foundation of how a machine learns. These simple concepts — like linear regression and loss functions — form the base of all complex AI models that exist today. However, modern AI builds on top of these ideas using more advanced concepts that allow machines to learn deeper patterns, process complex data like images, sound, and language, and generate intelligent responses. Some of these key concepts include:
Neural Networks
A neural network is inspired by how neurons in the human brain work. Instead of having just one equation like in linear regression, a neural network connects many of these equations together. Each equation acts like a small decision-maker (called a neuron), and when you connect many of them together, the network becomes capable of understanding more complex data. The connections between neurons have weights that get adjusted as the machine learns.
Gradient Descent
Gradient Descent is the method a machine uses to improve itself by learning from mistakes. After the loss function tells the model how wrong it was, gradient descent helps adjust the weights and bias step by step to reduce the error. Think of it as the model taking small steps downhill on a graph of errors until it finds the lowest point, which represents the best prediction. During this process, important concepts like learning rate (how big each step is) and derivatives (which direction to move) come into play. Momentum is also sometimes used to speed up learning.
Deep Learning
Deep learning is simply neural networks taken to the next level. Instead of one or two layers of neurons, deep learning models have many layers — this is why they are called “deep.” These layers allow the model to learn complex features step by step. A deep learning model usually has:
· Input Layer — takes in the data
· Hidden Layers — learn and extract patterns
· Output Layer — makes the final prediction
Deep learning also uses backpropagation, a process where the model sends errors backward through the network to update the weights and learn more accurately.
Natural Language Processing (NLP)
NLP is how machines understand human language. Since computers only understand numbers (0s and 1s), language has to be converted into numbers first. This is done using methods like Bag of Words (BOW), TF-IDF, word embeddings, and powerful models like BERT. Once language is converted to numbers, the machine can analyze it, understand context, and even generate text in response — like chatbots do.
Retrieval-Augmented Generation (RAG)
RAG is a newer technique used in AI that helps models give more accurate answers by retrieving information from external knowledge sources before generating a response. This prevents hallucination and makes AI responses more reliable.
Convolutional Neural Networks (CNN and RCNN)
These networks are designed to work with images. CNNs can recognize shapes, edges, and objects in pictures, which makes them useful for tasks like face recognition and self-driving cars. RCNNs (Region-based CNNs) go a step further by detecting and locating multiple objects in an image.
Vision Transformers (ViT)
Vision Transformers are a modern alternative to CNNs for image understanding. They use the transformer architecture (originally made for language) to process images more efficiently and with better accuracy in some cases.
Transformers (From RNN → LSTM → Transformers)
Before transformers, machines used Recurrent Neural Networks (RNNs) and LSTMs to understand sequences like text. However, these were slow and struggled with long sentences. Transformers solved these problems using a mechanism called attention, which allows the model to focus on the most important parts of a sentence. Transformers are the backbone of today’s AI models.
Attention Mechanism
Attention allows a model to focus on important information instead of treating every word or part of data equally. It mimics how humans pay attention — by giving more weight to important words or features.
Large Language Models (LLMs)
LLMs like GPT bring everything together — neural networks, deep learning, NLP, transformers, and attention. They are trained on massive amounts of text data and can understand and generate human-like language. They still use the basic core ideas we started with: weights, bias, loss functions, and gradient descent — just at a massive scale.
Each of these concepts uses different loss functions to measure how well they are learning, depending on the specific task — classification, translation, regression, or generation.
This may seem like a lot of information, especially if you are new to AI, but if there is one thing you should take away from this article, it is this: machines learn in a simple way — by finding patterns using the equation of a straight line and improving through their mistakes using loss functions. That’s it. Every complex AI system in the world today — from self-driving cars to ChatGPT — is built on top of this foundation. The same ideas of weights, bias, predictions, loss, and corrections are still at work today, just at a much larger and more advanced scale.
Quick Tip: Whenever you hear someone say, “This AI model has 2 billion parameters,” don’t get intimidated. All it means is that the model has 2 billion weights and biases — which are just numbers the machine learns and adjusts to make better predictions. The more parameters, the more complex patterns the model can learn — but the basic learning principle remains the same.
Another Helpful Way to Think About It:
· A small model = few weights → learns simple patterns
· A huge model = many weights → learns complex patterns
So even the smartest AI today is still doing the same thing you just learned — learning from data, making mistakes, and getting better step by step.
If you stay curious, learn the basics well, and practice building simple models, everything else in AI will become easier to understand.
This is my final semester at Fanshawe College, where I’m studying Artificial Intelligence and Machine Learning. I’m writing this article not just to simplify the concepts behind AI, but also as part of my preparation for an upcoming internship interview — a stepping stone in my journey from Backend Engineering into Machine Learning Engineering.
This field excites me more every day. I’m especially drawn to computer vision, the part of AI that allows machines to see and understand the world. So far, I’ve built an end-to-end facial recognition system called FriendNet, and right now I’m working with an amazing team on an accessibility-focused AI product — something we can’t wait to share with the world soon.
This journey hasn’t been easy, but it has been worth it. If there’s anything I’ve learned, it’s that, AI isn’t magic — it’s curiosity, mathematics, and the courage to build things that don’t exist yet.
Uhm by the way, if you are reading this — I got the job.
Ciao.

