Homework 09
Before you begin
Homework 09 contains two questions on SVM kernel selection and an SVM analysis skill. It is evaluated as Complete or Incomplete. Use either R or Python. You are not expected to use both languages.
For Question 1, attempt the analysis before asking an AI tool for help. In Question 2, write the skill yourself, then use AI to apply it. You are responsible for checking the results.
Download the materials
The kernel-tuning question moved here from Homework 08. A solution for Question 1 is included in the combined ZIP. No solution will be provided for Question 2.
Question 1: Choosing an SVM kernel
Use saheart.csv from the combined ZIP. As in Homework 7, predict chd using the same nine predictors, coding famhist as 1 for Absent and 2 for Present.
Compare SVMs with a linear kernel, polynomial kernels of degrees 2 (quadratic), 3, and 4, and a radial basis kernel. Choose no more than 20 candidate settings in total across these kernels. Vary the cost for each kernel and the radial scale for the radial kernel. State any other kernel settings you hold fixed.
Divide the observations into five folds yourself and use the same folds for all candidates. Standardize predictors using only the fitting observations in each fold. Report the candidate settings and their mean cross-validation misclassification rates. Which kernel and settings do you prefer? Give a brief justification.
Question 2: Write and use a short SVM analysis skill
In Homework 8, you reviewed another student’s skill. Review the comments and suggestions you received on your own Homework 7 skill. Use what you learned from both sides of the peer review to write a new, shorter skill for SVM model fitting.
Write the skill by hand. Create a SKILL.md with a short name and description in YAML frontmatter. Write the entire file yourself, without asking AI to draft or edit it. The instruction body after the closing --- of the frontmatter must be no more than 50 lines, including blank lines. Keep the skill independent of any particular dataset, variable names, or observed results, and load it only when you explicitly invoke it.
Your skill should direct the agent to:
- judge whether the data are suitable for an SVM analysis;
- choose which kernels to consider and explain why;
- identify tuning parameters and a method for tuning them;
- choose an evaluation method that supports selecting a final model;
- require a compact figure and table that justify the choices;
- interpret the fit and report the key numerical results; and
- prioritize the evidence needed to justify the final model in no more than one printed page at 11-point font.
Apply the skill. Explicitly invoke your skill to analyze saheart.csv, using the same response, nine predictors, and famhist coding as in Question 1. Provide these data details when invoking the skill, not in the skill itself. Let the skill guide the analysis, then check the resulting report and calculations.
Submit the results. Include the one-page, 11-point analysis report in your Homework 09 submission and append the complete contents of your SKILL.md afterward. The appended skill is outside the one-page limit.