Python代写 | Introduction to Statistical Machine Learning

本次Python代写是实现SVM

Introduction to Statistical Machine Learning

Coding
• Please implement soft margin binary class linear SVMs by:
− Solving the primal problem:
min
w,b,ξ
kwk
2
2 + C ·
1
n
Xn
i=1
ξi
s.t. yi(w
T
xi + b) ≥ 1 − ξi
ξi ≥ 0, i = 1, …, n
(1)
− Solving the dual problem:
max
α
Xn
i=1
αi −
1
2
Xn
i=1
Xn
j=1
αiαjyiyjx
T
i xj
s.t.
Xn
i=1
αiyi = 0
0 ≤ αi ≤ C, i = 1, …, n
(2)
Your code should strictly implement the functions that are in the form of the prototypes
below. Otherwise you may not get marks even if your experiment results are correct.
Other necessary functions such as data IO, plotting, analysis of results etc. and anything else can be in
any form.
1
2
3 # train your svm in the primal
4 svm_model = svm_train_primal ( data_train , label_train , regularisation_para_C )
5
6 # test on your test data
7 test_accuracy = svm_predict_primal ( data_test , label_test , svm_model )
8
9 # …
10
11 # train your svm in the dual
12 svm_model_d = svm_train_dual ( data_train , label_train , regularisation_para_C )
13
14 # test on your test data
15 test_accuracy_d = svm_predict_dual ( data_test , label_test , svm_model_d )
NB: ‘regularisation para C’ is the hyper-parameter C in the above two equations and typically need to
be determinted by cross-validation if you want to achieve good accuracy on test data.
Examples that do not follow the coding requirement:
a) Input and output arguments are not the same as above prototypes, such as:
… … svm train primal( data train , label train , regularisation para C, kernel para )
b) Implement SVM as a CLASS. Do not implement SVM as a CLASS!


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论