Lab 00 - AI
Learning goals
For this lab, we will ensure that students have a proper setup for using AI throughout the course and do a little experimentation with different AI tools and techniques. Particularly:
- Setup: Install VS Code and the Codex, Claude, and Antigravity extensions.
- Solve a simple programming problem using AI assistance using different approaches.
Tasks
For each one of the tasks, and for the learning of all students, ensure to keep a record of the prompts used and the responses received.
Setup (30 minutes)
We will start by creating an empty folder we will be using during the semester. This folder will contain all the code that will be submitted to our assignments.
- Install VS Code in your computer.
- Install the Codex, Claude, and Antigravity extensions and login.
- Create an
AGENTS.mdfile with the following content:
# Overview
This folder contains all the code that I will be using during the Advanced Programming with R and CHPC class at the University of Utah. Most of the AI assistance that I will need will be used for improving my coding skills; this means that we need to avoid generating full solutions unless explicitly instructed to do so.
# Assistance modes
The project requires different types of AI assistance. Here are the specific use cases:
- **Effectiveness**: Ensure the code that I generate is effective resolving the task that it was built for. If I fail to specify the requirements clearly, I will need to ask for clarification.
- **Style**: Maintain a consistent and readable coding style throughout the project. This also includes featuring proper documentation, including: inline comments and `roxygen2` documentation.
- **Efficiency**: Optimize the code for performance and resource usage, ensuring that it runs efficiently under typical usage scenarios.
Generally, agents should avoid generating full solutions unless explicitly instructed to do so.Task 1: Implement a simple GLM for the logit (10 minutes)
The logit log likelihood is
\[ \ell(\beta) = \sum_{i=1}^n \left[ y_i \log(p_i) + (1-y_i) \log(1-p_i) \right], \quad p_i = \frac{1}{1 + \exp(-x_i^\top \beta)} \]
Implement a function in R that fits a logit model using MLE. You can use the optim function in R to perform the optimization. Let’s avoid any AI use for this.
Task 2: Experiment with different AI tools (20 minutes)
Give it a go with the Codex, Claude, and Antigravity extensions, and ask them to implement the model in R. Each should save the results in a separate file.
Task 3: Planning mode (10 minutes)
Now, instead of generating full solutions, we will focus on planning and outlining the steps needed to implement the logit model using AI assistance. Pick one of the AI tools (hopefully different from your peers), and ask it to help you plan the implementation; use one of the more advanced AI models for this task. Once the plan is done, use a simpler AI model to execute the plan.