liveBook · Manning

Weighted sum

As explained in Math and Architectures of Deep Learning

A linear combination of values multiplied by coefficients.

A weighted sum combines inputs by scaling each value with a coefficient and adding the results. For scalar inputs x₀,…,xₙ with weights w₀,…,wₙ, it has the form w₀x₀ + … + wₙxₙ; a model commonly adds a bias b. The weights determine how strongly each input affects the output, while the bias shifts that output independently of the inputs. section 1.1 section 2.9.1

In a simple prediction model, a weighted sum turns features into a score. Hardness and sharpness, for example, can be combined into a threat score y = w₀·hardness + w₁·sharpness + b. A threshold can then turn the score into a decision. The weights are initially unknown and are estimated during model training; using the fitted model on new inputs is inferencing. section 1.1

y(hardness, sharpness) = w0 × hardness + w1 × sharpness + b

This equation makes the role of each term explicit: every feature is multiplied by its own weight, then the bias is added. section 1.1

From score to a cat decision

With low hardness and sharpness, the example produces a negative threat score and “approach and purr.” Midrange values produce a score near zero and “ignore,” while high values produce a positive score and “run away.” The same formula therefore expresses a gradual numerical estimate before a discrete decision is made. section 1.1

For vectors, the same idea is called a linear combination: α₁v₁ + α₂v₂ + … + αₙvₙ. Linear combinations connect algebra to geometry. A vector-space basis spans a space because every vector in that space can be written as a linear combination of basis vectors. Conversely, a set is linearly dependent when nonzero weights can combine its vectors to produce the zero vector. section 2.9.1 section 2.9.3

Weighted sums recur in machine learning and probability:

  • A weighted sum alone defines a linear model and yields a linear decision boundary; applying a sigmoid to that sum creates a nonlinear building block for neural networks. section 1.6
  • A perceptron weights binary inputs, adds a bias, and applies an activation; suitable weights and bias can implement logical AND, OR, and NOT behavior. section 7.3.4
  • An expected value is a weighted sum of possible random-variable values, using occurrence probabilities as weights; variance similarly weights squared distances from the mean. section 5.10

A weighted sum is simple enough to interpret term by term, but its limits matter. When classes cannot be separated by a line, changing weights cannot make the linear form capture the needed curved separator. Nonlinear functions, such as a sigmoid applied after the sum, extend what the model can represent. section 1.6

How Math and Architectures of Deep Learning covers it

How deep it goes
Defines scalar and vector forms, then connects them to dependence, bases, nonlinear models, and perceptrons.
Examples
Uses hardness and sharpness threat scores, binary logic gates, and probability-weighted expected values.
What it assumes
Introduces weighted sums from concrete quantitative inputs while extending them to vectors and scalar multiplication.
What you can do after
Evaluate/understand how weights and bias turn features or vectors into scores, decisions, and linear combinations.
How it connects
Connects linear combinations with vector spaces, basis vectors, linear dependence, sigmoid functions, perceptrons, and expected value.

Also explained in

Compare how 4 books explain weighted sum →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math and Architectures of Deep Learning. The section links point to the parts of the book it draws on.