Docsity

Machine learning for bioengineering, Appunti di Machine learning

Anteprima parziale del testo

Scarica Machine learning for bioengineering e più Appunti in PDF di Machine learning solo su Docsity!

Applied Machine Learning in

Biomedicine

Enrico Grisan

[email protected]

Binary classification

  • Limited number of training data
  • Learning algorithms
  • Generalization

𝐷

A simple linear classifier

?

−

− {𝑖:𝑦𝑖=− 1 }

=

{𝑖:𝑦𝑖=+ 1 }

  • 𝒄 − 𝒄 − 𝒄

𝒘 = 𝒄

− 𝒄 −

A simple linear classifier

?

−

− {𝑖:𝑦𝑖=− 1 }

=

{𝑖:𝑦𝑖=+ 1 }

  • 𝒄 − 𝒄 − 𝒄

𝒘 = 𝒄

− 𝒄 − Classify points according to which of the two class means 𝒄

or 𝒄 − is closer For 𝒙 ∈ 𝒳 take the sign of inner product between 𝒘 and 𝒙 − 𝒄 If ℎ 𝒙 = 𝒘, 𝒙 − 𝒄 , the classifier is 𝑓 𝒙 = 𝑠𝑖𝑔𝑛(ℎ(𝒙))

Nonlinearly separable

Choose a nonlinear mapping: 𝜑: 𝒳 → ℋ 𝒙 ↦ 𝜑(𝒙) 𝜑 input space 𝒳 features space ℋ

Transformation: polar

𝜑 𝒙 : 𝑥, 𝑦 → [𝑟, 𝜗]

The kernel trick

𝜑 input space 𝒳 features space ℋ ℎ 𝑥 = 𝑖= 1 ,…,𝑛

Mercer Kernels

The kernel trick can be applied when:

𝑘: 𝒳x𝒳 → ℝ

𝜑 input space 𝒳 features space ℋ input space 𝒳

Feature mapping, how?

𝜑 𝒙 = sin 𝑥 2 , exp 𝑥 1 + 𝑥 2 , 𝑥 1 , 𝑥 2 tan(𝑥 1 ) , … 𝑘 𝒙𝑖, 𝒙𝑗 = 𝜑 𝒙𝑖 , 𝜑(𝒙𝑗) Random feature map: 𝑘 𝒙𝑖, 𝒙𝑗 = 𝑒 (− 𝒙𝑖−𝒙𝑗 2 ) If we consider a kernel: Does it exist a map 𝜑 𝒙?

Building a mapping

Given a kernel 𝑘: 𝒳x𝒳 → ℝ and a finite set 𝒳 =

Evaluate the gramian matrix 𝑮 ∈ ℝ

𝑛x𝑛

𝑖𝑗

𝑖

𝑗

Decompose 𝑮 = 𝑼𝜦𝑼

𝑇

Obtain the mapping: 𝜑(𝒙𝑖) = Λ

1 / 2

Radial basis function kernels

− 𝒖−𝒗 2 2 𝜎 2 𝜎 2 ∈ ℝ

Linear classifier:which line?

Computing the margin

M=margin width 𝒘 𝑇 𝒙

  • 𝑏 = + 1 𝒘 𝑇 𝒙 −
  • 𝑏 = − 1 𝑀 =

𝑇 𝒘

Maximize the margin M=minimize 𝒘

𝑇

Hard margin linear SVM

Primal problem

min 𝑤,𝑏

2 𝑠. 𝑡.

𝑇 𝑥𝑖 + 𝑏 > + 1 𝑦𝑖 = 1 𝑤 𝑇 𝑥𝑖 + 𝑏 ≤ − 1 otherwise

Lagrange multipliers

min 𝑤,𝑏 max 𝜶≥𝟎

2 − 𝑖= 1 𝑛 𝛼𝑖 𝑦𝑖 𝒘 𝑇 𝒙𝑖 + 𝑏 − 1