ผลต่างระหว่างรุ่นของ "Machine Learning at U of C"
Jittat (คุย | มีส่วนร่วม) (revert to parinya) |
|||
(ไม่แสดง 19 รุ่นระหว่างกลางโดยผู้ใช้ 14 คน) | |||
แถว 32: | แถว 32: | ||
The proof is easy. | The proof is easy. | ||
− | :<math>\int (y-h(x))^2 dP = \int ((y-f_p(x)) | + | :<math>\int (y-h(x))^2 dP = \int ((y-f_p(x)) + (f_p(x)- h(x)))^2)dP </math> |
We get | We get | ||
− | :<math> \int (y-h(x))^2 dP = \int (y-f_p(x))^2 dP | + | :<math> \int (y-h(x))^2 dP = \int (y-f_p(x))^2 dP + \int (f_p(x)- h(x))^2 dP + 2 \int (y-f_p(x)) (f_p(x)-h(x)) dP </math> |
แถว 80: | แถว 80: | ||
If the relation is linear, | If the relation is linear, | ||
− | :<math>y= X \mathbf{\beta} | + | :<math>y= X \mathbf{\beta} + \mathbf{\epsilon}</math> |
OLS provably gives the minimum squared error. | OLS provably gives the minimum squared error. | ||
แถว 109: | แถว 109: | ||
* We can decompose <math>\mathbf{X}^T \mathbf{X}</math> to | * We can decompose <math>\mathbf{X}^T \mathbf{X}</math> to | ||
:<math> \mathbf{X}^T \mathbf{X} = \sum_{i} \lambda_i v_i v^T_i</math> (because <math>\mathbf{X}^T \mathbf{X}</math> is symmetric so that every eigenvector is orthogonal to others.) | :<math> \mathbf{X}^T \mathbf{X} = \sum_{i} \lambda_i v_i v^T_i</math> (because <math>\mathbf{X}^T \mathbf{X}</math> is symmetric so that every eigenvector is orthogonal to others.) | ||
− | Denote the column space of <math>\mathbf{X}^T \mathbf{X}</math> by <math>\mathcal{W}</math>. Assume WLOG that <math>\mathcal{W} = span\{v_1, \ldots, v_m\}</math> and <math>\mathcal{W}^{\bot} = ker \mathbf{X}^T \mathbf{X} = span\{v_{m 1}, \ldots, v_d\}</math>. | + | Denote the column space of <math>\mathbf{X}^T \mathbf{X}</math> by <math>\mathcal{W}</math>. Assume WLOG that <math>\mathcal{W} = span\{v_1, \ldots, v_m\}</math> and <math>\mathcal{W}^{\bot} = ker \mathbf{X}^T \mathbf{X} = span\{v_{m+1}, \ldots, v_d\}</math>. |
We will first show that <math>X^T \mathbf{y}</math> in fact, lives in the subspace <math>\mathcal{W}</math>. Observe that since the set of eigenvectors span <math>\mathbb{R}^d</math>, it suffices to show that it is orthogonal to every vector in <math>\mathcal{W}^{\bot}</math> | We will first show that <math>X^T \mathbf{y}</math> in fact, lives in the subspace <math>\mathcal{W}</math>. Observe that since the set of eigenvectors span <math>\mathbb{R}^d</math>, it suffices to show that it is orthogonal to every vector in <math>\mathcal{W}^{\bot}</math> | ||
แถว 125: | แถว 125: | ||
:<math> \beta = (\sum_{i=1}^{m} \frac{1}{\lambda_i} v_i v^T_i) \mathbf{X}^T y </math> | :<math> \beta = (\sum_{i=1}^{m} \frac{1}{\lambda_i} v_i v^T_i) \mathbf{X}^T y </math> | ||
− | And it's straightforward to see that the solution for <math>\mathbf{\beta}</math> is not unique since any <math>\mathbf{\beta} | + | And it's straightforward to see that the solution for <math>\mathbf{\beta}</math> is not unique since any <math>\mathbf{\beta} + e</math> for <math>e \in ker (\mathbf{X}^T \mathbf{X})</math> would also satisfy the equation. |
Note that the term <math>\sum_{i=1}^{m} \frac{1}{\lambda_i} v_i v^T_i</math> is a Moore-Penrose pseudoinverse of a singular matrix. | Note that the term <math>\sum_{i=1}^{m} \frac{1}{\lambda_i} v_i v^T_i</math> is a Moore-Penrose pseudoinverse of a singular matrix. | ||
แถว 137: | แถว 137: | ||
we look at | we look at | ||
− | :<math>\beta^* = argmin_{\beta \in \mathbb{R}^d} ||y-\mathbf{X}^T \beta||^2 | + | :<math>\beta^* = argmin_{\beta \in \mathbb{R}^d} ||y-\mathbf{X}^T \beta||^2 + \alpha ||\beta||^2</math> |
If <math>\mathbf{\alpha}</math> tends to zero, it problem becomes just like OLS. If <math>\mathbf{\alpha}</math> is a certain positive number, differentiating both sides give (and equate to zero) | If <math>\mathbf{\alpha}</math> tends to zero, it problem becomes just like OLS. If <math>\mathbf{\alpha}</math> is a certain positive number, differentiating both sides give (and equate to zero) | ||
− | :<math> (\mathbf{X}^T \mathbf{X} | + | :<math> (\mathbf{X}^T \mathbf{X} + \alpha I) \beta = \mathbf{X}^T y </math> |
− | <math>\{\mathbf{\lambda}_i | + | <math>\{\mathbf{\lambda}_i + \alpha\}</math> are eigenvalues of <math>\mathbf{X}^T \mathbf{X} + \alpha I</math>, where <math>\{\mathbf{\lambda}_i \}</math> are eigenvalues of <math>\mathbf{X}^T \mathbf{X}</math>. |
Observe that all eigenvalues are positive, so nullspace is zero. And thus, matrix on the left-hand side is invertible. The solution is '''unique'''. | Observe that all eigenvalues are positive, so nullspace is zero. And thus, matrix on the left-hand side is invertible. The solution is '''unique'''. | ||
== Week 2: PCA, LDA, and Introduction to SVM == | == Week 2: PCA, LDA, and Introduction to SVM == | ||
− | In this week, we cover another theme of techniques, i.e. Principle Component Analysis (PCA) and Fisher Linear discriminant analysis. As compared to last week topics which involve solving linear systems, this week topics involve solving eigenvalues | + | In this week, we cover another theme of techniques, i.e. Principle Component Analysis (PCA) and Fisher Linear discriminant analysis. As compared to last week topics which involve solving linear systems, this week topics involve solving eigenvalues & eigenvectors of matrix. |
+ | |||
+ | Since the theory of positive semidefinite will be crucial throughout the course, we give a quick introduction. | ||
+ | |||
+ | === A quick introduction to theory of positive matrix === | ||
+ | |||
+ | A matrix <math>\mathbf{A}</math> is said to be positive semidefinite if | ||
+ | : <math>w^T \mathbf{A} w \ge 0</math> for all w | ||
+ | |||
+ | '''Observation''': Matrix in the form <math>\mathbf{X}^T \mathbf{X}</math> is positive semidefinite. | ||
+ | |||
+ | ''Proof.'' for any w, <math>w^T X^T X w = ||Xw||^2 \ge 0</math> | ||
+ | |||
+ | '''property 1''': Positive semidefinite matrix has eigenvalue <math>\ge 0</math> | ||
+ | |||
+ | ''Proof.'' <math>\mathbf{A} \mathbf{v} = \lambda \mathbf{v} \Rightarrow v^T A v = \lambda v^T v.</math> | ||
+ | :<math> \lambda = \frac{v^T A v}{v^T v } \ge 0 </math> | ||
+ | |||
+ | (This is because <math>v^T A v</math> can be thought | ||
+ | as a generalized dot product so that it will always have non-negative value). | ||
+ | |||
+ | === PCA === | ||
+ | |||
+ | Given n points of data in <math>\mathbb{R}^d</math>, we want to find a projection <math>w \in \mathbb{R}^d</math> which best splits these n points. The notion of 'best' is measured by variance of the projected data. Note that we can assume WLOG that <math>\sum_{i=1}^{n} \mathbf{x}_i = 0</math>. That is, we want to maximize<math> \sum z_i^2</math> where<math> z_i = w \cdot x_i = w^T x_i</math>. | ||
+ | |||
+ | : <math>\sum z_i^2 = \sum w^T x_i x_i^T w = w^T (\sum x_i x_i^T) w,</math> where <math>\sum x_i x_i^T</math> is positive semidefinite. | ||
+ | The problem is given as follows. | ||
+ | : <math>\max_{w \in \mathbb{R}^d} w^T (\sum \mathbf{x}_i \mathbf{x}_i^T) w</math> | ||
+ | :: s.t. <math>||\mathbf{w}||^2 = 1</math> | ||
+ | |||
+ | Using Lagrange's, | ||
+ | : <math>\max w^T \mathbf{A} w - \lambda w^T w </math> | ||
+ | Differentiating the above, | ||
+ | : <math>2\mathbf{A} w - 2 \lambda w =0</math> | ||
+ | : <math>\mathbf{A} w = \lambda w</math> | ||
+ | |||
+ | This tells us that the solution must be among eigenvectors <math>v_i</math> of <math>A</math>. | ||
+ | |||
+ | : <math>v_i^T A v_i = v_i^T \lambda_i v_i = \lambda_i v_i^T v_i = \lambda_i</math> | ||
+ | |||
+ | The solution becomes clear now, i.e. choose <math>\mathbf{w}</math> to be the eigenvectors corresponding to the ''largest'' eigenvalue of <math>\mathbf{A}</math>. | ||
+ | |||
+ | === Fischer LDA === | ||
+ | |||
+ | Another method along the same line was proposed by Fischer. The idea is to find the direction which best seperates the mean of different classes, as contrasted to PCA which finds the direction in which the projected data have highest variance. Fisher's criterion is as follows: (note that we consider the task of classifications with two labels, 1 and -1) | ||
+ | |||
+ | : <math>\max_{w \in \mathbb{R}^d} \frac{||w^T m_1 - w^T m_{-1}||^2}{\sum_{i \in I_1} ||w^T x_i - w^T m_1||^2 + \sum_{i \in I_{-1}} ||w^T x_i - w^T m_{-1}||^2 } | ||
+ | </math> | ||
+ | |||
+ | where <math>m_c = \frac{1}{|I_c|} \sum_{i \in I_c} x_i</math> | ||
+ | |||
+ | The numerator could be written as <math>w^T (m_1 - m_{-1})(m_1-m_{-1})^T w</math> which we denote the middle term by <math>\mathbb{S}_B</math>. Also, the denominator reduces to | ||
+ | |||
+ | : <math>w^T (\sum (x_i - m_1) (x_i- m_1)^T + \sum ( x_i - m_2)(x_i - m_2)^T) w</math> | ||
+ | |||
+ | which we denote the middle term by <math>\Sigma</math>. The problem becomes | ||
+ | |||
+ | : <math>\max_{w \in \mathbb{R}^d} \frac{w^T \mathbb{S}_B w}{w^T \Sigma w }</math> | ||
+ | |||
+ | This is equivalent to | ||
+ | |||
+ | : <math>\max_{w \in \mathbb{R}^d} w^T \mathbb{S}_B w </math> | ||
+ | : s.t. <math>\mathbf{w}^T \Sigma \mathbf{w} =1</math> | ||
+ | |||
+ | Again, consider Lagrange and differentiate the formula. we get | ||
+ | |||
+ | : <math> 2 \mathbb{S}_B w = 2 \lambda \Sigma w</math> | ||
+ | : <math>\Sigma^{-1} \mathbb{S}_B w = \lambda w</math> | ||
+ | |||
+ | This would have been done if<math> \Sigma^{-1} \mathbb{S}_B</math> is symmetric and positive semidefinite. We can use the eigenvector solutions like before. We can work it out as follows: | ||
+ | * Observe that <math>\mathbb{S}_B</math> is a rank-one symmetric, positive semidefinite matrix (rank-one is not important, though). So, the notation <math>\mathbb{S}^{1/2}_B</math> makes sense because we can consider changing to eigen basis, <math>\mathbb{S}_B = U D U^T</math>. So <math>\mathbb{S}^{1/2}_B = U D^{1/2} U^T</math>. | ||
+ | |||
+ | Replacing <math>\mathbb{S}^{1/2}_B w</math> with v, we get | ||
+ | |||
+ | : <math>\mathbb{S}^{1/2}_B \Sigma^{-1} \mathbb{S}^{1/2}_B v = \lambda v</math> | ||
+ | |||
+ | And one can check that the linear map on the lefthand is symmetric, positive semidefinite. Thus, we can find eigenvector solution <math>v_k</math> corresponding to <math>\lambda_k</math> and compute <math>w_k = \mathbb{S}^{-1/2}_B v_k </math> . | ||
+ | |||
+ | One can also verify that, plugging this solution back to the original equation, we get | ||
+ | |||
+ | : <math>\frac{w_k^T \mathbb{S}_B w_k}{w_k^T \Sigma w_k } = \frac{\lambda_k w^T_k \Sigma w_k}{w_k^T \Sigma w_k } = \lambda_k </math> | ||
+ | |||
+ | So, we can maximize the objective by choosing the vector <math>v_k</math> corresponding to largest eigenvalue. | ||
+ | |||
+ | == Week 3: Finishing up SVM == | ||
+ | This week, we will talk about support vector machines which involve solving quadratic programs. At the same time, we start the theory of VC dimension. | ||
+ | |||
+ | See [[Week 3 (Machine_Learning) | this]]. | ||
+ | |||
+ | Please see chapter 10 in Vapnik's book ''Statistical Learning Theory'' for reference. | ||
+ | |||
+ | == Week 4: A theory of reproducing kernels == | ||
+ | This week, we start looking at kernel methods which will be a main focus for this quarter. The first class gives several definitions and concepts relating to reproducing kernel hilbert spaces. We talk about two constructions of r.k. Hilbert space (i.e. via a completion of linear combinations and via measure-theoretic view). These two methods (and some others in the liturature) are equivalent. Examples of the construction are given in the finite-domain case. | ||
+ | |||
+ | [[Week4_Machine Learning | here]] | ||
+ | |||
+ | Please see the reference for more detail. | ||
+ | |||
+ | == Week 5: More on kernels == | ||
+ | The plan for this week is to talk about [http://people.cs.uchicago.edu/~niyogi/papersps/MinNiyYao06.pdf this paper] | ||
+ | |||
+ | ==Useful Links== | ||
+ | ===General Theory=== | ||
+ | * [http://en.wikipedia.org/wiki/Eigenvalue,_eigenvector_and_eigenspace Wikipedia article on eigenvalue, eigenvector and eigenspace] | ||
+ | * [http://en.wikipedia.org/wiki/Ordinary_least_squares Wikipedia article on ordinary least square] | ||
+ | * [http://en.wikipedia.org/wiki/Singular_value_decomposition Wikipedia article on singular value decomposition] | ||
+ | * [http://en.wikipedia.org/wiki/Principal_component_analysis Wikipedia article on principal component analysis] | ||
+ | * [http://en.wikipedia.org/wiki/Tikhonov_regularization Wikipedia article on Tikhonov regularization] | ||
+ | * [http://www.jstor.org/view/00029947/di963001/96p0042z/0 Reproducing kernels Hilbert spaces] | ||
+ | |||
+ | === Famous Applications of PCA in machine learning === | ||
+ | * Eigenface for '''face recognition''' | ||
+ | ** [http://en.wikipedia.org/wiki/Eigenface Wikipedia article on eigenface] | ||
+ | ** [http://vismod.media.mit.edu/vismod/demos/facerec/basic.html MIT introduction to eigenface] |
รุ่นแก้ไขปัจจุบันเมื่อ 09:00, 9 กันยายน 2550
This page contains a list of topics, definitions, and results from Machine Learning course at University of Chicago taught by this guy. The proof is very sketchy and given without any intuition mainly because I'm so lazy. I would appreciate all kinds of help to make the note complete.
เนื้อหา
Week 1: Introduction and OLS
The materials this week are just about the framework. We show that the problem of minimizing squared errors with respect to a distribution is the same as the problem of learning . If the examples are drawn from discrete domain, this is a classification problem, but in case of continuous domain, it's a regression problem.
After defining all necessary definitions, an example of linear regression is given as a motivation of how regression is done.
Learning problem
Given a distribution on . We want to learn the objective function (with respect to the distribution :).
Learning Algorithms
Let Z be the set of possible samples. The learning algorithm is a function that maps a number of samples to a measurable function (denoted here by F a class of all measurable functions). Sometimes we consider a class of computable functions instead.
Learning errors
Suppose the learning algorithm outputs h. The learning error can be measured by
One can prove that minimizing this quantity could be reduced to the problem of minimizing the following quantity.
And that's the reason why we try to learn
In other word, we claim that
The proof is easy.
We get
Then observe that,
- The first term only depends on distribution
- The third term is zero
Observe also that the term which is zero.
- The second term is equal to
Example 1
When the class , i.e. classification problem, our objective reduces to
One can show that the function
minimizes the loss (proof omited)
Example 2
When , the problem is just like regression where we try to regress :
Learning lowerbound
Let be a class of probability distribution of interest. No algorithm achieve error smaller than
Ordinary Least Square
If the relation is linear,
OLS provably gives the minimum squared error.
Consider the error
Differentiating the error and make it zero, we get
If has no nullspace (or is full rank), then it has an inverse. We get
But if the matrix is not full rank, we can still show that
minimizes the error, where is the Moore-Penrose pseudoinverse of the matrix.
First, let be eigenvalues of and let be corresponding eigenvectors.
Note that:
- Since is positive semidefinite, all eigenvalues are non-negative
- We can decompose to
- (because is symmetric so that every eigenvector is orthogonal to others.)
Denote the column space of by . Assume WLOG that and .
We will first show that in fact, lives in the subspace . Observe that since the set of eigenvectors span , it suffices to show that it is orthogonal to every vector in
- , .
Let , that is . We get
This implies that and thus, .
From the fact that lives in , we can verify that the following is what we need.
And it's straightforward to see that the solution for is not unique since any for would also satisfy the equation.
Note that the term is a Moore-Penrose pseudoinverse of a singular matrix.
Tikhonov Regularization
Instead of solving
we look at
If tends to zero, it problem becomes just like OLS. If is a certain positive number, differentiating both sides give (and equate to zero)
are eigenvalues of , where are eigenvalues of .
Observe that all eigenvalues are positive, so nullspace is zero. And thus, matrix on the left-hand side is invertible. The solution is unique.
Week 2: PCA, LDA, and Introduction to SVM
In this week, we cover another theme of techniques, i.e. Principle Component Analysis (PCA) and Fisher Linear discriminant analysis. As compared to last week topics which involve solving linear systems, this week topics involve solving eigenvalues & eigenvectors of matrix.
Since the theory of positive semidefinite will be crucial throughout the course, we give a quick introduction.
A quick introduction to theory of positive matrix
A matrix is said to be positive semidefinite if
- for all w
Observation: Matrix in the form is positive semidefinite.
Proof. for any w,
property 1: Positive semidefinite matrix has eigenvalue
Proof.
(This is because can be thought as a generalized dot product so that it will always have non-negative value).
PCA
Given n points of data in , we want to find a projection which best splits these n points. The notion of 'best' is measured by variance of the projected data. Note that we can assume WLOG that . That is, we want to maximize where.
- where is positive semidefinite.
The problem is given as follows.
-
- s.t.
Using Lagrange's,
Differentiating the above,
This tells us that the solution must be among eigenvectors of .
The solution becomes clear now, i.e. choose to be the eigenvectors corresponding to the largest eigenvalue of .
Fischer LDA
Another method along the same line was proposed by Fischer. The idea is to find the direction which best seperates the mean of different classes, as contrasted to PCA which finds the direction in which the projected data have highest variance. Fisher's criterion is as follows: (note that we consider the task of classifications with two labels, 1 and -1)
where
The numerator could be written as which we denote the middle term by . Also, the denominator reduces to
which we denote the middle term by . The problem becomes
This is equivalent to
- s.t.
Again, consider Lagrange and differentiate the formula. we get
This would have been done if is symmetric and positive semidefinite. We can use the eigenvector solutions like before. We can work it out as follows:
- Observe that is a rank-one symmetric, positive semidefinite matrix (rank-one is not important, though). So, the notation makes sense because we can consider changing to eigen basis, . So .
Replacing with v, we get
And one can check that the linear map on the lefthand is symmetric, positive semidefinite. Thus, we can find eigenvector solution corresponding to and compute .
One can also verify that, plugging this solution back to the original equation, we get
So, we can maximize the objective by choosing the vector corresponding to largest eigenvalue.
Week 3: Finishing up SVM
This week, we will talk about support vector machines which involve solving quadratic programs. At the same time, we start the theory of VC dimension.
See this.
Please see chapter 10 in Vapnik's book Statistical Learning Theory for reference.
Week 4: A theory of reproducing kernels
This week, we start looking at kernel methods which will be a main focus for this quarter. The first class gives several definitions and concepts relating to reproducing kernel hilbert spaces. We talk about two constructions of r.k. Hilbert space (i.e. via a completion of linear combinations and via measure-theoretic view). These two methods (and some others in the liturature) are equivalent. Examples of the construction are given in the finite-domain case.
Please see the reference for more detail.
Week 5: More on kernels
The plan for this week is to talk about this paper
Useful Links
General Theory
- Wikipedia article on eigenvalue, eigenvector and eigenspace
- Wikipedia article on ordinary least square
- Wikipedia article on singular value decomposition
- Wikipedia article on principal component analysis
- Wikipedia article on Tikhonov regularization
- Reproducing kernels Hilbert spaces
Famous Applications of PCA in machine learning
- Eigenface for face recognition