From API to GPU, Week 6 (Part 1): A Model That Predicts, and How Wrong It Is
Phase 2 of 8: Enough ML to understand inference. Week 6 of 32, part 1 of 2. Every week so far, the model already existed. I ran Phi-4, read Qwen's files, and measured tensors, but I never made a model learn anything. This week I build one from scratch and train it. That is a lot for one sitting, so I split the week into two posts and go slowly. The goal: the model starts with a random weight and…
The article discusses a simple one-neuron linear model designed to predict Celsius to Fahrenheit conversions. This model starts with randomly assigned weights and biases, which are essentially incorrect initial guesses. The training process involves adjusting these weights and biases iteratively to minimize the difference (error) between the predicted and actual Fahrenheit values.
The first post focuses on building this basic model and explaining how it makes predictions and measures the errors. The core concept is a forward pass, where input Celsius values are processed through the model to produce predictions. Initially, the weights and biases are random, resulting in nonsensical predictions. The article provides an example of converting Celsius values to Fahrenheit using the true formula: F = C * 1.8 + 32.
The model uses this formula to construct the correct answers (labels) for six pairs of Celsius and Fahrenheit values.
The key takeaway is that the model learns by comparing its predictions with the actual values and adjusting its internal parameters (weight and bias) to reduce the error. This learning process involves making a guess (forward pass), measuring the error (loss), determining how to adjust the parameters, and taking a small step in that direction.
This loop of prediction and adjustment continues until the model's predictions closely match the actual values. The article emphasizes that this explanation is focused on the prediction and error measurement aspects, with the actual learning process covered in the subsequent post.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.