Last active
January 31, 2020 03:12
-
-
Save junichiro/71e2641536b29652fac88d11d7718a30 to your computer and use it in GitHub Desktop.
機械学習に必要な最急降下法の実装に必要な知識まとめ ref: https://qiita.com/junichiro/items/527b1f211ed814528ded
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x := x - \frac{\partial}{\partial x}J(x, y) \\ | |
y := y - \frac{\partial}{\partial y}J(x, y) \\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\theta_1 := \theta_1 - \frac{\partial}{\partial \theta_1}J(\theta_1, \theta_2) \\ | |
\theta_2 := \theta_2 - \frac{\partial}{\partial \theta_2}J(\theta_1, \theta_2) \\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\theta_1 := \theta_1 - \alpha\frac{\partial}{\partial \theta_1}J(\theta_1, \theta_2) \\ | |
\theta_2 := \theta_2 - \alpha\frac{\partial}{\partial \theta_2}J(\theta_1, \theta_2) \\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
J = 目的関数 | |
grad = 目的関数の偏微分項 | |
% fmincg は最急降下法を解くライブラリ | |
[theta, cost] = fmincg([J_theta, grad], initial_theta) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{bmatrix} | |
a & c & e\\ | |
b & d & f | |
\end{bmatrix} | |
=> | |
\begin{bmatrix} | |
a \\ | |
b \\ | |
c \\ | |
d \\ | |
e \\ | |
f | |
\end{bmatrix} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{bmatrix} | |
a \\ | |
b \\ | |
c \\ | |
d \\ | |
e \\ | |
f | |
\end{bmatrix} | |
=> | |
\begin{bmatrix} | |
a & c & e\\ | |
b & d & f | |
\end{bmatrix} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A = [1 3 5; 2 4 6]; | |
% unrolling | |
A = A(:) | |
ans = | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
% reshape | |
A = reshape(A, 2, 3) | |
>> reshape(A, 2, 3) | |
ans = | |
1 2 3 | |
4 5 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment