week 1 では、以下の事柄に関して、一つの定数と一つの変数を持つ1次関数に関して検討をおこなった。つまり f(x) = 定数a + θ(:xの変数) * x の場合の検討である。
http://latex.codecogs.com/eqneditor/integration/blogger/install.php
ガジェットを追加→<script type="text/javascript" src="http://latex.codecogs.com/latexit.php?p&li&div"></script>をコンテンツに追加
あとは本文に「$$」 で囲ったエリアに特定の様式で書けば OK
$X ={X_i^2}$
上記の式は、X ={X_i^2} を $$で囲ったもの
http://www.codecogs.com/latex/eqneditor.php
↑example からよく使うものはあるので、クリックして表示されるものを参考に入力
複数変数variable をもつ場合の、表記について
https://www.coursera.org/learn/machine-learning/supplement/WKgbA/multiple-features
${x_j^{(i)}}$ は、i番目のトレーニングサンプルの、j個目の特徴を表す。
${x^{(i)}}$ は、i番目のトレーニングサンプル全体を表す。
m はトレーニングサンプルの数
n は特徴量の数
複数特徴量を持つ一次式のは、次のように表すことができる
$h_{\theta}(x) = \theta_0 + \theta_1 x_1 + \theta_2 x_2 + \theta_3 x_3 + \cdots+ \theta_n x_n$
これはθのマトリックスとxのマトリックスの掛け算なので、次のように表せる
$h_{\theta}(x) = \begin{pmatrix}\theta_0 & \theta_1 & \theta_2 & \cdots & \theta_n\end{pmatrix}\begin{pmatrix}x_0\\ x_1\\x_2\\\cdots\\x_n\end{pmatrix}$
さらに、それぞれ以下のようなマトリックスと定義した場合、
$ \theta = \begin{pmatrix}\theta_0 \\ \theta_1 \\ \theta_2 \\ \cdots \\ \theta_n\end{pmatrix}$
$ x = \begin{pmatrix}x_0\\ x_1\\x_2\\\cdots\\x_n\end{pmatrix}$
$ \theta^T = \begin{pmatrix}\theta_0 & \theta_1 & \theta_2 & \cdots & \theta_n\end{pmatrix}$ なので、( $ \theta^T$ は $ \theta$のtransition = 転置)
$h_{\theta}(x) = \begin{pmatrix}\theta_0 & \theta_1 & \theta_2 & \cdots & \theta_n\end{pmatrix}\begin{pmatrix}x_0\\ x_1\\x_2\\\cdots\\x_n\end{pmatrix} = \theta^T x$ と表すことができる
- const function
- const function の値が最小になるようにする = この場合が、最適な予想曲線となる
- cost function が最小になる θ を定める方法(gradient descent)
メモ blogger で数式を埋め込む方法
基本これを参照http://latex.codecogs.com/eqneditor/integration/blogger/install.php
ガジェットを追加→<script type="text/javascript" src="http://latex.codecogs.com/latexit.php?p&li&div"></script>をコンテンツに追加
あとは本文に「$$」 で囲ったエリアに特定の様式で書けば OK
$X ={X_i^2}$
上記の式は、X ={X_i^2} を $$で囲ったもの
http://www.codecogs.com/latex/eqneditor.php
↑example からよく使うものはあるので、クリックして表示されるものを参考に入力
動画1
https://www.coursera.org/learn/machine-learning/lecture/6Nj1q/multiple-features複数変数variable をもつ場合の、表記について
https://www.coursera.org/learn/machine-learning/supplement/WKgbA/multiple-features
${x_j^{(i)}}$ は、i番目のトレーニングサンプルの、j個目の特徴を表す。
${x^{(i)}}$ は、i番目のトレーニングサンプル全体を表す。
m はトレーニングサンプルの数
n は特徴量の数
複数特徴量を持つ一次式のは、次のように表すことができる
$h_{\theta}(x) = \theta_0 + \theta_1 x_1 + \theta_2 x_2 + \theta_3 x_3 + \cdots+ \theta_n x_n$
これはθのマトリックスとxのマトリックスの掛け算なので、次のように表せる
$h_{\theta}(x) = \begin{pmatrix}\theta_0 & \theta_1 & \theta_2 & \cdots & \theta_n\end{pmatrix}\begin{pmatrix}x_0\\ x_1\\x_2\\\cdots\\x_n\end{pmatrix}$
さらに、それぞれ以下のようなマトリックスと定義した場合、
$ \theta = \begin{pmatrix}\theta_0 \\ \theta_1 \\ \theta_2 \\ \cdots \\ \theta_n\end{pmatrix}$
$ x = \begin{pmatrix}x_0\\ x_1\\x_2\\\cdots\\x_n\end{pmatrix}$
$ \theta^T = \begin{pmatrix}\theta_0 & \theta_1 & \theta_2 & \cdots & \theta_n\end{pmatrix}$ なので、( $ \theta^T$ は $ \theta$のtransition = 転置)
$h_{\theta}(x) = \begin{pmatrix}\theta_0 & \theta_1 & \theta_2 & \cdots & \theta_n\end{pmatrix}\begin{pmatrix}x_0\\ x_1\\x_2\\\cdots\\x_n\end{pmatrix} = \theta^T x$ と表すことができる
このような場合のコストファンクション
動画2
https://www.coursera.org/learn/machine-learning/supplement/aEN5G/gradient-descent-for-multiple-variables
左側の画像は、以前扱った、変数が1つの場合のコストファンクション。
$\frac{\partial}{\partial \theta_0} J(\theta)$ は、$J(\theta)$ を $\theta_0$で偏微分したもの。
右上は、変数が1個以上の場合の一般化した式。
右下は、n=2 の場合の具体例。
特徴量n が2個ということは、当然 θ も2個ある。(θ0を入れたら3つ)
$x_1^{(i)}$は、特徴量の1番目のやつの、1番目のサンプルのこと。
右下は、n=2 の場合の具体例。
特徴量n が2個ということは、当然 θ も2個ある。(θ0を入れたら3つ)
$x_1^{(i)}$は、特徴量の1番目のやつの、1番目のサンプルのこと。
Comments
Post a Comment