联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2023-11-01 10:11

Homework 7: Linear Support Vector Machine (SVM)

Submit your assignments on Gradescope.

Please name your coding assignment as ‘HW7.py’.

Use the provided Python template file, and complete the functions ONLY. (DO NOT edit function

definitions, code outside the function, or use other libraries).

In this homework, you have been provided with the read_data(), get_df_shape(), data_split(), and

extract_features_label() functions to help you with your implementation.

The functions you will be graded on have detailed information on the starter code.

This homework is about the linear support vector machine covered in the Week 7 lecture. Please refer to

the lecture slides for more information about the implementation of the linear SVM.

This is a coding assignment.

You will be implementing the training function for the Linear SVM model.

We have separated the function into three individual test cases for extra guidance in your implementation

(cost(.), decision_function(.), margin(.) ).

Your code will be tested on,

1. Cost Function (25 Points)

The cost function implements Hinge loss and regularization term (w.w) as described in

W_7_M_SupportVectorMachine notes, slides 25-27.

2. Margin Function (25 Points)

Your margin function implementation will be evaluated by looking at the margin array in the fit function.

(slides 24)

You will be implementing the fit function, use the update rule given in W_7_W_SupportVectorMachines,

slides 24, Only update if misclassified (else part in the slides), which also means that points are in the

margin!

your code will be tested,

3. Predict Function (25 Points)

Implement your predict function using your decision function implementation.

4. Train Score (25 Points)

Implement the train score in the score() function.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp