需要关于此作业的帮助?欢迎联系我

Homework 2: Kernel Features & Model Combinations

Introduction In this homework we first take a closer look at feature maps induced by kernels. We then explore a creative use of the gradient descent method introduced in homework 1. We will show that gradient descent techniques can be used to construct combinations of models from a base set of models such that the combination can outperform any single base model.

Points Allocation There are a total of 28 marks.

  • Question 1 a): 3 marks
  • Question 1 b): 1 mark
  • Question 1 c): 2 marks
  • Question 1 d): 2 marks
  • Question 1 e): 5 marks
  • Question 1 f): 4 marks
  • Question 1 g): 1 mark
  • Question 1 h): 2 marks
  • Question 1 i): 4 marks
  • Question 2 a): 1 mark
  • Question 2 b): 1 mark
  • Question 2 c): 1 mark
  • Question 2 d): 1 mark

What to Submit

  • A single PDF file which contains solutions to each question. For each question, provide your solution in the form of text and requested plots. For some questions you will be requested to provide screen shots of code used to generate your answer— only include these when they are explicitly asked for.
  • .py file(s) containing all code you used for the project, which should be provided in a separate .zip file. This code must match the code provided in the report.
  • You may be deducted points for not following these instructions.
  • You may be deducted points for poorly presented/formatted work. Please be neat and make your solutions clear. Start each question on a new page if necessary.
  • You cannot submit a Jupyter notebook; this will receive a mark of zero. This does not stop you from developing your code in a notebook and then copying it into a .py file though, or using a tool such as nbconvert or similar.
  • We will set up a Moodle forum for questions about this homework. Please read the existing questions before posting new questions. Please do some basic research online before posting questions. Please only post clarification questions. Any questions deemed to be fishing for answers will be ignored and/or deleted.
  • Please check Moodle announcements for updates to this spec. It is your responsibility to check for announcements about the spec.
  • Please complete your homework on your own, do not discuss your solution with other people in the course. General discussion of the problems is fine, but you must write out your own solution and acknowledge if you discussed any of the problems in your submission (including their name(s) and zID).
  • As usual, we monitor all online forums such as Chegg, StackExchange, etc. Posting homework questions on these site is equivalent to plagiarism and will result in a case of academic misconduct.
  • You may not use SymPy or any other symbolic programming toolkits to answer the derivation questions. This will result in an automatic grade of zero for the relevant question. You must do the derivations manually.

When and Where to Submit

  • Due date: Week 4, Monday March 6th, 2023 by 5pm. Please note that the forum will not be actively monitored on weekends.
  • Late submissions will incur a penalty of 5% per day from the maximum achievable grade. For example, if you achieve a grade of 80/100 but you submitted 3 days late, then your final grade will be 80 􀀀 3 5 = 65. Submissions that are more than 5 days late will receive a mark of zero.
  • Submission must be made on Moodle, no exceptions.

Question 1. Kernel Power

Consider the following 2-dimensional data-set, where y denotes the class of each point.

indexx1x2y
110-1
201-1
30-1-1
4-10+1
502+1
60-2+1
7-20+1

Throughout this question, you may use any desired packages to answer the questions

(a) Use the transformation, What is the equation of the best separating hyper-plane in the new feature space? Provide a plot with the data set and hyperplane clearly shown.

What to submit: a single plot, the equation of the separating hyperplane, a screen shot of your code, a copy of your code in your .py file for this question.

(b) Fit a hard margin linear SVM to the transformed data-set in the previous part1. What are the estimated values of . Based on this, which points are the support vectors? What error does your computed SVM achieve? What to submit: the indices of your identified support vectors, the train error of your SVM, the computed (rounded to 3 d.p.), a screen shot of your code, a copy of your code in your .py file for this question.

(c) Consider now the kernel Run a hard-margin kernel SVM on the original (untransformed) data given in the table at the start of the question. What are the estimated values of . Based on this, which points are the support vectors? What error does your computed SVM achieve?

Question 2. Gradient Descent for Learning Combinations of Models**

In this question, we discuss and implement a gradient descent based algorithm for learning combinations of models, which are generally termed ’ensemble models’. The gradient descent idea is a very powerful one that has been used in a large number of creative ways in machine learning beyond direct minimization of loss functions as in the previous question. The Gradient-Combination (GC) algorithm can be described as follows: Let F be a set of base learning algorithms2. The idea is to combine the base learners in F in an optimal way to end up with a good learning algorithm. Let `(y; ^y) be a loss function, where y is the target, and ^y is the predicted value.3 Suppose we have data (xi; yi) for i = 1; : : : ; n, which we collect into a single data set D0. We then set the number of desired base learners to T and proceed as follows:

.