🧠 Get 1:1 help from a Software Engineer to automate your workflow → https://www.skool.com/ai-academy-with-robby-6849/about
Why AI Needs to Make Mistakes
Hi, I’m Robby! As a software engineer who builds AI systems every day, I often get asked: How does a computer actually 'learn'?
Think about when you learned to ride a bike. You probably wobbled, tipped over, or maybe even bumped into the grass. Those little mistakes told your brain how to balance better the next time.
In machine learning, we use something called a loss function to do the exact same thing for a computer. It is the teacher that tells the AI, "You were this far off the mark."
What is a Loss Function?
A loss function is a simple math formula. Its only job is to measure the gap between what the AI guessed and what the real answer actually is.
- High loss: The AI is making big mistakes.
- Low loss: The AI is getting very close to the truth.
Our goal as AI engineers is to shrink this loss number until it is as close to zero as possible.
A Real-World Example: Predicting House Prices
Let’s say you want to build an AI to guess how much a house costs based on its size (square footage).
- The Guess: The AI predicts a house costs $300,000.
- The Reality: The house actually sold for $350,000.
- The Loss: The AI missed by $50,000.
That $50,000 is the "loss." The model takes that number and uses it as feedback to tweak its internal settings so that next time, it will guess closer to the real price.
How We Measure the Gap: Mean Absolute Error (MAE)
One of the most popular ways to measure this error is called Mean Absolute Error (MAE). It’s a fancy name for something very simple:
- Take the difference: How far off was the guess?
- Make it positive: We don't care if the guess was too high or too low, just how far off it was.
- Average it out: We do this for a bunch of houses and find the average error.
Why This Matters for 2026
If you want to build high-quality AI, you have to understand the loss function. It acts like a compass. If the model isn't getting better, we look at the loss function to see where it’s getting confused.
By constantly checking the loss, we can guide the AI to learn faster and make much smarter decisions. It’s not magic—it’s just math helping a machine learn from its mistakes, just like we do!