# CS410 Homework 8: Neural Networks
==**Due Date: 4/6/2026 at 11:59pm**==
**Need help?** Remember to check out [Edstem](https://edstem.org/us/courses/93617) and our website for TA assistance.
:::danger
**⚠️ Battle Alert 🏆 ⚠️** You must activate the CS410 virtual environment every time you work on a CS410 assignment! You can find the activation instructions [here](https://hackmd.io/@cs410/BJvhqHXuR). If you forget to activate this virtual environment, you will almost certainly encounter import errors, and your code will not run.
:::

## Assignment Overview
Welcome to Homework 8! You'll start this assignment by building a `logistic regression` model, then learn how to calculate gradients automatically and explore neural networks using the `PyTorch` library, gaining hands-on experience with the deep learning pipeline. Here's what you'll learn and explore:
- Fundamentals of logistic regression
- Backpropagation with PyTorch
- Building basic neural networks with PyTorch
## Python Notebooks
A **Python notebook** is an application that allows users to combine text, code, and visualizations, much like a traditional scientific lab notebook.
This assignment is written in a Python notebook. In the file, we describe the tasks, and ask you to insert the code and run it to generate the requisite visualizations.
Your handin should include the Python notebook file--modified--as well as your README, as always.
### Instructions for Downloading and Setting Up [Jupyter](https://docs.jupyter.org/en/latest/install/notebook-classic.html) Notebook
To complete this assignment, you’ll need to have **Jupyter Notebook** installed on your computer. Follow the steps below based on your operating system (macOS or Windows).
#### Option 1: Jupyter via VSCode ####
1. In VSCode, activate your CS410 environment
```bash
source cs410_env/bin/activate
```
2. Install Jupyter Notebook by typing:
```bash
pip install notebook ipykernel
```
3. Install the Python and Jupyter Extension:
- Open VS Code.
- Go to the Extensions view (Ctrl+Shift+X / Cmd+Shift+X).
- Search for "Jupyter" and install the extension by Microsoft. Make sure "Python" is also installed
4. Open the folder/repo containing the stencil code. Be sure to select the environment as the Python Interpreter and select the kernel.
**Option 2: Launch Jupyter Notebook Browser:**
1. Open the **Terminal** (macOS) app or **Command Prompt** (Windows) and activate your environment (same command as above)
3. install Jupyter Notebook by typing:
```bash
pip install notebook
```
2. Launch Jupyter Notebook. Your browser will open with the Jupyter Notebook interface:
```bash
jupyter notebook
```
3. Once Jupyter Notebook launches, navigate to the folder where you cloned the GitHub repository.Click the file to open and start modifying the code.
:::info
**[WinError 126]:** If you run into this issue, try following the steps from [this YouTube video](https://www.youtube.com/watch?v=-ky896Qp1k8).
You may also have to downgrade Numpy, which you can do by running
`pip install "numpy<2.0"`
:::
## Downloads
This assignment will take place in a Python notebook file.
Please click [here](https://classroom.github.com/a/7E7J-HU1) to download the assignment code.
:::info
If you get a message "Running cells with 'cs410_env (Python 3.10.6)' requires the ipykernel package," please make sure you have installed the `ipykernel` package.
```
pip install notebook ipykernel
```
:::
## Handin
Your handin should contain:
- all modified files, including comments describing the logic of your algorithmic modifications
- a README containing:
- your responses to any conceptual questions
- known problems in your code
- anyone you worked with
- any outside resources used (eg. Stack Overflow, ChatGPT)
### Gradescope
Submit your assignment via Gradescope.
To submit through GitHub, follow these commands:
1. `git add -A`
2. `git commit -m "commit message"`
3. `git push`
Now, you are ready to upload your repo to Gradescope.
*Tip*: If you are having difficulties submitting through GitHub, you may submit by zipping up your hw folder.
## Rubric
| Component | Points | Notes |
|-------------------|------|--------------------------------|
| 1.1 Logistic Regression | 50 | Points awarded for correct implementation of `initialize_parameters`, `sigmoid`, `forward`, `predict`, `backward_propagation`, and `optimize`. |
| 1.2 Gradient Descent | 10 | Points awarded for correct implementation of gradient descent with logistic regression|
| MyMLP README Questions| 20 | Points awarded for responding to questions thoughtfully |
| MyMLP Implementation | 20 | Points awarded for meeting criteria, partial credit awarded for lower accuracies. |
:::success
Congrats on submitting your homework. We are proud of you!!
<p style="text-align: center;">
<img src="https://hackmd.io/_uploads/SkWBXC8SWl.jpg" alt="SunflowerHW8" />
</p>
:::