Module 1 Assignment: Baseline MLP design brief

Module 1 Assignment: Baseline MLP design brief#

Theme#

From neurons to multilayer networks

Exercises#

  1. Choose a tabular or vector classification problem and identify the input features and target classes.

  2. Specify an MLP architecture: input dimension, hidden layers, activations, output head, and loss.

  3. Run the starter experiment below with at least two hidden widths or activations.

  4. Explain what changed in training behavior and why the architecture is a reasonable baseline.

Submission#

Submit a 600-900 word technical memo plus any code, plots, or shape traces needed to support your claims. Use the starter cell as a minimum reproducible experiment, then make at least one meaningful modification.

Rubric#

  • Correct use of module vocabulary and notation

  • Clear connection between design choices and data/problem structure

  • Evidence from the starter experiment or your own extension

  • Concise reflection on limitations, failure modes, or next steps

import torch
from torch import nn

torch.manual_seed(1)
X = torch.randn(96, 4)
y = ((X[:, 0] - 0.5 * X[:, 1] + X[:, 2] ** 2) > 0.7).long()

model = nn.Sequential(nn.Linear(4, 12), nn.ReLU(), nn.Linear(12, 2))
loss_fn = nn.CrossEntropyLoss()
opt = torch.optim.Adam(model.parameters(), lr=0.03)

for epoch in range(80):
    opt.zero_grad()
    loss = loss_fn(model(X), y)
    loss.backward()
    opt.step()

with torch.no_grad():
    accuracy = (model(X).argmax(dim=1) == y).float().mean().item()

print(f"training accuracy: {accuracy:.3f}")
print("Change hidden width, activation, or learning rate, then compare results.")
training accuracy: 1.000
Change hidden width, activation, or learning rate, then compare results.

Reflection prompts#

  • What changed when you modified the starter experiment?

  • Which result surprised you, and what diagnostic would you run next?

  • What assumption would you document before handing this model to another practitioner?