Search
📅 Deadline: 18.12.2025 21:59
🏦 Points: 4
In this assignment, you are tasked with implementing a kernel Perceptron algorithm. The goal is to understand how the “kernel trick,” introduced in the Support Vector Machines lecture, can be used to create a non-linear classifier based on the simple Perceptron update rule. You can find the complete theoretical description of the assignment in the Assignment PDF (last update 2025-11-13 22:00; bug fix).
You are provided with a template containing the following files that you do not need to modify:
The template also includes the following file which you do need to modify:
Your objective is to complete the kernel_perceptron function in the main.py file. You can find the parts to complete by searching for #TODO in the python file.
#TODO
if (np.abs(score) < 1e-7): “update weights”
After completing your implementation, you can test your solution locally using the provided public test cases before submitting it to BRUTE.
You can validate your code by running the main script on the public instances:
python main.py test-cases/public/instances/instance_1.json --visualize
python main.py test-cases/public/instances/instance_2.json --visualize
python main.py test-cases/public/instances/instance_3.json
For all of these instances, a correct implementation should successfully separate the data and produce the following output:
--- Local Test --- Evaluating if the learned classifier correctly separates all training data... Training Accuracy: 100.00% ✅ Test PASSED: The model correctly classified all training points.