Skip to content

Commit

Permalink
全体の pdf をアップデート
Browse files Browse the repository at this point in the history
  • Loading branch information
abap34 committed Jul 16, 2024
1 parent 7b09a3e commit ecf4916
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 39 deletions.
Binary file modified ch00/lecture.pdf
Binary file not shown.
Binary file modified ch01/lecture.pdf
Binary file not shown.
Binary file modified ch02/lecture.pdf
Binary file not shown.
Binary file modified ch03/lecture.pdf
Binary file not shown.
Binary file modified ch04/lecture.pdf
Binary file not shown.
Binary file modified ch05/lecture.pdf
Binary file not shown.
Binary file modified ch06/lecture.pdf
Binary file not shown.
Binary file modified ch07/lecture.pdf
Binary file not shown.
110 changes: 71 additions & 39 deletions slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,27 @@ math: mathjax

<!-- _header: この資料について -->

この資料は, [東京工業大学デジタル創作同好会 traP Kaggle班](https://trap.jp/kaggle/) で 2024年に実施した 「機械学習講習会」の資料です.
<br>
<br>


この資料は [東京工業大学デジタル創作同好会 traP Kaggle班](https://trap.jp/kaggle/) で 2024年に実施した 「機械学習講習会」の資料です.

機械学習に初めて触れる学部一年生のメンバーが

<div class="proof">

機械学習に初めて触れる学部一年生のメンバーが, 基本的な機械学習のアイデアを理解して, 最終的にニューラルネットを実際の問題解決に使えるようになることを目指しています.

1. **基本的な機械学習のアイデアを理解** して,
2. **最終的にニューラルネットを実際の問題解決に使えるようになること**


</div>


を目指しています.

(講習会自体については https://abap34.github.io/ml-lecture/supplement/preface.html をみてください)


---
Expand Down Expand Up @@ -81,7 +98,7 @@ ul li::before {

<div class="box">

#### [1] 学習
#### [1] [学習](#ch01)
- この講習会について
- 学習とは?
- 損失関数
Expand All @@ -91,7 +108,7 @@ ul li::before {

<div class="box">

#### [2] 勾配降下法
#### [2] [勾配降下法](#ch02)
- 関数の最小化
- 勾配降下法

Expand All @@ -100,7 +117,7 @@ ul li::before {

<div class="box">

#### [3] 自動微分
#### [3] [PyTorch と自動微分](#ch03)
- PyTorch の紹介
- Tensor型と自動微分
- トピック: 自動微分のアルゴリズムと実装
Expand All @@ -116,7 +133,7 @@ ul li::before {
<div class="box">


#### [4] ニューラルネットワークの構造
#### [4] [ニューラルネットワークの構造](#ch04)
- 複雑さを生むには?
- 「基になる」関数を獲得する
- ニューラルネットワークの基本概念
Expand All @@ -127,7 +144,7 @@ ul li::before {

<div class="box">

#### [5] ニューラルネットワークの学習と評価
#### [5] [ニューラルネットワークの学習と評価](#ch05)
- DNN の学習の歴史
- 初期化 ?
- 確率的勾配降下法
Expand All @@ -145,7 +162,7 @@ ul li::before {

<div class="box">

#### [6] ニューラルネットワークの実装
#### [6] [PyTorch による実装](#ch06)
- データの前処理
- モデルの構築
- モデルの学習
Expand All @@ -156,12 +173,11 @@ ul li::before {
<div class="box">


#### [7] 機械学習の応用とデータ分析コンペ
- データ分析コンペの戦い方
#### [7] [機械学習の応用, データ分析コンペ](#ch07)
- データ分析コンペの立ち回り
- EDA
- CV と shake
- さまざまな機械学習モデル
- 扱わなかった領域
- ハイパーパラメータのチューニング

</div>

Expand All @@ -185,8 +201,8 @@ ul li::before {
}
</style>

- この資料を管理しているレポジトリ: https://github.com/abap34/ml-lecture
- 誤りのご指摘などはこちらの Issue にお願いします.
- この資料を管理しているレポジトリは https://github.com/abap34/ml-lecture です。
- 誤りのご指摘などはこちらの Issue または https://twitter.com/abap34 までご連絡ください.
- 補足資料なども含めてまとめたものを https://abap34.com/trap_ml_lecture.html から確認できます.
- この資料のリンクにはサークルメンバー以外がアクセスできないものが含まれています. (oj.abap34.com, dacq.abap34.com など)
- オンラインジャッジは https://github.com/abap34/ml-lecture-judge
Expand Down Expand Up @@ -224,6 +240,8 @@ ul li::before {

---

<div id="ch01"></div>

<!-- _class: lead -->

# **機械学習講習会**
Expand All @@ -242,7 +260,7 @@ ul li::before {

<!-- _header: この講習会のゴール -->

## ✅ 機械学習の基本的なアイデアを理解して,
## ✅ 機械学習の基本的なアイデアを理解して
## 問題解決の手段として使えるようになる.


Expand All @@ -259,7 +277,7 @@ ul li::before {
第4回 │ ニューラルネットワークの構造
第5回 │ ニューラルネットワークの学習と評価
第6回 │ PyTorch による実装
第7回 │ 機械学習の応用,データ分析コンペ
第7回 │ 機械学習の応用, データ分析コンペ

</div>

Expand All @@ -268,7 +286,7 @@ ul li::before {

---

<!-- _header: この講習会で扱うこと,扱わないこと -->
<!-- _header: この講習会で扱うこと扱わないこと -->

<br>

Expand Down Expand Up @@ -347,7 +365,7 @@ ul li::before {
---
<!-- _header: がんばりましょう -->

(ここだけの話,機械学習はめちゃくちゃおもしろい)
(ここだけの話機械学習はめちゃくちゃおもしろい)


<br>
Expand All @@ -370,7 +388,7 @@ ul li::before {

### 今日の目標

機械学習の基本的な用語を整理して,
機械学習の基本的な用語を整理して
「学習」ということばをきちんと説明できるようになる.


Expand Down Expand Up @@ -412,8 +430,8 @@ ul li::before {

<div class="cite">

ここでは一つの定義を紹介しましたが,実際この二つの言葉に明確に定義や合意があるわけではないです.
手法を厳密に分類してもあまり嬉しいことはないと思いますが,とりあえずこの講習会ではこういう形で整理してみることにします.
ここでは一つの定義を紹介しましたが, 実際この二つの言葉に明確に定義や合意があるわけではないです.
手法を厳密に分類してもあまり嬉しいことはないと思いますが, とりあえずこの講習会ではこういう形で整理してみることにします.

</div>

Expand Down Expand Up @@ -539,15 +557,15 @@ ul li::before {


「予測」ってなんだっけ?
入力を受け取って,それっぽい出力をすること
入力を受け取ってそれっぽい出力をすること




今回は,「入力: 気温」 → 「出力: アイスの売り上げ」
今回は 「入力: 気温」 → 「出力: アイスの売り上げ」

そして, ✅ <span class="lined"> **入力は知ってるものだけとは限らない**</span>
そして ✅ <span class="lined"> **入力は知ってるものだけとは限らない**</span>


</div>
Expand All @@ -560,7 +578,7 @@ ul li::before {

## 売り上げ = $f$(気温) となる関数 $f$ の推定

このような,入力データを受け取り結果を返す $f$ を**モデル**と呼ぶ
このような入力データを受け取り結果を返す $f$ を**モデル**と呼ぶ


---
Expand Down Expand Up @@ -626,7 +644,7 @@ $a = -20, \ b=1000$ のとき...
$a, b$ を変えることでモデル $f$ の具体的な形が変わった!

このように各モデルが固有に持ってモデル自身の性質を定める
数を,「<span class="dot-text">パラメータ</span>」という. ( $f$ は $a, b$ をパラメータとして持つ )
数を 「<span class="dot-text">パラメータ</span>」という. ( $f$ は $a, b$ をパラメータとして持つ )


<div style="text-align: center;">
Expand Down Expand Up @@ -849,9 +867,9 @@ $$

<!-- _header: 何を動かして損失を小さくする? -->

Q. 損失は何の関数? (何を動かして,損失を小さくする?)
Q. 損失は何の関数? (何を動かして損失を小さくする?)

✅ 各 $x_i, y_i$ は変数みたいな見た目だけど,実際は <span class="dot-text">「もう観測された確定値」 </span>
✅ 各 $x_i, y_i$ は変数みたいな見た目だけど <span class="dot-text">「もう観測された確定値」 </span>


<div class="proof">
Expand Down Expand Up @@ -942,7 +960,7 @@ $b \approx 126.12821494344632$
- いったん, 今回は関数の形として $f(x) = ax + b$ (一次関数) に限って,関数を決めることにした.
- この関数は, パラメータとして $(a, b)$ をもち, $(a, b)$ を変えることで
性質が変わるのがわかった
- モデルの「よさ」のめやすとして, 「損失関数」を導入した
- モデルの「よさ」のめやすとして 「損失関数」を導入した
- パラメータを変えることで損失関数を最小化する過程のことを「学習」と呼ぶ


Expand Down Expand Up @@ -987,7 +1005,7 @@ $b \approx 126.12821494344632$

$y_i = f(x_i) + \epsilon_i$, $\epsilon_i \overset{\text{i.i.d.}}{\sim} \mathcal{N}(0, \sigma^2)$ とする.

このとき, $y_i \overset{\text{i.i.d.}}{\sim} \mathcal{N}(f(x_i), \sigma^2)$ より
このとき $y_i \overset{\text{i.i.d.}}{\sim} \mathcal{N}(f(x_i), \sigma^2)$ より
尤度は

$$
Expand All @@ -1009,6 +1027,9 @@ $\sigma^2$ が固定されていることに注意すると,

---

<div id="ch02"></div>


<!-- _class: lead -->

# **機械学習講習会**
Expand Down Expand Up @@ -1207,7 +1228,7 @@ $$

いいたかったこと

**このレベルの単純な形の関数でも, 解をよく知っている形で書き表すことは難しい**
**このレベルの単純な形の関数でも解をよく知っている形で書き表すことは難しい**

---

Expand Down Expand Up @@ -1243,7 +1264,7 @@ $$
数学の答案で最小値 1 になるところを 1.001と答えたら当然 🙅


### 一方, <span class="lined">「誤差 1」 が 「誤差1.001」 になってもほとんど変わらない</span>
### 一方 <span class="lined">「誤差 1」 が 「誤差1.001」 になってもほとんど変わらない</span>

---

Expand Down Expand Up @@ -1331,7 +1352,7 @@ $$

<div style="text-align: center;">

$f'(x)$ は, $x$ における接線の傾き
$f'(x)$ は $x$ における接線の傾き


</div>
Expand All @@ -1354,7 +1375,7 @@ $$


$-f'(x)$ **方向に関数を
すこし動かすと,関数の値はすこし小さくなる**
すこし動かすと関数の値はすこし小さくなる**


</div>
Expand Down Expand Up @@ -1434,7 +1455,7 @@ $f(2.8) = 7.84 <8.41$
## 勾配降下法


関数 $f(x)$ と,初期値 $x_0$ が与えられたとき,
関数 $f(x)$ と初期値 $x_0$ が与えられたとき,
次の式で $\{x_k\}$ を更新するアルゴリズム

$$
Expand Down Expand Up @@ -1528,8 +1549,8 @@ $$

$f(x) = x^2$

初期値として,$x_0 = 3$
学習率として,$\eta = 0.1$ を設定.(この二つは自分で決める!)
初期値として $x_0 = 3$
学習率として $\eta = 0.1$ を設定.(この二つは自分で決める!)

$x_1 = x_0 - \eta f'(x_0) = 3 - 0.1 \times 6 = 2.4$
$x_2 = x_1 - \eta f'(x_1) = 2.4 - 0.1 \times 4.8 = 1.92$
Expand Down Expand Up @@ -1596,7 +1617,7 @@ $x_{1000} = 0.35173371125366865$
from math import exp

x = 3
# (注意: $\eta$ は, 学習率 (learning rate) の略である lr としています.)
# (注意: $\eta$ は 学習率 (learning rate) の略である lr としています.)
lr = 0.0005

# 最小化したい関数
Expand Down Expand Up @@ -1720,7 +1741,7 @@ $$

<div class="cite">

勾配ベクトルとは,各変数の偏微分係数を並べたものです. 例えば,$f(x, y) = x^2 + y^2$ の $(x, y)$ における勾配ベクトルは $(2x, 2y)$ です.
勾配ベクトルは各変数の偏微分係数を並べたものです. 例えば $f(x, y) = x^2 + y^2$ の $(x, y)$ における勾配ベクトルは $(2x, 2y)$ です.
これを$\nabla f(x, y) = (2x, 2y)$ とかきます. 一年生はちょうど微分積分学第一でやるころかと思うので大きくは扱いませんでしたが, 一変数の場合できちんと理解できていれば大丈夫です.

</div>
Expand Down Expand Up @@ -1771,6 +1792,10 @@ $$

---


<div id="ch03"></div>


<!-- _class: lead-->

# 機械学習講習会 第三回
Expand Down Expand Up @@ -3275,6 +3300,8 @@ PyTorch でもこの方法で勾配を計算している.

---

<div id="ch04"></div>

<!-- _class: lead-->

# 機械学習講習会 第四回
Expand Down Expand Up @@ -4432,6 +4459,8 @@ A. 層を深くすると指数関数的に表現力が上がり, 幅を広くす
---
<div id="ch05"></div>
<!-- _class: lead-->
# 機械学習講習会 第五回
Expand Down Expand Up @@ -5789,6 +5818,8 @@ $$
---
<div id="ch06"></div>
<!-- _class: lead-->
Expand Down Expand Up @@ -7715,6 +7746,7 @@ write_pred(pred)
---
<div id="ch07"></div>
<!-- _class: lead-->
Expand Down
Binary file modified slides.pdf
Binary file not shown.
Binary file modified supplement/competetion.pdf
Binary file not shown.

0 comments on commit ecf4916

Please sign in to comment.