update week 35
This commit is contained in:
@@ -127,6 +127,7 @@ div { text-align: justify; text-justify: inter-word; }
|
||||
2,
|
||||
None,
|
||||
'some-useful-matrix-and-vector-expressions'),
|
||||
('Meet the Hessian Matrix', 2, None, 'meet-the-hessian-matrix'),
|
||||
('Interpretations and optimizing our parameters',
|
||||
2,
|
||||
None,
|
||||
@@ -202,6 +203,10 @@ div { text-align: justify; text-justify: inter-word; }
|
||||
'the-svd-a-fantastic-algorithm'),
|
||||
('Economy-size SVD', 2, None, 'economy-size-svd'),
|
||||
('Codes for the SVD', 2, None, 'codes-for-the-svd'),
|
||||
('Note about SVD Calculations',
|
||||
2,
|
||||
None,
|
||||
'note-about-svd-calculations'),
|
||||
('Mathematical Properties', 2, None, 'mathematical-properties'),
|
||||
('Friday September 3', 2, None, 'friday-september-3'),
|
||||
('Ridge and LASSO Regression',
|
||||
@@ -867,6 +872,33 @@ $$
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="meet-the-hessian-matrix">Meet the Hessian Matrix </h2>
|
||||
|
||||
<p>
|
||||
A very important matrix we will meet again and again in Machine Learning is the Hessian.
|
||||
It is given by the second derivative of the cost function with respect to the parameter \( \beta \). Using the above expression for derivatives of vectors and matrices, we find that the second derivative of the cost function is,
|
||||
|
||||
$$
|
||||
\frac{\partial}{\partial \boldsymbol{\beta}^T}\frac{\partial C(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}} =\frac{\partial}{\partial \boldsymbol{\beta}^T}\left[-\frac{2}{n}\boldsymbol{X}^T\left( \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right)\right]=\frac{2}{n}\boldsymbol{X}^T\boldsymbol{X}.
|
||||
$$
|
||||
|
||||
<p>
|
||||
The Hessian matrix plays an important role and is defined here as
|
||||
|
||||
$$
|
||||
\boldsymbol{H}=\boldsymbol{X}^T\boldsymbol{X}.
|
||||
$$
|
||||
|
||||
<p>
|
||||
For ordinary least squares, it is inversely proportional (derivation next week) with the variance of the optimal parameters
|
||||
\( \hat{\boldsymbol{\beta}} \). Furthermore, we will see later this week that is (beside \( 1/n \)) equal to the covariance matrix. It plays also a very important role in optmization algorithms and Principal Component Analysis as a way to reduce the dimensionality of a machine learning problem.
|
||||
|
||||
<p>
|
||||
<b>Linear algebra question:</b> Can we use the Hessian matrix to say something about properties of the cost function (our optmization problem)? (hint: think about convex or concave problems and how to relate these to a matrix!).
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="interpretations-and-optimizing-our-parameters">Interpretations and optimizing our parameters </h2>
|
||||
<div class="alert alert-block alert-block alert-text-normal">
|
||||
<b></b>
|
||||
@@ -1972,6 +2004,26 @@ in the program terminating due to a singular matrix.
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="note-about-svd-calculations">Note about SVD Calculations </h2>
|
||||
|
||||
<p>
|
||||
The \( U \), \( S \), and \( V \) matrices returned from the <b>svd()</b> function
|
||||
cannot be multiplied directly.
|
||||
|
||||
<p>
|
||||
As you can see from the code, the \( S \)
|
||||
vector must be converted into a diagonal matrix. This may cause a
|
||||
as
|
||||
the size of the matrices do not fit the rules of matrix
|
||||
multiplication, where the number of columns in a matrix must match the
|
||||
number of rows in the subsequent matrix.
|
||||
|
||||
<p>
|
||||
If you wish to include the zero singular values, you will need to resize the matrices. More about this later.
|
||||
|
||||
<p>
|
||||
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
|
||||
|
||||
<h2 id="mathematical-properties">Mathematical Properties </h2>
|
||||
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user