Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
機械学習入門
Search
tasotaku
May 22, 2023
Programming
0
380
機械学習入門
RICORA Programming Team で使用したスライド
tasotaku
May 22, 2023
Tweet
Share
More Decks by tasotaku
See All by tasotaku
DQNによるポーカーの強化学習/Reinforcement Learning in Poker with DQN
tasotaku
0
250
オセロCPU/Othello CPU
tasotaku
0
81
オセロAI / OthelloAI
tasotaku
0
80
私、ChatGPTがChatGPTを解説するよ! / ChatGPT explains ChatGPT
tasotaku
0
440
AIが作る予想外な画像を考える / Consider the unexpected images that AI creates
tasotaku
0
290
Google Colaboratory でStable Diffusionの実装 / Implementation of Stable Diffusion at Google Colaboratory
tasotaku
0
340
Other Decks in Programming
See All in Programming
Go言語でターミナルフレンドリーなAIコマンド、afaを作った/fukuokago20_afa
monochromegane
2
110
Hi, have you met Kotlin Multiplatform? | DevFest Vienna 2024
prof18
0
240
のびしろを広げる巻き込まれ力:偶然を活かすキャリアの作り方/oso2024
takahashiikki
1
290
LangChain & LangServeでAPIを爆速作成
kijitorabuti
2
370
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
120
推し活としてのrails new/oshikatsu_ha_iizo
sakahukamaki
1
330
ML-прайсинг_на_Lamoda__вошли_и_вышли__приключение_на_20_минут__Слава_Цыганков.pdf
lamodatech
0
410
僕がつくった48個のWebサービス達
yusukebe
6
3.6k
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
110
Serverless renderování Webových komponent
rarous
PRO
0
140
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
1.3k
今日で分かる!カスタムコップの作り方
krpk1900
2
320
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
GitHub's CSS Performance
jonrohan
1030
460k
Optimising Largest Contentful Paint
csswizardry
31
2.9k
A better future with KSS
kneath
237
17k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Designing the Hi-DPI Web
ddemaree
280
34k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.8k
Being A Developer After 40
akosma
85
590k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
13
1.8k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Embracing the Ebb and Flow
colly
84
4.4k
Transcript
機械学習入門 2023/05/19 1
目的 機械学習に興味があるけど良く知らないという方向けの話です。 そのため、長い部分や理論的な部分は省略して、広く浅く紹介します。 機械学習とは何なのか、何をするのに向いているのかを知って、興味があるか検討に 役立てて下さい。 「これからガッツリ勉強したい!」という方には向かないかも。 2023/05/19 2
機械学習とは データから自動で学習する技術 2023/05/19 3
深層学習 def predict(self, x): W1, W2 = self.params['W1'], self.params['W2'] b1,
b2 = self.params['b1'], self.params['b2'] a1 = np.dot(x, W1) + b1 z1 = sigmoid(a1) a2 = np.dot(z1, W2) + b2 y = softmax(a2) return y 上のコードのように、計算によって出来ている。 Wは重み、bはバイアス np.dotは行列の積 sigmoidはシグモイド関数 ( sigmoid(x) = 1 / 1 + exp(-x) ) 2023/05/19 4
深層学習 a1 = np.dot(x, W1) + b1 # 第一層 z1
= sigmoid(a1) a2 = np.dot(z1, W2) + b2 # 第二層 y = softmax(a2) 下の図のように表される。(引用: https://jp.mathworks.com/discovery/deep- learning.html) 2023/05/19 5
どうやって学習するのか 誤差を関数で表し、微分を使って誤差が最小になるようにする。 2023/05/19 6
勾配法 引用(https://rightcode.co.jp/blog/information-technology/back-propagation- algorithm-implementation) 微分によって傾き(勾配)を求め、パラメータをどっちにどれだけ進めれば誤差が少なく なるか学習する 2023/05/19 7
誤差逆伝播法 誤差を逆方向からフィードバックする手法 引用(https://rightcode.co.jp/blog/information-technology/back-propagation- algorithm-implementation) 2023/05/19 8
機械学習に扱えるもの 深層学習は数式によって成り立っている事を説明しました。 極端に言えば、数字に変換できる物なら大抵のものが取り込めます。 2023/05/19 9
データ 赤ワインの属性と品質のデータ 引用(https://www.statlab.co.jp/seminar/redwine01.html) 各項目がすでに数値なので、そのまま取り出すことができる。 2023/05/19 10
画像 色は光の三原色の強さで表せる。 0~255段階とすることで、画像を配 列にできる 2023/05/19 11
言語 単語の意味は周囲の単語によって形成される(分布仮説) I say hello You say goodbye IとYouはどちらもsayの前だから似た意味? helloとgoodbyeはどちらもsayの後ろだから似た意味?
単語をベクトルで表現する 各単語の類似度(数値)をベクトルで表現する。 似た意味の単語はベクトル空間上で近い位置にある。 2023/05/19 12
ボードゲーム 左のマップは以下のように配列にできる [[-1, None,0, 1 ], [0, 0, 0, None],
[None,0, None,0 ], [0, 0, 0, 0 ]] 移動したら得られる点を表す。家のマスに移動したら1 点、炎のマスは1点減点、それ以外は0点。 引用【入門】Q学習の解説とpythonでの実装 〜シンプル な迷路問題を例に〜 2023/05/19 13
モデル作成の例 1. データセットの用意 2. 前準備 3. 学習と予測 2023/05/19 14
データセットの用意 質の良いデータを大量に用意する事は最も重要なことの一つです。 サイトからダウンロードする Kaggle や Dataset Search などで探せる ネット上でかき集める 画像投稿サイトで集めたり
自作 大量に用意する必要があるので大変。 外注 企業がやるやつ 2023/05/19 15
前準備 フレームワーク選び データの整形 データの分割 データローダーにかける ハイパーパラメータ設定 などなど 2023/05/19 16
学習と予測 学習が完了するまで待ち。 データの数やフレームワーク・ライブラリによって時間は変わる。 ノーパソだと数時間かかるものも珍しくない。 2023/05/19 17
シンプルな例で体験 Google Colab を使用 https://colab.research.google.com/ Python環境がすでに整っているのですぐに始められる。 GPUが使える。 無料で使えるが使用制限あり。 ソースコードとデータセットはgithubに用意してあるので、CodeからDownload ZIP
https://github.com/tasotaku/Machine_Learning_lec 2023/05/19 18
シンプルな例で体験 1. アップロードを選択 2. ipynbファイルをアップロード 3. ファイルを選択 4. csvファイルをアップロード 5.
上から実行 2023/05/19 19
強化学習 先ほど紹介したのは教師あり学習 強化学習とはエージェントと環境が相互にやり取りをす ることで学習する。 家のマスに移動するという行動をしたら、1点という報 酬をあたえる。こういった探索を行い、最も良い行動を 求める。 強化学習の場合、データセットは必要ない。代わりに環 境や報酬が必要。 2023/05/19
20
Deep Learninig 実用例 物体検知 画像生成 自動翻訳 チャットボット ボードゲーム ロボット制御 2023/05/19
21
物体検知 画像から物体の位置と種類を表示 引用 (https://pjreddie.com/darknet/yolo/) 2023/05/19 22
画像生成 引用(https://huggingface.co/stabilityai/stable-diffusion-2) テキストや文章から新たな画像を生成 stable-diffusionなど 2023/05/19 23
自動翻訳 翻訳してくれる。英語課題のお供。 Google翻訳、DeepLなど。 2023/05/19 24
チャットボット 人と自然な対話が可能。分かりやすく教えてもらったり、ソースコード書いてもらっ たりできる。 ChatGPTなど 2023/05/19 25
ボードゲーム チェスやオセロ、エアーホッケー、アクションゲームなど、人間と同じ強さで戦え る。 ロボット制御 アームで掴む、犬型ロボットが歩くなど。ロボットの行動はデータにしづらいので、 強化学習になる。物をつかめたらプラスの報酬を与えるなど。 2023/05/19 26
機械学習は万能か? 先週のatcoder A問題 https://atcoder.jp/contests/abc301/tasks/abc301_a 入力が整数と文字列、出力が文字。一応、機械学習で扱えるが... データセットを用意しなければならない。 手を抜くと精度が下がる。 前準備がいる。 場合によっては学習に時間がかかる。 正答率は100%にならない可能性がある。
手間がかかる上に不完全。普通に数行コードを書いた方がいい! 2023/05/19 27
おすすめの本 昨今のAIブームのおかげで機械学習の情報は沢山ある。 ネットで調べるなり本を借りるか買うかすれば困らないと思う。 ゼロから作るdeep learning 説明が丁寧で読みやすい。序盤にPythonの解説があるが基礎知識はあった方がいい。 AIの理論的な部分がメイン、実装するにはこの本だけでは不十分。(個人の意見) 2023/05/19 28
おわり 広ーく話させてもらいました。理論的な部分はほぼ飛ばしているので、本来は数学っ ぽい話があります。 機械学習の理解に役立ったのならうれしいです。 2023/05/19 29