Functions
Read f(x) notation, define a domain, and see how the parameters w and b turn the rule wx + b into a tiny model, with a Python version.
Give a rule the number 2. It doubles the number, adds 1, and returns 5. Give it 3 and it returns 7.
That rule is a function : for each allowed input, it gives one output. The letter f is just a name for our rule.
Read f(x) as “the output of f when its input is x.” It does not mean f multiplied by x. The expression 2x does mean 2 multiplied by x.
Before moving the input below, predict the output for x = −1.
The answer is −1: double −1 to get −2, then add 1. Negative inputs follow exactly the same rule.
Inputs can share an output
Try a different rule: g(x) = x². Both 2 and −2 produce 4. This is still a function. Each input has one answer; different inputs are allowed to have the same answer.
Predict: Could “take x and return either x + 1 or x − 1, without specifying which” define an ordinary function of x alone?
We also need to say which inputs are allowed. The rule 1/x works for real numbers except zero. That allowed collection is the domain .
A small model is also a function
Our first rule can be written as f(x) = wx + b. Here w and b are numbers we choose, called parameters . With w = 2 and b = 1, it is exactly the rule above. Learning will mean adjusting parameters using examples. For now, keep them fixed.
If you know a little Python, this is the same calculation: