1/198
Looks like no tags are added yet.
what is the difference between classification and regression?
both are supervised learning problems, but they predict different types of outputs
classification: predict a discrete category
regression: predict a continuous numerical value
what do we use when the target we want to predict is numerical?
linear regression

what is linear regression actually trying to learn? and how?
unknown relationship between input variables and a numerical output
y = f (x) + ε
but we do not know f(x) so we construct a function ŷ(x) which approximates it using training data

why do we include the noise term ε when describing the relationship between input and outputs?
real-world observations rarely follow a perfectly predictable relationship
noise term represents variation our model does not explain
does linear regression require the relationship between x and y to be a straight line?
no: linear regression means linear in the weights, not necessarily linear in the input
give an example of what ‘linear in the weights’ means?
this produces a curved relationship because of x²
the weights (w0, w1,w2) however only appear as coefficients so the model is still linear in the weights

what do the weights w0 and w1 represent in simple linear regression?
w0 is the intercept. the predicted value when x = 0
w1 is the slope. how much the prediction changes when x increases by one unit.

what is the residual in linear regression?
the difference between an observed target and the model’s prediction
ri = yi - ŷi
yi : actual observed value
ŷi : predicted value
what does ordinary least squares do (words)?
find the minimum-MSE fit by minimising the quadratic cost
why does ordinary least squares, square the residuals rather than simply adding them?
positive and negative errors cannot cancel each other out
large errors are penalised more strongly than small errors
the resulting cost is a quadratic function of the weights, making optimisation mathematically convenient
what does ordinary least squares do (equation)?

why do we differentiate the least -squares cost function?
want to find the weights that minimise prediction error
what does differentiating with respect to each weight tell us about a cost function?
how much changing that weight affects the cost
what are the normal equations in linear regression?
a system of equations used to find model parameters that minimise the sum of squared errors
how are the normal equations derived in linear regression?
taking partial derivatives of the sum of squared errors, with respect to each model parameter
set these to 0
rearrange to form a system of equations

what does solving the normal equations in linear regression give?
the best fitting weights
why do we write using matrix notation for the normal equation?
more complicated regression models contain many weights
writing and solving separate equation for every weight becomes cumbersome
matrix notation allows us to represent all the equations together
the normal equation
describes the same, simple least-squares problem but works for any number of fixed features

what is the basis function Φi(x) in linear regression?
mathematical function that transforms an input into a feature used by the model
how does a model how much importance to assign to each feature?
weights
why do we need basis function instead of always using the original input space x?
allows the model to fit curved relationships while keeping the weights linear
what is the differnece between Φj(x) and Φ(x)?
Φj(x): one transformed feature
Φ(x): all transformed features grouped into a vector
when is the basis function chosen during training?
we are working with fixed-basis framework
and so the basis function is chosen in advance
why can polynomial regression be nonlinear in x but still count as linear regression?

what is the design matrix Φ in linear regression?
a matrix containing the transformed features for every training observation
what does each row of the design matrix Φ represent?
one training example
what does each column of the design matrix Φ represent?
one basis function
the design matrix Φ.

what are the dimensions of the design matrix Φ ?
M features (exc. bias term)
N training examples

what does the design matrix Φ allow?
all the training predictions to be calculated together


why can all regression predictions be written as: ?
each row of Φ (design matrix) contains features for one observation
multiply that row by w, calculates the weighted sum
matrix multiplication does this simultaneously for every row

how does the design matrix allow us to express the least squares cost using one equation?

how does differentiating the matrix least-squares cost produce the normal equation?


what significance is given by the fact that if you differentiate the least-squares cost then you are lead to the normal equation?
means that solving the normal equation is equivalent to finding weights that minimise the squared error

what does the normal equation do for the least-squares solutions?
characterises them


what does the ordinary least-squares solution represent?
gives the weight vector that minimises the squared residuals
directly, rather than repeatedly updating the weights
what does the least-squares being convex show?
any minimum found is a global minimum
setting the gradient to 0 obtains a global minimiser of the least-squares cost

what does the least-squares being convex not show?
does not guarantee that the minimiser is unique
when does the design matrix Φ to have full column rank?
when every column of Φ is linearly independent of the others
no feature column can be constructed a linear combinations of the remaining columns
what does Φ having full rank ensure?


what is this?
pseudoinverse
generalises the idea of a matrix inverse
using this in the least-squares solution means that the equation works even when Φ is rank deficient


how is a minimiser chosen in rank deficient cases?
can have multiple solutions
if so, choose the one with the smallest weight norm: ||w||2
underfitting vs overfitting.
underfitting: model too simple to capture underlying relationship
overfitting: model is excessively flexible and fits noise/ accidental patterns in training observations
what is a hypothesis set (ℋ) in machine learning?
collection of candidate prediction functions that a learning algorithm is allowed to choose from
hypothesis set for fixed-basis functions

what is mean squared error?
averaged squared prediction error.

how does mean squared error related to ordinary least squares?

why doesn't low training error guarantee that a model has learnt the true underlying function?
training error is measured against observed targets, which contain noise, rather than the unknown true function.
a model can achieve low training error by fitting the noise instead of learning the true relationship (overfitting).
what is gradient descent?
an iterative optimisation algorithm that adjusts model parameters to reduce a cost function
gradient descent update rule.

what does gradient descent do differently to OLS?
rather than solving directly, gradient descent approaches a minimum through repeated updates to find the optimal weights
why does gradient descent move in the negative gradient direction?
gradient points in the direction of steepest local increase of a differentiate function
negative gradient points in the direction of steepest local decrease
subtraction moves the weights downhill on the cost surface
what does the learning rate η control in gradient descent?
how far the weights move during each update
small: potentially slow convergence
excessively large: may overshoot and cause oscillation or divergence
how id gradient descent update rule applied specifically to linear regression?
by substituting the least-squares cost gradient into the gradient descent update rule
this repeatedly adjusts the weights according to the current prediction errors

OLS using the normal equation vs OLS using gradient descent.
both minimise the same least-squares objective
normal equation: directly using linear algebra
gradient descent: start with initial weights and repeatedly update them using gradient descent
with a suitable learning rate and sufficient convergence, gradient descent approaches a least-squares minimiser
why can OLS and gradient descent produce the same fitted line?
both optimise the same cost function R(w)
so both methods may approach the same weights

examples of basis functions.

why do we need a probabilistic interpretation of what a regression function is?
ordinary regression finds a function that fits observed data
real observations come with noise and different functions may represent the same small data set
a probabilistic model allows us to describe how likely different observations are under a proposed regression function
give us a principled way to choose model parameters and understand what the fitted function represents
parameter uncertainty vs observation noise.
parameter uncertainty: we do not know the exact parameters describing the underlying relationships
observation noise: individual outputs vary randomly around the underlying mean relationship
why does collecting more data reduce parameter uncertainty?
each data point provides additional information about the underlying relationship
this constraints which parameter values are plausible, so estimates of the regression function become more precise
why does collecting more data not observation noise?
random variation affecting individual observations still exists

what does this mean?
conditional probably distribution
the distribution of possible outputs y, given a particular input x
instead of one guaranteed value of y, it describes how the possible scores are distributed
how are p(x), p(x|y) and p(x, y) related?


why is this important for regression?
regression aims to predict outputs from known inputs
so we are interested in what values y may take, for a given x
frequentist approach to unknown parameters?
the true parameter θ is fixed, but unknown
and estimated from data
different data sets can produce different parameter estimates
bayesian approach to unknown parameter?
a probability distribution represents uncertainty about θ
when new data arrives, the distribution is updated

what does this mean?
the probability of the data under a specified parameter value
D: the observed data set
θ: the unknown parameter of the model

what is bayes’ rule?
updates our beliefs about unknown parameters using new evidence

what does this mean when we are trying to learn θ?
p(θ|D): Posterior - updated uncertainty about parameters after observing data
p(D|θ): Likelihood- how well a parameter value explains the observed data
p(θ): Prior- uncertainty about parameters before observing the data
p(D): Evidence- normalises the posterior (D is the data we have observed)

what is the fundamental ideal behind bayes’ rule?

what is the evidence for bayes’ rule in discrete parameters?

what is the evidence for bayes’ rule in continuous parameters?

bayes’ rule broken down: what did we believe before seeing the data?

bayes’ rule broken down: how well does each possible parameter value explain the observed data?

bayes’ rule broken down: what should we believe now, after considering the data?

why do we multiply the prior by the likelihood in Bayesian inference?
prior: describes which parameter values were plausible before observing the data
likelihood: describes how compatible each parameter value is with the data we actually observed
multiplying them gives greater to parameter values *that are supported by both*
p(D) necessary in bayes’ rule?
multiplying the prior and likelihood does not generally produce a distribution that sums/ integrates to 1
dividing by this quantity ensures the posterior is properly normalised
(see calculation of P(D) and what the numerator of bayes’ rule is)
why can we ignore p(D) when finding a parameter value that maximises the posterior?
p(D) is constant and doesn’t depend on θ
dividing every score by the same constant doesn’t change which gives the highest value
therefore this is true:

what is a likelihood function?
measures how well different parameter values explain the observed data
what do we keep fixed in a likelihood function?
keep data, D, fixed
change θ, to find which parameter value best explains it
what is the difference between a sampling model and a likelihood function?
both use the expression P(D | θ)
sampling: fixes the parameters θ and considers what data could be generated
likelihood: fixes the observed data and considers which parameter best explains it
what is maximum likelihood estimation (MLE)?
chooses the parameter value under which the observed data has the highest likelihood
θ: candidate parameter values
D: observed data set
arg max: find teh input that produces the largest value

does MLE produce a probability distribution over the unknown parameters?
no
mle produces a point estimate: one parameter value (or set of maximisers if the optimum is not unique)
what does MLE not describe?
the full uncertainty surrounding the parameters
what is a gaussian distribution?
a continuous probability distribution with a bell shaped density curve

how is the gaussian distribution curve written?


why does the gaussian density contain (x-μ)²?

what is a multivariate gaussian distribution?
describes the joint behaviour of several variables.

what does the covariance matrix Σ represent?
diagonal entries: the variance of each variable
off diagonal: how two variables vary together

multivariate gaussian density.

in the covariance matrix Σ, what does positive covariance mean?
they tend to increase or decrease together
in the covariance matrix Σ, what does negative covariance mean?
they tend to move in opposite directions
why do we need a covariance matrix Σ?
A single variance measures how much one variable varies.
A covariance matrix captures:
Variance: How much each variable varies individually.
Covariance: How different variables change together (like, height and weight).
This allows us to model relationships between multiple variables
why does independence allow us to multiply individual probability densities to calculate the likelihood?
independence means that knowing one observation does not change the distribution of another
so we can multiply and their joint density factorises
to produce a likelihood for the entire set

what are we trying to estimate when applying MLE to Gaussian data?
find the mean μ vector and covariance matrix Σ that maximise the likelihood of the observed data
MLE finds the value that best explains the observations under the assumed gaussian model
what does mean μ represent in a gaussian distribution?
where the data is centred
what does covariance matrix Σ represent in a gaussian distribution?
its spread and the relationship between variables
why do we take the logarithm of the likelihood when performing MLE?
the likelihood of independent observations is a product
products can be difficult to differentiate and can become extremely small
taking log makes it a sum which is
easier to differentiate
more numerically stable

why are we allowed to take logs of the likelihood when performing mle?
logarithm is a strictly increasing function
maximising the log-likelihood gives exactly the same parameter values as maximising the original likelihood

sample mean of the gaussian mle.
why does maximising a Gaussian likelihood give the sample mean as the estimated mean?
the likelihood is maximised when the estimated mean equals the average of the observations
