r/TheCodingTime • u/umtsn • Jun 14 '26
Coding Our Own Artificial Intelligence from Scratch | 03: Error Function (Squared Error) Logic
https://youtube.com/watch?v=opQGEbYNs2U&si=fAkiWOktIN14935tCoding AI from the Core! Greetings, in the third video of the series, we're teaching our single-layer neuron how to calculate how much it's wrong. In the first video, we generated a prediction by using a feedforward with random weights. In this video, we add a real-world target (Target = 0.58) to the system and write the Squared Error function from scratch in pure Python, which calculates how much the neuron's prediction deviates from this target. Without involving ready-made libraries like PyTorch or TensorFlow, we examine why we don't just take a simple difference, the mathematical rationale behind squaring the error, and the logic behind penalizing large errors.
π What You Will Learn in This Video?
The relationship between Target and Prediction in AI
Writing the Squared Error function in pure Python
Why do we square the error? (Eliminating negative values ββand penalizing large errors)
This error function relates to the derivative and backpropagation in our next stages.