スキップしてメイン コンテンツに移動

Hessian Matrix

Introduction

Today, I will talk about Taylor expansion with Hessian matrix.
It is important for optimization to understand Taylor expansion with Hessian matrix. Especially, Machine learning has always situation about thinking optimization. Thus I will write it to save knowledge about Hessian matrix.

Overview

  • Definition of Hessian matrix
  • Expression Taylor expansion with vector
  • Optimality of the function
Definition of Hessian matrix
Assumption
f is a function which meets a condition as follows.
  • f output Real value after getting the n-dimensional vector.
    This vector is expressed as follows.
    \[x = [x_1,x_2,,,,x_n]\]
  • \(\forall x_i , i \in {1,2,,,n}\), f have twice partial differential

Definition Hessian matrix

Hessian matrix have \(\frac{\partial^2}{\partial x_i \partial x_j} f(x) ~in~ ~element~ ~of~ (i,j)\)
Thus Hessian matrix is expressed following.
\[ H(f) = \left( \begin{array}{cccc} \frac{\partial^ 2}{\partial x_1^2} & \frac{\partial^2 f}{\partial x_1 \partial x_2} & &\ldots \frac{\partial^2 f}{\partial x_1 \partial x_n} \\ \frac{\partial^ 2 f}{\partial x_1 \partial x_2} & \frac{\partial^ 2 f}{\partial x_2^ 2} & \ldots & \frac{\partial^2 f}{\partial x_2 \partial x_n} \\ \vdots & \vdots & \ddots & \vdots \\ \frac{\partial^ 2 f}{\partial x_n \partial x_2} & \frac{\partial^ 2 f}{\partial x_n \partial x_2} & \ldots & \frac{\partial^2 f}{\partial x_n^2} \\ \end{array} \right) \]

Expression Taylor expansion with vector

I put Taylor expansion until the quadratic terms.
\[f(a+h) = f(a) + \nabla f(a) h + \frac{1}{2} h^T \nabla f(a) h + R_3\]
note that \(H=\nabla ^2 f\) is Hessian matrix.
Please check out the point that I put Taylor expansion until the quadratic terms
There is the reason. It is that I want to optimize f.

Optimality of the function

Definiteness

  • \(n \times n ~matrix~ A\) is positive definite
    \(\forall x \in ~n-dimentinal~ ~space~, z^T A z > 0\)
  • \(n \times n ~matrix~ A\) is negative definite
    \(\forall x \in ~n-dimentinal~ ~space~, z^T A z < 0\)
  • \(n \times n ~matrix~ A\) is positive semidefinite
    \(\forall x \in ~n-dimentinal~ ~space~, z^T A z => 0\)
  • \(n \times n ~matrix~ A\) is negative semidefinite
    \(\forall x \in ~n-dimentinal~ ~space~, z^T A z <= 0\)
\(z^T A z\) is called Quadratic form

Optimality

Now, of course, f deformed by Taylor expansion until the quadratic form is quadratic form.
Thus, We are able to judge Optimality of f.
  • if H(a)(Hessian matrix) is positive definite, f(a) is the minimum value.
  • if H(a)(Hessian matrix) is negative definite, f(a) is the maximum value.

Reference

https://ja.wikipedia.org/wiki/%E3%83%98%E3%83%83%E3%82%BB%E8%A1%8C%E5%88%97
http://www2.kaiyodai.ac.jp/~takenawa/optimization/resume10-1.pdf
http://www.dais.is.tohoku.ac.jp/~shioura/teaching/mp04/mp04-8.pdf
http://tau.doshisha.ac.jp/lectures/2008.calculus-II/html.dir/node43.html

コメント

このブログの人気の投稿

カーネルK-means 理論編

Introduction English ver 今日は、カーネルK-meansの理論について書きます。カーネルK-meansは通常のK-meansの欠点を補うことができます。通常のK-meansの欠点とカーネルK-meansの強みも説明します。もし、まだ御覧になられていなければ、通常の K-means 理論編 の記事を見ていただけるとよいのではないかと思います。 カーネルK-meansの実装編 も併せてご覧ください。 概要 K-meansの弱点 カーネルトリック カーネルK-means アルゴリズム K-meansの弱点 例えば、次のようなデータを用意します。 このデータはK-meansによってうまく分類することはできません。なぜなら通常のK-meansでは、データとプロトタイプのユークリッド距離に依存しているからです。そのため、このような円状に分布しているデータはうまく分類することができません。 プロトタイプとはそれぞれのクラスにあり、そのクラスを代表するようなもののことです。K-meansでは各クラスの平均ベクトルとなります。それゆえ、以下のような分類になってしまいます。 このようなデータではK-meansはうまくいきません。 K-meansで分類できるデータセットは次のように各クラスで固まっている必要があります。 カーネルK-meansはK-meansの弱点を補います。 カーネルトリック 初めに、カーネルトリックを説明します。 線形分離できないようなデータ$X$を例えば次のように線形分離できるように$\phi(x)$に送る写像$\phi$を考えます。 カーネルは次のように定義されます。 $$K(x,y) = \phi(x)^T \phi(y)$$ $\phi$を具体的に計算することは難しいですが、$K(x,y)$を計算することなら簡単です。 この手法をカーネルトリックと呼ばれます。 カーネルK means K-meansの目的関数を復習しておきます。 $$J = \sum_{n=1}^{N} \sum_{k=1}^{K} r_{nk} ||x_n-\mu_k||^2$$ ここで、 プロトタイプは$\mu_i ~\forall k \in K$としま...

dijkstra method

Introduction 日本語 ver Today, I will write about the dijkstra method. This method is algorithm which find the shortest distance. The map is expressed by graph. If you never see  this page , look at its page. This page explain the heap structure and definition of graph. The dijkstra method used heap structure, Because heap structure reduce the amout of calculation of dijkstra method. I use  this slide  to explain dijkstra. Overview Algorithm Implementation Algorithm This algorithm is  Decide start node, and this node named A. Allocate $d=\infty$ for each node, but d=0 for start node. Adjacent node of A named adj_list.  For adj in adj_list:  If d of adj > d of A + weight to adj -> d = A + weight to adj. Remove A from graph network. Find node which have the smallest d and it named A, and if network have node, back to 4. I explain this algorithm by drawing.  I explain algorithm by using this graph.  Fis...

二次元空間の直線

Introduction English ver 今日は、次の定理を証明します。 二次元空間の直線は次のように表せる \[\{x|<x,v> = 0\}\] ただし、vは直線に直行し、ゼロでないベクトルとします。 証明 \[\forall k \in \{x|<x,v> = 0\},\] \[<k,v> = 0\] k と vは二次元空間のベクトルなので、それぞれのベクトルは次のように表せます。 \[k = (k_1,k_2)\] \[v = (v_1,v_2)\] よって \(<k,v>=k_1v_1 + k_2v_2=0\) 方程式を\(k_2\)について解くと \[k_2 = -\frac{v_1}{v_2} k_1\] これはまさしく、傾き\(-\frac{v_1}{v_2}\)の直線です。 Q.E.D