SlideShare a Scribd company logo
1 of 19
Download to read offline
Kamujun
Coursera Machine Learning
Week 1
• Introduction
• Model and Cost Function
• Parameter Learning
• Linear Algebra Review


→線形代数は質疑応答のみ行います
目次
• 「機械学習」を定義する要素
• Task


課題。計算機に解かせたい問題。(スパムメールの分類)
• Performance


性能。課題をどれだけうまく解決できているかの指標。(正常/スパムメ
ールと予測した正解率)
• Experience


経験。課題をより性能良く解決できるよう改善させるために用いる情
報。(ユーザーが付与したスパムメールのラベル)
What is Machine Learning
Introduction
定義の一例であるため人によって呼び方が微妙に異なることがあるが
概ね上記のような要素を含む
• 教師あり学習
• アルゴリズムに「正しいデータセット」を与えることによって、


学習を行う
• Housing price prediction(住宅価格予測)


敷地面積を用いて住宅価格を予測。回帰問題。


• Breast Cancer(乳がん予測)


腫瘍のサイズ、年齢を用いて良性or悪性を予測。分類問題。
Supervised Learning
Introduction
https://coursera.org/share/bb93a185f69119d28abe0433620b26e1
• 教師なし学習
• 単一ラベルであるものやラベル付けがそもそもない情報を用いて


学習を行う
• Google news(関連ニュース)


油田に関するニュースを関連付け。


• ゲノムデータ解析


似たようなゲノム配列を持つ人のグループ分け
Unsupervised Learning
Introduction
https://coursera.org/share/eb54d573083d68a2033ef028bb9a5fee
• Training set


学習データセットの見方(住宅価格予測の例)
• :学習データ数
• :入力変数/特徴量(説明変数)
• :出力変数/目的変数


m
x(i)
y(i)
Model Representation
Model and Cost Function
https://coursera.org/share/fe2222d85641c89b210f965e2939c6db
• モデル


学習アルゴリズム(LearningAlgorithm)に学習データセット(Training
Set)を与え、学習済みのモデル(h)を得る。


学習済みモデルを用いて未知のデータ(ここではSize of house)を与えるこ
とでの予測値(Estimated price)を算出する。


Model Representation
Model and Cost Function
https://coursera.org/share/fe2222d85641c89b210f965e2939c6db
• 仮説関数(Hypothesis)


データを収まりよく説明できるとする関数


→最終的にはこの関数が欲しい( 学習済みモデル)
• :仮説関数
• :パラメータ


 仮説関数を調整するための値。
hθ(x)
θi
Cost Function
Model and Cost Function
https://coursera.org/share/981c0cdaafe933a912d628982b77ead4
• 学習とは


与えられた学習データ全てをうまく説明できるように仮説関数のパラメー
タを選択する処理。この処理を学習と呼ぶ。
• 目的関数(Cost Function)


仮説関数がうまく学習できているかは「目的関数(誤差関数)」を用いて
確認する。仮説関数から学習データがどれくらい離れているかで計算する
ことが多い。


例:線形回帰の目的関数として以下の平均二乗誤差関数を利用


 ※後の計算しやすいよう2mにしている


  J(θ0, θ1) =
1
2m
m
∑
i=1
(hθ(xi) − yi)2
Cost Function
Model and Cost Function
https://coursera.org/share/981c0cdaafe933a912d628982b77ead4
どのように学習するのかを理解するために簡略化して考える。


具体的には仮説関数にパラメータθは2つあるが、 を0とすることで説明変
数を減らす。


学習のゴールは目的関数 をできるだけ小さくすることである。


これは学習データをなるべくうまく説明できる仮説関数のパラメータを探す
ことと同じである。


θ0
J(θ1)
Intuition Ⅰ
Model and Cost Function
https://coursera.org/share/ca1b
ff
16540cbeee4e7eb5
ff
fd80d73e
仮説関数 に対して を変えていきながら目的関数がどのように変化するの
か確認したのが以下の図。 の値を変えていってみると、 の際に最も目
的関数が小さくなることがわかる。つまり学習データを最もうまく説明でき
る仮説関数のパラメータは であると分かる。


hθ(x) θ1
θ1 θ1 = 1
θ1 = 1
Intuition Ⅰ
Model and Cost Function
https://coursera.org/share/ca1b
ff
16540cbeee4e7eb5
ff
fd80d73e
簡略化するために除外していた を元に戻して考える。パラメータ2つを考慮
する必要があるため目的関数は3次元的になり、目的関数として最も小さい値
を取るパラメータの組み合わせを選ぶことを目指す。


θ0
Intuition Ⅱ
Model and Cost Function
https://coursera.org/share/567d55fde51565cb0279c92e7362cbaf
• 最急降下法(勾配降下法)


関数を最小化する地点を導き出すアルゴリズム。線形回帰以外でも用いら
れる。相対的に小さくなる地点は複数存在する可能性があり、局所最適解
と呼ばれる。最急降下法は実行条件によって異なる局所最適解に落ち着く可
能性がある。


Gradient Descent
Parameter Learning
https://coursera.org/share/1248d38717788f29e2f0dbf8d6bb494b
• 最急降下法のアルゴリズム


目的関数を偏微分(パラメータごとに微分)し、学習率(Learning Late)
で乗算したもの(右辺の右項)を以前のパラメータ(右辺の左項)から引いた
ものを新しいパラメータ(左辺)とする。パラメータが収束するまでこの処
理を繰り返すことで最適のパラメータを探索する。
Gradient Descent
Parameter Learning
https://coursera.org/share/1248d38717788f29e2f0dbf8d6bb494b
• 微分と学習率


理解のためにパラメータを1つにして考える。目的関数 の微分をグラフ
で確認すると接線の傾きを求めることに等しいことが分かる。


傾きは正負どちらの値も取る可能性があある。この接線の傾きと学習率を
かけてパラメータを更新することになる。傾きが正の場合は左に更新、負
の場合は右に更新することになる。
J(θ1)
Gradient Descent
Parameter Learning
https://coursera.org/share/1248d38717788f29e2f0dbf8d6bb494b
• 学習率の大きさについて


学習率の設定次第でパラメータ更新に影響を及ぼす。


学習率が小さすぎる場合はパラメータの更新量が かになり、局所最適解
にたどり着くまで多くの計算が必要になる。


逆に学習率が大きすぎる場合、局所最適解と飛び越すようなパラメータを更
新を行ってしまい、パラメータが収束しなくなる。


Gradient Descent
Parameter Learning
https://coursera.org/share/1248d38717788f29e2f0dbf8d6bb494b
• 学習率のと収束について


局所最適解に落ち着いたか(収束したか)は微分した結果(傾き)が0であ
るかで判斷できる。


収束させるにあたって学習率を逐次変更する必要はない。理由としては局所
最適解に近づくにつれて傾きは緩やかになり、パラメータの更新量は小さ
くなっていくためである。


Gradient Descent
Parameter Learning
https://coursera.org/share/1248d38717788f29e2f0dbf8d6bb494b
• 線形回帰における最急降下法


線形回帰の目的関数はいつも弓形の関数(凸関数:convex)となる。凸関数
の場合は唯一の最適解を持つ。


Gradient Descent For Linear Regression
Parameter Learning
https://coursera.org/share/1248d38717788f29e2f0dbf8d6bb494b
• バッチ法


これまで見てきたのはデータセット全体を対象としてきた方法である。各
データに対する傾きと学習率の積を算出し、その和をパラメータ更新量とし
ている。この方法をバッチ法(を用いた最急降下法)と呼ぶ。


この方法はとても計算コストが高いため、計算対象のデータ数を小さして
更新を行うミニバッチ法などある。


Gradient Descent For Linear Regression
Parameter Learning
https://coursera.org/share/1248d38717788f29e2f0dbf8d6bb494b

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Coursera Machine Learning week1