This commit is contained in:
Morten Hjorth-Jensen
2024-08-27 05:01:14 +02:00
parent 8e4948fb2a
commit 507c20218a
3 changed files with 461 additions and 445 deletions
+35 -33
View File
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "a15180da",
"id": "3080bd6e",
"metadata": {
"editable": true
},
@@ -14,7 +14,7 @@
},
{
"cell_type": "markdown",
"id": "ac77b923",
"id": "2121a646",
"metadata": {
"editable": true
},
@@ -27,7 +27,7 @@
},
{
"cell_type": "markdown",
"id": "e8b90270",
"id": "5fdd1312",
"metadata": {
"editable": true
},
@@ -43,25 +43,26 @@
"derivatives) of the chosen cost functions. Vectors are always written\n",
"as boldfaced lower case letters and matrices as upper case boldfaced\n",
"letters. You will find useful the notes from week 35 on derivatives of vectors and matrices.\n",
"See also the textbook of Faisal at al, chapter 5 and in particular sections 5.3-5.5 at <https://github.com/CompPhysics/MachineLearning/blob/master/doc/Textbooks/MathMLbook.pdf>\n",
"\n",
"Show that"
]
},
{
"cell_type": "markdown",
"id": "2e2e8f1a",
"id": "5bd583f7",
"metadata": {
"editable": true
},
"source": [
"$$\n",
"\\frac{\\partial (\\boldsymbol{b}^T\\boldsymbol{a})}{\\partial \\boldsymbol{a}} = \\boldsymbol{b},\n",
"\\frac{\\partial (\\boldsymbol{a}^T\\boldsymbol{x})}{\\partial \\boldsymbol{x}} = \\boldsymbol{a}^T,\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "1cdc68da",
"id": "74d2af02",
"metadata": {
"editable": true
},
@@ -71,7 +72,7 @@
},
{
"cell_type": "markdown",
"id": "b87f9fdd",
"id": "cc982163",
"metadata": {
"editable": true
},
@@ -83,7 +84,7 @@
},
{
"cell_type": "markdown",
"id": "6ab53932",
"id": "2f2c4da8",
"metadata": {
"editable": true
},
@@ -93,7 +94,7 @@
},
{
"cell_type": "markdown",
"id": "1a7a8ec2",
"id": "75abd105",
"metadata": {
"editable": true
},
@@ -105,7 +106,7 @@
},
{
"cell_type": "markdown",
"id": "3bdb1514",
"id": "ed48f425",
"metadata": {
"editable": true
},
@@ -114,13 +115,14 @@
"\n",
"The second derivative of the mean squared error is then proportional to the so-called Hessian matrix $\\boldsymbol{H}=\\boldsymbol{X}^T\\boldsymbol{X}$.\n",
"\n",
"**Hint**: In these exercises it is always useful to write out with summation indices the various quantities.\n",
"**Hint**: In these exercises it is always useful to write out with summation indices the various quantities. Take also a look at the weekly slides from week 35 and the various examples included there.\n",
"\n",
"As an example, consider the function"
]
},
{
"cell_type": "markdown",
"id": "3e54eca9",
"id": "329edf30",
"metadata": {
"editable": true
},
@@ -132,7 +134,7 @@
},
{
"cell_type": "markdown",
"id": "3db49a1c",
"id": "01f1090f",
"metadata": {
"editable": true
},
@@ -142,7 +144,7 @@
},
{
"cell_type": "markdown",
"id": "5d4d3a0e",
"id": "8c71ed48",
"metadata": {
"editable": true
},
@@ -154,7 +156,7 @@
},
{
"cell_type": "markdown",
"id": "90eecd1c",
"id": "4e8012af",
"metadata": {
"editable": true
},
@@ -164,7 +166,7 @@
},
{
"cell_type": "markdown",
"id": "7eb7605f",
"id": "a1e0c123",
"metadata": {
"editable": true
},
@@ -176,7 +178,7 @@
},
{
"cell_type": "markdown",
"id": "b30dd90f",
"id": "22a65aed",
"metadata": {
"editable": true
},
@@ -186,7 +188,7 @@
},
{
"cell_type": "markdown",
"id": "1167ec1f",
"id": "e56f21e8",
"metadata": {
"editable": true
},
@@ -198,7 +200,7 @@
},
{
"cell_type": "markdown",
"id": "8f309e9e",
"id": "48394062",
"metadata": {
"editable": true
},
@@ -216,7 +218,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "2df1063f",
"id": "bb67a97a",
"metadata": {
"collapsed": false,
"editable": true
@@ -230,7 +232,7 @@
},
{
"cell_type": "markdown",
"id": "0cb75ec5",
"id": "d60db901",
"metadata": {
"editable": true
},
@@ -244,7 +246,7 @@
},
{
"cell_type": "markdown",
"id": "f0c36bdb",
"id": "274328a7",
"metadata": {
"editable": true
},
@@ -257,7 +259,7 @@
},
{
"cell_type": "markdown",
"id": "8c3ce778",
"id": "59dce0f1",
"metadata": {
"editable": true
},
@@ -268,7 +270,7 @@
},
{
"cell_type": "markdown",
"id": "f861d243",
"id": "1e1f8911",
"metadata": {
"editable": true
},
@@ -280,7 +282,7 @@
},
{
"cell_type": "markdown",
"id": "51500e4b",
"id": "ef31124f",
"metadata": {
"editable": true
},
@@ -290,7 +292,7 @@
},
{
"cell_type": "markdown",
"id": "fda9dadd",
"id": "46ac2123",
"metadata": {
"editable": true
},
@@ -302,7 +304,7 @@
},
{
"cell_type": "markdown",
"id": "6b691499",
"id": "edf840af",
"metadata": {
"editable": true
},
@@ -313,7 +315,7 @@
},
{
"cell_type": "markdown",
"id": "b6f10ab9",
"id": "31059187",
"metadata": {
"editable": true
},
@@ -333,7 +335,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "285159ae",
"id": "f7382860",
"metadata": {
"collapsed": false,
"editable": true
@@ -349,7 +351,7 @@
},
{
"cell_type": "markdown",
"id": "c2840fc9",
"id": "a10412bd",
"metadata": {
"editable": true
},
@@ -359,7 +361,7 @@
},
{
"cell_type": "markdown",
"id": "9dbda275",
"id": "8a9f0b89",
"metadata": {
"editable": true
},
@@ -370,7 +372,7 @@
},
{
"cell_type": "markdown",
"id": "824dba6f",
"id": "df5c7f67",
"metadata": {
"editable": true
},
@@ -382,7 +384,7 @@
},
{
"cell_type": "markdown",
"id": "a3f059cf",
"id": "e9b0fa39",
"metadata": {
"editable": true
},
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -13,11 +13,12 @@ derivatives as well as when we analyze various properties (like second
derivatives) of the chosen cost functions. Vectors are always written
as boldfaced lower case letters and matrices as upper case boldfaced
letters. You will find useful the notes from week 35 on derivatives of vectors and matrices.
See also the textbook of Faisal at al, chapter 5 and in particular sections 5.3-5.5 at URL:"https://github.com/CompPhysics/MachineLearning/blob/master/doc/Textbooks/MathMLbook.pdf"
Show that
!bt
\[
\frac{\partial (\bm{b}^T\bm{a})}{\partial \bm{a}} = \bm{b},
\frac{\partial (\bm{a}^T\bm{x})}{\partial \bm{x}} = \bm{a}^T,
\]
!et
and
@@ -37,7 +38,8 @@ and finally find the second derivative of this function with respect to the vect
The second derivative of the mean squared error is then proportional to the so-called Hessian matrix $\bm{H}=\bm{X}^T\bm{X}$.
_Hint_: In these exercises it is always useful to write out with summation indices the various quantities.
_Hint_: In these exercises it is always useful to write out with summation indices the various quantities. Take also a look at the weekly slides from week 35 and the various examples included there.
As an example, consider the function
!bt