Synaplume

Foundations Refresher

Functions & Graphs

40 min

Functions are machines

A function is a machine: numbers go in, numbers come out, and the same input always produces the same output. We write

f(x)=x2f(x) = x^2

meaning "the machine named ff squares whatever you feed it": f(3)=9f(3) = 9, f(2)=4f(-2) = 4.

This is the mental model for AI. A neural network is nothing more than a very large function: an image goes in (as numbers), a label like "cat" comes out (as numbers). Training a model means shaping the machine until it produces the outputs we want.

Graphs: seeing a function

Plotting y=f(x)y = f(x) turns a formula into a picture. A few shapes you must recognize on sight:

FunctionShapeWhere you'll meet it
y=wx+by = wx + bstraight linelinear regression
y=x2y = x^2U-shaped parabolaloss functions
y=exy = e^xexplosive growthexponentials, softmax
y=logxy = \log xfast rise, then flattenslog-loss, information
y=11+exy = \frac{1}{1+e^{-x}}S-curve from 0 to 1sigmoid activation

The slope of a line, ww in y=wx+by = wx + b, measures steepness: how much yy changes when xx increases by 1. The intercept bb is where the line crosses the vertical axis. Machine learning is obsessed with slopes — calculus (coming soon) is the science of slopes for curved functions.

Composing functions: machines feeding machines

You can chain machines: feed the output of gg into ff. This is written

f(g(x))f(g(x))

Example: g(x)=2xg(x) = 2x and f(x)=x+3f(x) = x + 3 give f(g(4))=f(8)=11f(g(4)) = f(8) = 11.

Why care? A deep neural network is exactly this: dozens of simple functions composed together. "Deep" literally refers to the length of the chain. When you later meet the chain rule in calculus, it will tell us how to train such chains — and it is the mathematical heart of deep learning.

Functions with many inputs

Real models take many inputs at once. A house-price model might use size, age and location:

price=f(size,age,location)\text{price} = f(\text{size}, \text{age}, \text{location})

We write multi-input functions as f(x1,x2,,xn)f(x_1, x_2, \dots, x_n). Soon we'll bundle those inputs into a single object called a vector — that's where linear algebra begins.

Key takeaways

  • A function is a deterministic machine from inputs to outputs; a neural network is a huge composed function.
  • Know the shapes: line, parabola, exponential, logarithm, S-curve.
  • Composition (f(g(x))f(g(x))) is the structural idea behind "deep" learning.

Check your understanding

0/3 answered
  1. 1.A neural network is best thought of as…

  2. 2.If g(x)=2xg(x) = 2x and f(x)=x+3f(x) = x + 3, what is f(g(4))f(g(4))?

  3. 3.Which function shape does the sigmoid have?

Share:

0% of Mathematics for AI completed

Up nextVectors: Data as Arrows