Functions and logarithms interview questions
15 questions interviewers ask on functions, logarithms and notation, from first principles to the follow-ups. The first 3 model answers are free to read; Pro opens the rest.
- What makes a rule a function?
Every input gives exactly one output.
f(x) = 2x + 1is a function:2always gives5. A rule that could give two outputs for one input is not. In machine learning the loss is a function of the weights: one set of weights, one loss. - How can you tell a linear, a quadratic and an exponential relationship apart from a table?
From the rate of change between equally spaced rows. A linear table's steps are constant (
2, 2, 2, 2); a quadratic's steps change by the same amount (−3, −1, 1, 3); an exponential's steps change by the same factor (0.25, 0.5, 1, 2, each double the last). - What does
f(x − 3)do to a graph, and how do you remember the direction?It moves the graph right by 3. Find the input that makes the bracket zero:
x = 3, so the point that was at zero is now at three.f(x) + 3moves it up and3 f(x)stretches it. - Your straight line passes through the middle of the data. How do you check that it is the right shape?
- Why is
ethe base used in machine learning? - State the product rule for logarithms and the most common mistake with it.
- Why do we work with log-probabilities instead of probabilities?
- What are odds and log-odds, and why does logistic regression use the log-odds?
- An email scores
5.872in spam-minus-ham log-probability. What is the probability it is spam? - You log-transform a column and get
-inf. What happened and what do you do? - What do
ŷ,x̄andw*mean? - Write
ŷᵢ = Σⱼ wⱼ xᵢⱼin NumPy, and explain the index shift. - What is the difference between
minandargmin? - scikit-learn's
Ridgeand a paper both use a regularisation strength. Can you copy the paper's value? - Ridge's penalty is
λ Σⱼ wⱼ². On the shop data, promotion's weight is 99.48% of that sum. Is that a problem?