Rewrite lab with BoW

This commit is contained in:
Chris Proctor
2026-06-07 08:55:58 -04:00
parent aaf5b17ad8
commit feeae0352b
4 changed files with 84 additions and 59 deletions

View File

@@ -44,25 +44,9 @@
---
## Checkpoint 3: Data Cleaning
## Checkpoint 3: Designing Features by Hand
**8. Which transformers did you add to the pipeline, and in what order?**
*Your answer:*
**9. Did any transformer hurt performance? Why might cleaning sometimes make things worse?**
*Your answer:*
**10. If you removed the lowercasing from your `predict_one` method now that the pipeline handles it, would your results change?**
*Your answer:*
---
## Checkpoint 4: Feature Engineering
**11. List all the features you implemented and the reasoning behind each:**
**8. List all the features you implemented and the reasoning behind each:**
| Feature name | What it measures | Reasoning |
|-------------|-----------------|-----------|
@@ -70,7 +54,7 @@
| | | |
| | | |
**12. Record your best results:**
**9. Record your best results:**
| Metric | Value |
|--------|-------|
@@ -78,11 +62,35 @@
| Spam recall | |
| Spam F1 | |
**13. Which features received the largest positive weights (most predictive of spam)?**
**10. Which features received the largest positive weights (most predictive of spam)? The largest negative weights (predictive of ham)? Does this match your expectations?**
*Your answer:*
**14. Which features received near-zero weights? Why might the model have ignored them?**
**11. Did any feature you thought would help receive a near-zero weight? Why might the model have decided it was unimportant?**
*Your answer:*
---
## Checkpoint 4: Bag of Words
**12. Which transformers did you include in your cleaning pipeline, and in what order? Explain how each one changes the vocabulary.**
*Your answer:*
**13. Record your best results:**
| Metric | Value |
|--------|-------|
| Spam precision | |
| Spam recall | |
| Spam F1 | |
**14. How did the bag-of-words classifier's performance compare to your best hand-designed-features classifier? What do you think accounts for the difference?**
*Your answer:*
**15. Look at the words with the strongest weights (in either direction). Do any surprise you? What do they suggest about how the model is making its decisions?**
*Your answer:*
@@ -90,7 +98,7 @@
## Final Questions
**15. Pick a different classification problem (for example: positive vs. negative movie reviews,
**16. Pick a different classification problem (for example: positive vs. negative movie reviews,
news articles vs. opinion pieces, or medical vs. general-audience text).
Propose five features you would extract to classify it, and explain your reasoning.**
@@ -104,17 +112,11 @@ Problem I chose:
| | | |
| | | |
**16. Could adding more features ever *hurt* the performance of a classifier? Explain
**17. Could adding more features ever *hurt* the performance of a classifier? Explain
when and why this might happen.**
*Your answer:*
**17. It would be possible to make every word in the vocabulary a feature, where each
feature indicates whether that word appears in the message. Explain how this could
be implemented. Do you think it would work well? What are the trade-offs?**
*Your answer:*
**18. In this lab you split the data into 70% training and 30% testing. What would happen
if you used 99% for training and 1% for testing? What about 1% for training and 99%
for testing?**