Home / Maths for AI / Symbols / Functions

Function

Say it: "f maps X to Y"

What it means

A rule that turns each input in XX into one output in YY. f(x)f(x) is the output for input xx.

Example

f:R→R,f(x)=2x+1,f(3)=7f: \mathbb{R} \to \mathbb{R}, \quad f(x) = 2x + 1, \quad f(3) = 7

Real number in, real number out.

In code

def f(x):
    return 2 * x + 1
print(f(3))

Output

7

Where it appears in machine learning

A model is a function fθ:Rd→Rf_\theta: \mathbb{R}^d \to \mathbb{R} from features to a prediction, with parameters θ\theta.

Related symbols

Learn it properly in the free lesson Functions & Graphs, with practice questions that check your answers.