p.115 support vector machine (svm) supervised...

13
p.115 Support Vector Machine (SVM) 教師付き識別問題 Supervised Classification Neural network: tends to overfit due to the non-liner shape of classification curve ニューラルネットワークには過学習の問題がある SVMto avoid overfit by means of linear classification scheme -> to maximize the margin 識別面を線形化して過学習を避ける マージンを最大化する識別面を求める min 1 2 , + 0 ≥ 1 ( = 1,2, … ) Consider the distance between a point and a line ( = ±1)

Upload: others

Post on 10-Mar-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

p.115 Support Vector Machine (SVM)

○ 教師付き識別問題 Supervised Classification

○ Neural network: tends to overfit due to the

non-liner shape of classification curve

ニューラルネットワークには過学習の問題がある

○ SVM: to avoid overfit by means

of linear classification scheme

-> to maximize the margin

識別面を線形化して過学習を避ける

マージンを最大化する識別面を求める

min1

2𝒘 , 𝑦𝑖 𝒘 ∙ 𝒙𝒊 + 𝑤0 ≥ 1 (𝑖 = 1,2, …𝑁)

○ Consider the distance between a point and a line

(𝑦𝑖= ±1)

Page 2: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

Answer

The Lagrange function L is defined as

L(x, y, λ) = 2x+3y−λ(x2+y2−1)

The partial derivatives are as follows:

∂L/∂x = 2−2xλ = 0

∂L/∂y = 3−2yλ = 0

∂L/∂λ = −x2−y2+1 = 0

We eliminate λ from the 1st and 2nd equations.

x = 2y/3

Therefore, we obtain

(x, y)=(2, 3)/ 𝟏𝟑 or (x, y)=(− 2, − 3)/ 𝟏𝟑

Lagrangeの未定乗数法 Method of Lagrange multiplier

Question

Maximize f(x, y) = 2x+3y under the condition of x2+y2 = 1

x

y

O

2x+3y= 13

2x+3y= − 13

Page 3: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

p.118 Support Vector Machine (SVM)

𝐿 = 1

2𝒘 2 − 𝛼𝑖[

𝑁𝑖=1 𝑦𝑖 𝒘 ∙ 𝒙𝒊 + 𝑤0 − 1]

Find the minimum value of the following Lagrange function.

The partial derivatives of 𝐿 in terms of 𝑤0 and 𝒘 leads to

𝐿 𝜶 = 1

2𝒘 ∙ 𝒘 − 𝛼𝑖

𝑁𝑖=1

,

𝑦𝑖 = 1 positive case

𝑦𝑖 = −1 negative case

𝒘 = 𝛼𝑖𝑦𝑖𝒙𝒊 ,

𝑁

𝑖=1

𝛼𝑖𝑦𝑖 = 0

𝑁

𝑖=1

𝑤𝟎= −1

2(𝒘 ∙ 𝒙++ 𝒘 ∙ 𝒙−)

Here 𝒙+ and 𝒙− are support vectors.

Page 4: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

p.120 SVM with Kernel function

𝐿 𝜶 = 1

2𝒘 ∙ 𝒘 − 𝛼𝑖

𝑁𝑖=1

=1

2 𝛼𝑖𝛼𝑗𝑦𝑖𝑦𝑗(𝒙𝒊 ∙ 𝒙𝒋) − 𝛼𝑖

𝑁

𝑖=1

𝑁

𝑖=1

𝐿 𝜶 =1

2 𝛼𝑖𝛼𝑗𝑦𝑖𝑦𝑗𝐾(𝒙𝒊 , 𝒙𝒋) − 𝛼𝑖

𝑁

𝑖=1

𝑁

𝑖=1

Polynomial Kernel

𝐾(𝒙𝒊 , 𝒙𝒋) = 𝒙𝒊 ∙ 𝒙𝒋 + 1𝑝

Gaussian Kernel

𝐾(𝒙𝒊 , 𝒙𝒋) = exp −𝒙𝒊 − 𝒙𝒋

𝜎2

http://www.slideshare.net/ankitksharma/svm-37753690

Page 5: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

p.123 Weka Explorer/ SMO algorithm SMO = Sequential Minimal Optimization

(1) Preprocessor: read iris.arff

(2) Classify: classifier -> functions -> SMO

(3) Crick “SMO” -> Property

-> filter type “Normalize training data”;

kernel “PolyKernel” -> Crick PolyKernel “exponent =1”; OK

(4) Test options: Cross-validation 10-folds -> Start

=== Confusion Matrix ===

a b c <-- classified as

50 0 0 | a = Iris-setosa

0 49 1 | b = Iris-versicolor

0 5 45 | c = Iris-virginica

=== Summary ===

Correctly Classified

Instances 144 96 %

Incorrectly Classified

Instances 6 4 %

Kappa statistic 0.94

カッパ係数(kappa

coefficient) は、分割表による

解析などで利用される測定の一致度の指標

k < 0.2 slight agreement

0.21 - 0.4 fair

0.41 - 0.6 moderate

0.61 - 0.8 substantial

0.81 - 1 almost perfect

Page 6: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

p.123 Weka Explorer/ SMO algorithm SMO = Sequential Minimal Optimization

Q Apply SVM -SMO to diabetes.arff

Page 7: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

Fiji – ImageJ Trainable Weka Segmentation

○ https://fiji.sc/

○ Fiji is licensed under the GNU General Public License. It builds on top of the ImageJ2 core, which is licensed under the permissive BSD 2-clause license. Plugins and other components have their own licenses. ○ Fiji is developed by contributors around the world. It is maintained by Curtis Rueden and the ImageJ development team at the Laboratory for Optical and Computational Instrumentation (LOCI) at the University of Wisconsin-Madison.

○ The Fiji project is driven by a strong desire to improve the tools available for life sciences to process and analyze data.

Page 8: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

画像の向きの調整 image rotation Image>Transform> 画像の明るさ補正 brightness control Image>Adjust>Brightness/Contrast (Shift+C) or Color Balance RGB、グレースケール RGB and gray scale control Image>Color>Channels tool (Shift+Z) gray scale to RGB Image>Color>Merge Channels or Split Channels Merge Channels -> assign image to each color Create composite -> merged image is displayed Keep source images -> original image is preserved Ignore source LUTs -> new merged color is displayed Gray scale to rainbow color scale, etc. Image>Lookup Tables>Spectrum

Fiji – ImageJ Basic controls

Page 9: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン
Page 10: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

Weka analysis of imagery using Fiji platform

plugins > Segmentation > Trainable Weka Segmentation

Page 11: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

Segmentation into four classes

Page 12: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

https://www.tensorflow.org/ http://www.ossnews.jp/oss_info/TensorFlow

○ Tensor Flow (テンソルフロー) は、Googleの機械学習/ディープラーニング/多層ニューラルネットワークライブラリ。 ○ディープラーニングは、音声認識、検索エンジン(画像検索/ウェブ検索最適化) など、Googleのほとんどのサービスを支えるコア技術となっている。 ○コア部分はC++で実装され、ユーザ向けにPythonのインターフェースがある。 「Apache 2.0ライセンス」に従うことを条件として、ソースコードの改変と公開が許可されている。

○マイクロソフト社はこのプロジェクト用のウェブサイトで「テンソルフローはまだ完成していない。無償公開はさらなる積み重ねや改善、適用範囲の拡大を目的としている」と説明している。

Page 13: p.115 Support Vector Machine (SVM) Supervised …kuze-lab/RS2016/Weka_Lecture_Slides...RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

○ RapidMiner(前名称;YALE)は、機械学習、データマイニング、テキストマイニン

グ、特徴選択、予測分析、経営分析などを扱うソフトウェア及びその開発元会社である。 ○ 研究や教育や産業分野、ラピッドプロトタイピングやソフトウェア開発の場で利用されている。 ○ Weka の学習ルーチンに,前処理・可視化の部分を強化したYaleが,Rapid-I 社がオープンソースで開発している RapidMiner になった。現在は社名も RapidMiner になっている。 ○ Community Edition は無料のオープンソース (5.x)。 ○ 6.x 移行は機能制限版で無償のStarter版と,有償のものとがある。無償版は読めるファイルが CSV/Excel のみに限定。

https://rapidminer.com/ http://ibisforest.org/index.php?RapidMiner