LearnBuild toward a chatbotOne number of the model

One number of the model

Aim. At the end of this lesson one program does the whole sum, from four inputs to the number 93. Then it does three such sums at once.

Where the lessons are going

The four obstacles (lessons 4 to 8) are behind you, and every part exists: multiply and add (step 4 of lesson 3), divide, round and clamp (step 5 of lesson 5). So far they ran one at a time. Now they run as one program.

The whole sum in one go

Try it: press Play, or go to the last step. Four inputs, 90, −25, 40 and 12, go in. Does the result cell end at 93?

Inputs on the tape: 90, −25, 40 and 12. Weights, in the program: 100, −60, 30 and 14.

Figure 1. The whole sum as one program. Watch the total appear when the step counter reads 8, and the result at the end. (interactive)

What whole numbers cost

Try it: move the sliders until the result is exactly 0, while no input is 0, no weight is 0, and the sum is not 0 either:

InputWeightInput × weight
The sum
Divided by 128 and rounded
Result of the brainfuck program

Figure 2. A neuron with your own inputs and weights, run by a brainfuck program each time you move a slider. (interactive)

Three numbers at once

Try it: press Step once and look at input 1 and the three totals. Then go to the last step:

The same four inputs, and three rows of weights: one row each for the word pieces " Paris", " London" and " cheese".

Figure 3. Three sums at once. Watch the first step: one input goes into three totals together. (interactive)

What you can do now

Work out a number of the model from start to finish, and many of them in one pass. The first two parts of the sum run as one program: 11,868, then 93.

So far the inputs came from nowhere. In a model they come from the word pieces of your question, and to use them the model has to look back at the earlier ones. How?

How the real program differs

Rounding. Adding half of the divisor first (64 for 128) turns "round down" into "round to the nearest".

Numbers below zero need nothing special in the sum. On a cell that goes round, adding "the top minus 3" is the same as taking 3 off.

Where the weights are. In this lesson the weights stand in the program, as in lesson 3. In the chat program they are numbers on the tape (step 3 of lesson 8), and it makes the same sums by walking along rows of weights.