DevOps Hub/ML Foundations Lab
All systems operational
← Functions & Graphs

What Is a Function?

A function is a rule that takes an input and produces exactly one output. We write , read “y equals f of x”: feed the function a number , and it hands back a single number .

The set of every input a function is allowed to accept is its domain. The set of every output it can produce is its range. A function can be defined by only part of the number line — refuses negative inputs, and refuses zero, because neither has a well-defined real output there.

The one non-negotiable rule: each input maps to exactly one output. A relation that sends a single input to two different outputs (like “the square roots of x”, which gives both and for ) is not a function — that’s why we define to mean only the non-negative root.

Where you'll use this

Every model you’ll build in this course — a line, a loss curve, a neural network — is a function: it takes an input (a feature vector, a set of weights) and produces exactly one output (a prediction, a loss value). Domain and range questions show up constantly, e.g. probabilities must live in , which is exactly a range restriction.

Function Machine

Pick a function, drag the input, and watch the output — including where it becomes undefined.

-6-4-202460102030
input x2.0

Domain: all real numbers

f(2.0) = 4.000

This section’s quiz isn’t seeded yet — run `npm run db:seed`.