DATA 609 Meetup 11: Application to Statistics and Machine Learning
George I. Hagstrom
Week Summary
Spring Break Next week
HW Due in the week after spring break
Reading: 7.1, 7.2, 8.6
I’ll read your proposals and give some quick feedback
NY Open Statistical Computing Meetup
April 8th 6:30-8:30+
Great Networking/Learning Opportunity
Parametric Statistics
Parametric statistical models assume data generated by a probability distribution that depends on parameters
Linear regression: \[
y_i| \sim \mathrm{Normal}(\theta^T\mathbf{x}_i + y_0,\sigma)
\]
Here the parameters are \(\theta\), \(y_0\), and \(\sigma\)
Maximum Likelihood
Likelihood is probability of observations given model coefficients \[
p(\mathbf{y}|\theta,\mathbf{x}) = \prod_{i=1}^n p(y_i|\theta,\mathbf{x}_i)
\]
Usually work with \(l(\mathbf{y},\mathbf{\theta}) = \log(p(\mathbf{y}|\theta,\mathbf{x}))\): \[
l(\mathbf{y},\theta) = \sum_{i=1}^n \log(p(y_i|\theta,\mathbf{x}_i))
\]
Maximum Likelihood
If \(p\) is a log-concave in \(\theta\) for fixed \(\mathbf{y}\), \(\mathbf{x}\), maximum likelihood is a convex optimization problem:
Sum of absolute value of residuals (\(L_1\)) corresponds to Laplace noise:
\(p(y) = \frac{e^{-|y|/a}}{2a}\)
Convexity of MLE
For Gaussian: \[
-l(\theta) = \left(\frac{n}{2}\right)\log(2\pi\sigma^2) + \frac{\| \theta^T X -\mathbf{y}\|^2}{2\sigma^2}
\]
Not convex except if \(\sigma\) fixed
If \(\theta\) is fixed is convex in \(1/\sigma^2\)
Can generalize to covariance estimation
Covariance Estimation
Hard example in 7.1
Have many \(\mathbf{x}_i\) of variables, want to estimate covariance under a normal model \[
-l(\Sigma) = \frac{N}{2}\log(\mathrm{det}\Sigma) + \frac{1}{2}\sum_{i=1}^N \mathbf{x}_i^T\Sigma^{-1}\mathbf{x}_i
\]
Only convex in variable \(S = \Sigma^{-1}\)
Prior Knowledge
Can incorporate constraints on parameters as a type of prior knowledge
For example, if the parameters had been previously estimated to within a given accuracy
For example, trying to learn if a coin is fair or not, \(p_1\) is probability of heads
\(p_1 \sim \mathrm{Beta}(5,5)\)
You think coin might not be fair
MAP Estimation
Can take prior idea even further and start with a Bayesian model
Observations \(y\) and model parameters \(\theta\)
\(p(\theta|y)\) is probability of parameters \(\theta\) given observations \(y\)
Converts from measurements to prediction while adding least additional information \[
p(x) = \exp\left(\sum_{i} \lambda_i f_i(x)\right) \\
\mathrm{min}_{\lambda} -\sum_i a_i \lambda_i + \int dx p(x|\lambda)
\]
KL Divergence
Suppose you have two probability distributions \(p\) and \(q\)
The “surprise” we experience when we use \(q\) as a model for a process driven by \(p\) is given by the KL-Divergence: \[
DL(p||q) = \sum_i p_i \log(p_i/q_i)
\]
Common tool used for model comparison
Imagine \(p_i\) is true distribution
Convex loss function used in machine learning
Classification
Have two sets of points \(A = \{\mathbf{x}_{a1}, \mathbf{x}_{a2}, \mathbf{x}_{a3}, \dots\}\) and \(B = \{\mathbf{x}_{b1}, \mathbf{x}_{b2}, \mathbf{x}_{b3}, \dots\}\)
Want to find a function \(f:\mathbb{R}^n\to\mathbb{R}\) that satisfies: \[
f(\mathbf{x}) < 0\,\, \mathrm{if}\,\, \mathbf{x} \in A \\
f(\mathbf{x}) > 0\,\, \mathrm{if}\,\, \mathbf{x} \in B
\]
Classification
Such an \(f\)classifies or discriminates the points of \(A\) and \(B\)
Classification
To solve classification problem you need a hypothesis set \(\mathcal{H}\) of functions \(f\)
If \(\mathcal{H}\) too complex for dataset you cannot generalize
Imagine a family of functions which you can just specify to have any values
Leads us to consider simple families \(f\) initially
Linear Discrimination
Linear discrimination:
\(f(\mathbf{x}) = \theta^T\mathbf{x} + c_0\)
Linear Discrimination Fails
Sets not always linearly separable
Linear Discrimination Fails
Sets not always linearly separable
Linear Discrimination Fails
Sets not always linearly separable
Linear Discrimination Fails
Need Convex Hull of sets to be disjoint
Linear Discrimination Fails
Need Convex Hull of sets to be disjoint
Support Vector Machines
What to do if can’t separate?
Look for approximate separation
Minimize misclassified points directly is too hard
Instead look to see how bad misclassifications are: \[
\theta^T\mathbf{x}_{ai} + c_0 \geq 1 - u_i \\
\theta^T\mathbf{x}_{bj} + c_0 \leq -(1-v_j)
\]
If the \(u_i\) or \(v_j\) are 0, classification successful