Ordered delivery inputs
The delivery shop now uses distance, expected travel time and parcel weight. If a system receives the three numbers but confuses their order, it can produce an exact calculation with the wrong meaning. How do models keep several values organized?
This is Module one, Lesson eleven: Vectors and matrices without assumed mathematics. By the end, you should be able to read a vector as ordered values, calculate one weighted sum and dot product, distinguish a shape error from a bad prediction, and explain why these representations affect compute cost.
We'll place one delivery's values in order, perform a two-value calculation, then expand the idea to many examples.
Define vector positions and units
A vector is an ordered collection of values. For a delivery, the three positions might mean distance in kilometers, expected travel time in minutes, and parcel weight in kilograms. A particular delivery could be represented by five, twenty and three in that order.
The first five means kilometers, the twenty means minutes and the three means kilograms because we defined the positions that way. If someone sends weight, distance and time instead without changing the model, the computation may still run. It will read each number in the wrong role. Likewise, switching kilometers to miles without updating the definition changes meaning even if the number of positions stays three.
The vector itself is not a complete description of the world. It includes the selected features in a specified order and units. That definition is part of the model's input contract.
Work a two-feature weighted sum
Use a small two-value example so we can do the arithmetic aloud. Suppose the input vector holds advertising spend in selected units and store footfall in selected units. Its values are two and three. A weight vector has values four and five, one for each matching input position.
Multiply corresponding values. Two times four is eight. Three times five is fifteen. Add the products: eight plus fifteen equals twenty-three. If the model also adds a bias, or offset, of one, the result is twenty-four.
The multiply-matching-values-and-add operation is a dot product under this vector representation. We used it to make a weighted sum. Similar operations also appear in measures of similarity and in learned transformations, but the number twenty-three has no universal meaning by itself. Its interpretation depends on what the inputs and weights represent and how they were scaled.
Keep positions consistent
Notice why order matters. If we exchanged the two input values without exchanging their roles or weights, we would calculate three times four plus two times five, which equals twenty-two. The arithmetic is valid but answers a different, unintended question.
Arrange examples in matrices
A matrix is a rectangular arrangement of values with rows and columns. In a simple dataset, each row can be one delivery and each column a feature. The column order and units remain defined. A matrix can hold many vectors of the same kind together.
Matrix multiplication organizes many matching weighted combinations. If we arrange multiple examples and multiple learned output directions compatibly, numerical hardware can carry out related operations efficiently. This is one reason model training can become a large parallel numerical workload.
Count tensor dimensions
The word tensor generalizes array structures to additional dimensions. Its shape records the size of each dimension. For a table-like matrix, shape can describe how many rows and columns it has. More dimensions can represent richer arrangements, such as examples, positions in a sequence and feature values. We do not need to visualize every dimension to understand that the shape constrains what operations are possible.
Check compatible shapes
Suppose our model expects three input values per delivery and a program supplies only two. The number of expected weights no longer matches the inputs. The intended operation cannot be performed as defined. That is a structural shape mismatch.
Separate shape errors from prediction quality
Compare that with a model that receives all three values in the right positions, performs a valid computation, and predicts twelve dollars when the actual cost is sixteen. That is an inaccurate but structurally valid prediction. The remedies differ: one calls for repairing representation or code, the other may call for better data, model or evaluation.
An operator does not need to debug matrix multiplication personally to ask a useful first question: did the system receive the right shape and meaning, or did it compute a valid answer that happened to be wrong?
Connect representation to computation
The number of parameters does not tell the entire compute story. A wider model may carry more values through each step. A longer input sequence may require more work. A larger batch groups more examples at once. Each can change the number of operations, the memory needed to hold values, and the amount of information moved between memory and processors.
Two models with similar parameter counts can therefore have different serving costs. A system may spend substantial time moving values rather than only multiplying them. Hardware efficiency depends on the shapes of the operations as well as their count. Module two will connect this representation to processors and memory in detail.
Evaluate a candidate new feature
For the shop, adding more features may help predictions if they carry useful information. It also changes the input representation and potentially the operating cost. The right question is whether the extra information improves a useful outcome enough to justify the complexity.
Check your understanding
What does the order of values in a vector tell the model?
Each position has a defined role. If position one means distance and position two means expected time, swapping them changes the intended input even if both values are valid numbers. Consistent order and units let the model interpret them as designed.
With inputs two and three and matching weights four and five, what is the weighted sum before adding a bias?
Two times four plus three times five is eight plus fifteen, or twenty-three. Adding a bias of one would make twenty-four.
Connect the representations
A vector is ordered values; a matrix arranges values in rows and columns; a tensor extends array shapes. A dot product multiplies matching positions and adds the results. These operations are useful only with defined meanings, compatible shapes and consistent units.
Continue to neural-network layers
Lesson twelve will connect weighted combinations like this to layers of a neural network. We will see why a nonlinear step matters and how change information travels backward during training.