SchoolWhool
Quizzes and saved progress, freeSign in freeSign in
Maths · Module 1

Functions, Logarithms and Notation

Take each lesson, answer its quiz, then do its practice. After the last lesson come the module quiz, the project and the interview questions.

Lessons

  1. 1.1Functions and Their GraphsRead a function as a rule from input to output, and recognise the shapes ML keeps using.
  2. 1.2Exponents and LogarithmsKnow why logs appear everywhere in ML: they turn products into sums, and huge ranges into small ones.
  3. 1.3Reading ML NotationRead the formulas in ML papers and docs without stalling.

Module material

Take these after the last lesson, in this order. Next on each page leads through them.

  1. Module quiz15 questions across the whole module. Take it after the last lesson; your first pick on each question is the one that counts.
  2. PracticeStated as a problem, with no template and no step-by-step instructions. Working out the steps is the point.
  3. NotebooksOpen them in Google Colab. Each answer is checked as you go: correct, wrong with the expected value, or not answered yet.
  4. Cheat sheetOne page of the module’s terms, rules and gotchas, with the output each rule produces.
  5. Interview questions15 questions interviewers ask on this module’s topics, from first principles to the follow-ups. Each comes with a model answer.

Glossary

Every term the module introduces, with the lesson that introduces it.

function
a rule that gives exactly one output for each input | f(x) = 2x + 1, f(2) = 5 1.1
input**, **output
the value a function takes in, and the one it gives back | 2 in, 5 out 1.1
graph
every (input, output) pair of a function, drawn as points | the line through (−2, −3) … (2, 5) 1.1
domain
the inputs a function accepts | every real number for 2x + 1; positive numbers for log₂ x 1.1
linear
a straight-line graph, ax + b | 2x + 1 1.1
quadratic
highest power two; its graph is a parabola | x² 1.1
exponential
the input is the exponent, bˣ; each equal step multiplies the output by the same factor | 2ˣ doubles at every step 1.1
sigmoid
1 / (1 + e⁻ˣ), an S-shaped curve between zero and one | 0.5 at x = 0 1.1
logarithm
log₂ x is the power two must be raised to to give x | log₂ 4 = 2 1.1
rate of change (slope)
change in output divided by change in input | 2 everywhere for 2x + 1 1.1
stretch
multiplying the output by a | 2x² 1.1
shift
adding k, or replacing x with x − h | (x − 3)² + 1 1.1
vertex
the lowest or highest point of a parabola | (3, 1) for 2(x − 3)² + 1 1.1
linear model
a prediction that is a straight-line function of its input | price = 21.425 − 1.228 · age 1.1
residual
actual value minus predicted value | the middle third's mean, −1.34 1.1
common mistake: f(x − h)
it moves the graph right by h; find the input that makes the bracket zero | (x − 3)² moves right 1.1
common mistake: the line through the middle
a line through the middle of the points can still be the wrong shape; read the residual pattern | + − + by age third 1.1
base**, **exponent
in bⁿ, b is the base and n counts how many times it is multiplied | 2³ = 2 × 2 × 2 1.2
power
bⁿ | 2⁵ = 32 1.2
root
b^(1/n), the number whose nth power is b | 2^½ = 1.4142 1.2
e
the base whose exponential has slope one at zero, 2.71828… | slope 1.0005 at step 0.001 1.2
exponential function
exp(x) = eˣ | np.exp(1) = 2.718281828459045 1.2
logarithm
the exponent that gives a number | log₁₀ 1000 = 3 1.2
natural log ln
the logarithm with base e | ln 0.5 = −0.6931 1.2
inverse function
a function that undoes another; its graph is the reflection across y = x | ln undoes exp 1.2
product rule
log(ab) = log a + log b | ln 0.1 = −2.3026 1.2
scientific notation
a number times a power of ten; Python writes it 3.6e-06 | 3.6 × 10⁻⁶ 1.2
log scale
an axis where equal distances are equal ratios | 1, 0.1, 0.01 evenly spaced 1.2
odds
p / (1 − p) | 4 for p = 0.8 1.2
log-odds (logit)
ln(p / (1 − p)); the sigmoid turns it back into a probability | 1.3863 for p = 0.8 1.2
common mistake: log(a + b)
the rule is for a product; log(a + b) is not log a + log b | ln 0.7 = −0.3567, not −2.3026 1.2
common mistake: np.log of zeros
gives -inf with a warning, not an error; use np.log1p | 108 cells of the email counts 1.2
index
a letter that counts through rows (i) or columns (j) | i = 1, 2, 3 1.3
subscript
a small index written below and to the right | x₂₁ = 0 1.3
superscript
a small mark above and to the right | x², or x⁽¹⁾ for row 1 1.3
summation Σ
add an expression over an index | Σᵢ₌₁³ i² = 14 1.3
product notation Π
multiply an expression over an index | Πᵢ₌₁³ i = 6 1.3
hat
a value a model produced, an estimate | ŷ = (5, −3, 10) 1.3
bar
a mean | x̄ = (2, 2), ȳ = 4.6667 1.3
star
the optimal value for an objective | w* = (2.7667, −0.3333) 1.3
vector
an ordered list of numbers, written bold | 𝐰 = (3, −1) 1.3
matrix
a table of numbers, written as a capital | X, shape (3, 2) 1.3
transpose
rows and columns swapped | Xᵀ, shape (2, 3) 1.3
∈
is a member of | 𝐰 ∈ ℝ² 1.3
ℝᵈ
lists of d real numbers | X ∈ ℝ³ˣ² 1.3
argmin**, **argmax
the input that gives the lowest, or highest, output | argmin (w − 3)² + 1 = 3 1.3
hyperparameter
a number chosen before training that controls how a model is fitted | λ = 0.1, scikit-learn's alpha 1.3
common mistake: x⁽ⁱ⁾
a bracketed superscript is row i, not a power | x⁽¹⁾ is row 1 1.3
common mistake: ŷ and y
not interchangeable; the gap between them is what the model makes small | errors (−1, 2, 1) 1.3
common mistake: argmin
argmin returns the input, min returns the value | 3 against 1 1.3