Alyana Leck learning portal

Data diversity demo.

Select training samples from the full sine function, train a tiny model, and watch what it can or cannot generalize from the data it received.

1D Input feature x, target y = sin(x)
RBF Small fixed-basis model trained in the browser
8 Coverage regions used for the diversity check

Click points, then train.

Use the left graph to choose training data. The right graph starts empty, then shows only selected dots and the model curve after training begins.

Full function

Click any dot. Green dots are the only data the model will see.

0 selected

Training view

Selected dots appear here. The learned curve is drawn only after training starts.

Waiting
The model has not received data yet. Select dots from the full function.
Selected 0 dots
Coverage 0 of 8
Epoch 0
Training loss Not trained

Why diversity matters.

A model learns from the examples it is given, not from the examples we wish it had seen. If all selected dots come from one small region, the model can fit that region and still fail at peaks, valleys, and crossings.

  • Choose points from the left, middle, and right side of the input range.
  • Include positive values, negative values, turning points, and zero crossings.
  • Compare the clustered sample with the diverse sample, then ask where each model is guessing.
Method

What model is being trained?

The demo uses a small radial-basis-function model. It transforms x into a few smooth bump features, then trains a linear output layer with gradient descent. This is light enough to run instantly in the browser.

Data rule

What data does the model see?

Only the selected dots are used in the loss function. The full sine curve on the left is visible to students, but it is not used during training.

Teaching prompt

What should students notice?

Low training loss is not the same as broad understanding. A diverse training set gives the model evidence across the full problem, so its predictions have fewer unsupported gaps.

Activation functions are shape tools.

This tab shows the training story one small piece at a time: input, activation, weights, addition, residuals, and parameter updates.

Neuron recipe activation = tool(w * x + b)
Prediction recipe prediction = weighted tools added together
Training recipe error gives each weight a small nudge

What the activation is doing.

Without nonlinear activation functions, stacked layers collapse into one linear transformation. Nonlinear tools let the model bend, gate, and localize parts of the curve.

  • RBF bumps help this demo because the sine wave needs local hills and valleys.
  • Weights decide whether a tool contributes upward, downward, strongly, or weakly.
  • Bias or center terms move the tool left and right along the x-axis.
Step-by-step board

How to explain this in class

First show one selected point and a bad prediction. Then reveal the activation tools. Next stretch and flip each tool with weights. Finally add the pieces and show residuals.

Connection to training

Where gradient descent enters

The residuals tell the model which pieces are pushing too high or too low. Gradient descent changes the weights a little bit, checks the loss, and repeats.

Design note

Original visual treatment

The layout uses a clear step-by-step teaching rhythm inspired by visual ML explainers, but the drawings are original and generated directly by this page.

Reference used for the teaching structure: StatQuest backpropagation main ideas and StatQuest ReLU in action.