cs181-homework1
Spring 2021 Machine Learning (CS 181) Homework 1
Problem Topics
Solutions contained in the
personal-solutions
folder
- Optimizing for Kernel-Based Regression
- Kernels and K-Nearest Neighbors
- Deriving Linear Regression
- Linear Regression with Basis Functions
Code
Implementation contained in the
code
folder
problem1_4-Kernel-Loss-Function.py
- Referred to as
T1_P1.py
in the specifications - Calculates the loss with respect to three different kernels for the provided dataset
problem1_5-Gradient-Descent.py
- Optimizes a kernel-based regressor using gradient descent
problem2_1-kNearestNeighbors.py
- Referred to as
T1_P2.py
in the specifications - Plots and compares predictions from a kernel-based regressor and from a nearest neighbor-based regressor
problem4-OLS-with-Basis-Functions.py
- Referred to as
T1_P4.py
in the specifications - Plots data and ordinary least squares regression lines over multiple different basis functions
- Calculates the residual sum-of-squares error for each basis regression