LightMySky

Weighted Models: Learned Parameters and Written Code

In a weighted model, training fits numerical parameters to examples. Human-written code defines the calculation and training process. Small models can be traced directly; interpreting a large model can be harder.

No account needed. Progress saves in this browser.

What a learner can do afterwards

  • Contrast a hand-written classification rule with numerical weights fitted from examples
  • Distinguish changing parameters during training from using fixed parameters during prediction
  • Explain how a small weighted model can be traced and why larger models can be harder to interpret

1 · Read

A person could write a spam rule about a particular phrase. A weighted model instead uses numerical parameters fitted from examples. People still write its calculation and learning code. Other trained models can use different structures.

Try it together

A toy spam model multiplies each of three inputs by its weight and adds the products and a bias (an extra number). Suppose the products are 2, 1 and 0, with bias 1: the total is 4. Code labels totals of 4 or more as spam. Training fits weights and bias. This toy is not a tested service.

Training uses errors on labeled examples to adjust this toy model's weights and bias. Its calculation stays fixed. Updates aim to reduce errors, but need not improve every example. During prediction without parameter updates, the numbers stay fixed. Further training can change them.

Trace inputs, weights and bias through the code to investigate predictions. Learned weights do not remove auditable code. Many interacting parameters can make interpretation harder. Different inputs can produce different outputs with fixed parameters. Retraining can change parameters and predictions for the same input while keeping the calculation fixed.

Examples and labelsFit parametersPredict on new inputs
Training fits the numbers. Prediction uses the fitted numbers without necessarily changing them.

Code defines the toy model's calculation. Training fits weights and bias. Prediction uses them, and its calculation can be traced.

Following a weighted prediction was written for this dataset.

2 · Watch

Take it off screen

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Where this leads

Jobs that lean on this skill. Follow one to see everything it is built on.

Then practise

8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.

Spotted a problem on this page? Tell us
Weighted Models: Learned Parameters and Written Code · Computing, ages 14 to 15 · LightMySky