Introduction
Oputimization is interror point method.
This post is written about Implementation.
I will write Theorem of kernel SVM in another post.
I will put when writing its post finished.
# I finished writing theorem of SVM.
Theorem of SVM part1
My computer is windows.
Also, OS is windows.
I implement by Python3.
Overview
- introduce kernel
- introduce dataset
- result of implementation
kernel
The kernel is the method of solving the nonlinear problem.kernel is map converting data so that linear can separate class of data.

⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓⇓↓

Converting data is expressed \(\phi(x)\).
\[\phi:x -> \phi(x)\]
but, kernel function is used \[K(x,y)=\phi(x)^T \phi(y)\] in SVM,
Because, SVM can cumpute only \(\phi(x)^T \phi\).
The famous kernel is RBF and polynomial.
- RBF
\[K(x,y) = \exp(-\gamma ||x-y||^2)\]
- polynomial
\[K(x,y) = (x^Ty+c)^p\]
Dataset
Today, I use following two data generated from normal distribution by np.random.randn.
and

The code making this dataset is upload in github.
code of making dataset
Implementation
I used RBF kernel.gamma is 0.5
Regularization coefficient is 50.

next, I use RBF kernel.
gamma is 0.5.
Regularization coefficient is 100.

My code is published github.
kernel SVM code
Reference
https://qiita.com/ta-ka/items/e6fd0b6fc46dbab4a651http://aidiary.hatenablog.com/entry/20100501/1272712699
https://www.amazon.co.jp/%E3%82%B5%E3%83%9D%E3%83%BC%E3%83%88%E3%83%99%E3%82%AF%E3%83%88%E3%83%AB%E3%83%9E%E3%82%B7%E3%83%B3-%E6%A9%9F%E6%A2%B0%E5%AD%A6%E7%BF%92%E3%83%97%E3%83%AD%E3%83%95%E3%82%A7%E3%83%83%E3%82%B7%E3%83%A7%E3%83%8A%E3%83%AB%E3%82%B7%E3%83%AA%E3%83%BC%E3%82%BA-%E7%AB%B9%E5%86%85-%E4%B8%80%E9%83%8E/dp/4061529064
コメント
コメントを投稿