Assignments
Throughout the course you will be implementing various ML algorithms. Namely, K-Nearest Neighbors, Perceptron, Logistic and Linear Regression, Support Vector Machine, Decision Tree, Deep Neural Network, Value Iteration. See below the implementation guidelines for each of the algorithms.
Instructions
Set up
All the assignments have been prepared on Google Colab. It is highly recommended that you use colab to avoid any further issues with dependencies. Instructions to install additional packages will be added to the notebooks as per assignment. For each assignment, please download the linked notebook and upload it to colab, to solve the assignment.
Help
Questions, comments, and clarifications regarding the assignments should NOT be sent via email to the course staff. Please use the discussion board on Campuswire (class code: 8512) instead.
Submission
When submitting programming assignments, upload the associated .ipynb file (Jupyter notebook) named by your UIN. For example: '123123123.ipynb'. Please do NOT upload the .py files. Each student must submit an individual unique solution. We will check for plagiarism using MOSS.
Written assignments are submitted in pairs. Each pair must submit a unique solution. We will check for plagiarism using Canvas built in plagiarism software. When submitting a written assignment, one of the students (not both) should upload a single PDF file containing your solution. The file name should be both students' UIN seperated by '_'. For example: '123123123_321321321.pdf'.
Students auditing the class (not registered) are NOT allowed to upload a submission.
Preliminaries (no need to submit answers just review)
Programming assignment 0: Python Warmup (due 1/25 11:59pm)
This assignment tests the basics of Python, NumPy, and Pandas. They are the bread and butter for implementing machine learning algorithms. Hence, it is expected that you should be able to complete this assignment without breaking a lot of sweat. The level of questions varies between easy and medium. So, in case you are unfamiliar with NumPy and Pandas, they should provide you with a nice platform to get up to speed.
This assignment can be downloaded from here: Intro to Python. Please use your @tamu.edu email to access the file. It is in the form of a Jupyter notebook. You can find more information on setting up and running Jupyter notebooks here. It consists of 15 coding questions covering the basics of Python, NumPy, and Pandas. You are required to complete the functions defined in the code blocks following each question. You only need to fill out sections of the code marked "YOUR CODE HERE". There are a few test cases defined for each question which you may use to verify your implementation. Do NOT modify these test cases since we will use them to grade your solutions. Once you've filled out your solutions, submit the notebook on Canvas (see the instructions on Submission) . Do NOT forget to type in your name and UIN at the beginning of the notebook.
Written assignment 0: K Nearest Neighbors + Linear algebra (due 2/1 11:59pm)
This assignment consists of 2 parts. Part 1 covers the basics of linear algebra and probability. Part 2 contains questions on the k-Nearest Neighbors algorithm.
The assignment can be downloaded from here: Written Assignment 1. It is a PDF file. There are blank spaces left out after each question for you to fill in your solutions. You are free to either use LaTeX (download the source .tex file here) or handwrite them as long as they are legible. Refer to the submission instructions for uploading your solutions to Canvas.
Programming Assignment 1: Perceptron (due 2/15 11:59pm)
In this assignment, you'll be coding up the perceptron algorithm from scratch. You are NOT allowed to use machine learning libraries such as scikit learn for this assignment.
The assignment can be downloaded here: Programming Assignment 1. Please follow the instructions in the notebook. Refer to the submission instructions for uploading your solutions to Canvas.
Written assignment 2: Generative models (due Monday, Feb. 21, 11:59pm)

Refer to the submission instructions for uploading your solutions to Canvas.
Programming Assignment 2: Linear and Logistic Regression (due 3/21 11:59pm)
In this assignment, you'll be coding up linear and logistic regression algorithms from scratch. You are NOT allowed to use machine learning libraries such as scikit learn for this assignment.
The assignment can be downloaded here: Programming Assignment 2. Please follow the instructions in the notebook. Refer to the submission instructions for uploading your solutions to Canvas.
Programming assignment 3: Support Vector Machines (due 4/14 11:59pm)
In this assignment, you'll be training support vector machines for classification.
The assignment can be downloaded here: Programming Assignment 3. Please follow the instructions in the notebook. Refer to the submission instructions for uploading your solutions to Canvas.
Programming assignment 4: Decision Trees (due 4/19 11:59pm)
In this assignment, you'll be coding up decision trees for classification and regression from scratch. You are NOT allowed to use machine learning libraries such as scikit learn for this assignment.
The assignment can be downloaded here: Programming Assignment 4. Please follow the instructions in the notebook. Refer to the submission instructions for uploading your solutions to Canvas.
Written assignment 3: Artificial Neural Network (due 5/2 11:59pm)
This assignment is based on neural networks, and also requires you to do some programming.
The assignment can be downloaded from here: Written Assignment 3. It is a PDF file. There are blank spaces left out after each question for you to fill in your solutions. You are free to either use LaTeX (download the source .tex file here) or handwrite them as long as they are legible.
The submission will be in two parts 1) The PDF File 2) The code. There are two open submissions on canvas. Refer to the submission instructions for uploading PDF file. To submit the code make a .zip file for the submissions (and use your uin1_uin2.zip as the filename) and upload it. Please place solution for each sub-question into a function. Note that, the code for this section will be for mainly testing plagarism, so no specific structure is required in code submission.
Programming assignment 5 + Competition: Deep Learning (due 5/4 11:59pm)
In this assignment + competition, you'll be coding up a convolutional neural network from scratch to classify images using PyTorch.
The assignment can be downloaded here: Programming Assignment 5. Refer to the submission instructions for uploading your code to Canvas. Submit your predictions on the competition page on kaggle (here). The team name (which would be 1 person) is visible to everyone, so you can choose to anonymize. Please submit your team name used in contest on canvas so that we can map your UIN to your username on kaggle. Late days cannot be used for this assignment.
Competition Rules
- The maximum number of parameters you are allowed to use in your network is 100,000. We will verify your submission on canvas with your final submission on kaggle. The accuracy should be equal.
- You will submit your predictions (code already provided) on kaggle's submission. During the competition you will see the public leaderboard. This is based on average accuracy of 50% of the dataset. After the end of competition you will see your score on other 50% percent of data (called as private leaderboard).
- Final rankings will be based on the test accuracy on the private leaderboard.
- The data distribution of the private test set is very similar to the training and test set provided to you. So, if your model performs well on the provided test set, there is a very high chance it will also perform well on the private test set (both on public and private leaderboard).
- This test set is different from the one provided in the assignment.
Competition Bonus
- Rank 1: 100 points (assignment) + 15 to final grade
- Rank 2: 100 points (assignment) + 10 to final grade
- Rank 3: 100 points (assignment) + 10 to final grade
- Rank 4-90: 100 points (assignment) + 0.0575 * (90 - rank) to final grade
- Rank 90+: 80 points (assignment) + 0.1 * (110 - rank) (assignment)