
Homework 5
Machine Learning, LLMs, Agents, and Data Storytelling
Instructions
This homework focuses on AI judgment in DANL, using Lecture 10, its web reading, Co-Intelligence (Introduction and Chapters 1–3), and Co-Existence (Introduction and Chapters 1 and 4). Use the assigned books or course-provided excerpts. Classwork 18 develops the data-story workflow—question, background expectation, checked summaries, visualization, and review-text check—and explains the sentiment method used here. Homework 5 applies that method to a separate car-repair sample.
Answer all 18 questions, worth 100 points:
- Questions 1–12 and 18: multiple choice, 70 points.
- Questions 13–17: one R-code blank each, 30 points.
AI concepts and judgment account for 70 points, with 30 points for the R application. Choose the one best MCQ answer. For an R blank, enter only the code replacing [?]. Run the setup once; each coding question can then be completed independently. Test your code in an R script.
Six concept questions draw from Lecture 10’s sections on AI and Machine Learning, Large Language Models, and Agentic AI and Alignment.
Due: Monday, December 7, 2026, at 11:59 PM Eastern Time.
Attempts and submission: Follow the Homework 5 item in Brightspace. Submit your MCQ choices and R-blank answers; no written reflection or AI transcript is required.
You may use the course Data Storytelling Agent for explanations, code suggestions, and debugging. Run and check R yourself, and choose your own answers. Either version linked in Classwork 18 may be used. Agent use is optional for this homework. Use only the public course data; omit reviewer names and profile links.
Part I: AI Concepts and Data Judgment
Question 1
5 points
An analyst proposes using the course’s car-repair place data to estimate a place’s overall rating from its recorded characteristics. Which training data would make this a supervised-learning task? No model is trained in this homework.
- Only the input characteristics, with the model asked to discover groups and no rating outcomes.
- Input characteristics paired with each training place’s recorded numeric
rating. - Only the model’s own estimated ratings, with no recorded ratings to compare against.
- Search-region names alone, with no place-level rating values.
Question 2
5 points
Suppose the Data Storytelling Agent writes a fluent paragraph about the star_summary table. Which description of the LLM’s generation and the evidence is accurate?
- Fluency shows the
star_summaryvalues were computed in R. - Each token depends only on the immediately preceding word, without the rest of the prompt or context.
- The response automatically updates the model’s weights for future users.
- The LLM repeatedly selects next tokens using learned patterns and available context; numerical claims still need comparison with R output.
Question 3
5 points
In a long Classwork 18 conversation, the agent stops using the six named restaurant types and suggests another category. Which response best follows Lecture 10’s discussion of the context window?
- Provide a concise updated brief with the six exact types, what one row represents, and R-checked counts; earlier details may be absent from current context or overlooked.
- Assume the old message remains fully available and keep asking the same question.
- Give the agent an expert title to enlarge its context window.
- Treat the mistake as proof that the model’s trained weights changed during the chat.
Question 4
5 points
Which brief best fits the actual car-repair review analysis in this homework and the Classwork 18 data-story workflow?
- “Find the best repair shops. Choose the data definitions and exclusions that make the ranking convincing.”
- “Act as a famous data scientist. Give confident conclusions before requesting the data or checking its rows.”
- “Read all my course notes. Make a long report; decide for yourself what counts as a completed analysis.”
- “Use the supplied car-repair cohort and selected reviews. State the place and review row meanings, compare text scores with individual stars, identify cases to read in full, and return code and checks I can run.”
Question 5
5 points
The supplied setup excludes missing or blank review text. Which additional choice best respects the alignment discussion in the assigned reading?
- Also remove negative text scores whenever their presence weakens the final story.
- Keep positive, zero, and negative scores under the stated rules, disclose exclusions, and check whether the conclusion follows from the retained evidence.
- Keep only five-star reviews because the assignment concerns local-business recommendations.
- Choose a desired average score first, then adjust the exclusions until the report reaches it.
Question 6
5 points
Lecture 10 describes a 2026 test in which agents expected to work alone used an unauthorized message board and sought information about test grading at Hugging Face. Which lesson about agentic AI and alignment fits this case?
- An assigned goal makes any shortcut acceptable if it improves the score.
- The actions were within scope because the final result could still be checked.
- Goals and acceptable means both matter; tools and safeguards must keep agents within the permitted scope, with human review.
- The issue was only an inaccurate final answer, not the agents’ unauthorized actions.
Question 7
5 points
Which practice best applies the four rules from Co-Intelligence to DANL work?
- Explore permitted uses, retain responsibility and checks, use roles thoughtfully, and retest relevant tasks as tools change.
- Delegate whenever AI is available, treat an expert role as expertise, and adopt newer tools without repeating checks.
- Explore AI only after learning every feature, inspect wording alone, and keep the same capability assumptions throughout the course.
- Use AI even when an assignment prohibits it, because inviting AI takes priority over task instructions.
Question 8
5 points
The repair_ratings data already include each place’s metro label. An analyst instead wants to find groups of places with similar recorded rating and user_rating_count patterns without preassigned group labels. Which statement fits this proposed analysis?
- Filtering by the existing
metrolabels is the same as discovering groups from rating patterns. - Because the two inputs are numeric, the task must be supervised learning.
- Clustering can form groups from similarities in these measures; the analyst must then interpret whether the groups are useful.
- The resulting groups would be the places’ verified service-quality categories.
Question 9
5 points
The tool-enabled coding agent illustrated in Lecture 10 can inspect files, edit a script, and run checks when it has access. Its R check fails. Which response follows the agentic workflow and keeps the human responsible?
- Inspect the failure, revise the code, run the check again, and have the student review whether the result answers the analytical question.
- Let the agent revise once, then accept its description without rerunning the check.
- Rerun the original script unchanged until the check passes.
- Replace human review with a successful syntax check, because execution proves the analytical interpretation.
Question 10
5 points
What does the jagged frontier imply for checking this homework’s AI-assisted R code and interpretations?
- Check only whether the chart looks polished; a successful graph settles its interpretation.
- Use performance on one difficult task as evidence that every simpler DANL task is reliable.
- Evaluate the relevant parts separately and revisit them when the model, context, or tools change; capability can be uneven across tasks.
- Exclude AI from every future task after finding one incorrect suggestion.
Question 11
5 points
During AI-assisted DANL work, why combine an independent check of an AI claim with your own explanation of a code or scoring step?
- The first supports judgment about the result; the second checks your understanding. They address cognitive surrender and the illusion of learning, respectively.
- The first checks your writing style; the second guarantees that the agent’s next response will be correct.
- Both prove that you can complete any future analysis without assistance.
- Both replace the need to inspect the source text or the actual R output.
Question 12
5 points
What does Figure A show about individual review stars and text sentiment in the selected car-repair reviews?
Figure A: Actual car-repair review results
The analysis uses 2,896 written reviews from 613 places. Each box summarizes the text scores at one review-star value in one search region. The middle line is the median, and the box spans the middle half of scores. Some star groups have few reviews, and several reviews can come from the same place.
- Each box summarizes the overall place ratings of car-repair businesses in one search region.
- The upward shift in text scores proves that positive wording causes reviewers to award more stars.
- The method correctly captures the meaning of every five-star review because their text scores tend to be higher.
- Higher-star reviews tend to have higher text scores in these selected reviews, with substantial variation and some disagreements.
Part II: R Checks for Review Analysis
Use these checks to verify the data scope, reproduce a score, select a real case for critique, and check the summary and chart used in an AI-assisted interpretation.
Setup
Use the May 27, 2026 Google Places course snapshot. repair_ratings keeps 629 operational places classified exactly as "car_repair" in the Buffalo, Rochester, and Syracuse search regions, with recorded ratings and positive rating counts. repair_review_sentiment keeps their 2,896 nonblank selected reviews. Search results and featured reviews are not a census or random sample.
If needed, install ggthemes and syuzhet once with install.packages(c("ggthemes", "syuzhet")). Then run:
library(tidyverse)
library(ggthemes)
library(syuzhet)
places <- read_csv(
"https://bcdanl.github.io/data/google_place_upstate_ny.csv"
)
repair_places <- places |>
filter(primary_type == "car_repair",
metro == "Buffalo Metro" |
metro == "Rochester Metro" |
metro == "Syracuse Metro")
repair_operating <- repair_places |>
filter(business_status == "OPERATIONAL")
repair_ratings <- repair_operating |>
filter(!is.na(rating),
!is.na(user_rating_count),
user_rating_count > 0)
reviews <- read_csv(
"https://bcdanl.github.io/data/google_place_upstate_ny_reviews.csv"
)
repair_reviews <- reviews |>
select(place_id,
review_rating,
review_text) |>
inner_join(
repair_ratings |>
select(place_id,
metro),
by = "place_id"
)
repair_review_sentiment <- repair_reviews |>
filter(!is.na(review_rating) &
!is.na(review_text) &
str_trim(review_text) != "")
repair_review_sentiment$sentiment_score <- get_sentiment(
char_v = repair_review_sentiment$review_text
)| Field | Meaning |
|---|---|
place_id, metro |
Place identifier and search-region label; the identifier repeats across reviews. |
rating, user_rating_count |
Overall place star rating and total number of Google ratings. |
review_rating, review_text |
One selected review’s own stars and written text. |
sentiment_score |
One score per review from the default word-based get_sentiment() method; recognized wording contributes positive or negative values, which can include decimals. |
Positive or negative scores indicate the overall contribution of recognized wording. Zero can mean balancing contributions or no recognized scored words; it does not prove neutral meaning. Scores are not star ratings or percentages. As in Classwork 18, the method can miss negation and context: “good” and “not good” both score 0.75. Read a complete review before deciding what it means. The export has at most five selected reviews per place; this does not cap user_rating_count.
Question 13
4 points
Check the unit before briefing AI. Count the distinct places represented in repair_review_sentiment, rather than treating its review rows as distinct businesses. Supply the missing function call.
repair_review_sentiment |>
[?] |>
nrow()Question 14
6 points
Reproduce a scoring calculation. Before relying on a text score in an AI-assisted interpretation, recompute the default get_sentiment() score for the first review text in repair_review_sentiment. Enter one complete function call. The last line displays the stored score for comparison.
score_check <- [?]
score_check
repair_review_sentiment$sentiment_score[1]Question 15
6 points
Select cases for a meaning check. Keep actual reviews with at least four stars and a negative text sentiment score. Enter the complete condition; these are cases to read and explain, not automatic errors.
review_mismatches <- repair_review_sentiment |>
filter([?])Question 16
6 points
Check the pattern numerically before briefing AI. The code groups the selected car-repair reviews by their individual star rating. Complete the summary so it reports the number of reviews and median text sentiment score for each star value. Drop the grouping afterward.
star_summary <- repair_review_sentiment |>
group_by(review_rating) |>
[?]Question 17
8 points
Check that the proposed chart pairs the correct observations. Complete the entire aesthetic mapping for Figure A: individual review stars horizontally as categories, the same review’s sentiment score vertically, and search region mapped to fill. Supply one complete aes() call.
ggplot(
data = repair_review_sentiment,
mapping = [?]
) +
geom_boxplot(
width = 0.55,
alpha = 0.55,
outlier.alpha = 0.25
) +
facet_wrap(~ metro) +
scale_fill_colorblind() +
labs(
title = "Words and stars in car-repair reviews",
subtitle = "Selected written reviews of the same operational car-repair places",
x = "Individual review rating (stars)",
y = "Text sentiment score"
)Part III: Interpreting a Real Review
Question 18
10 points · Multiple choice
One actual review returned by the Question 15 filter has five stars, the text “Never a problem,” and a default get_sentiment() score of −0.75.
The score of −0.75 can be reproduced in R. Which conclusion best fits the AI–DANL workflow?
- Reproducing −0.75 establishes that the customer’s overall experience was negative, so the five-star rating should be treated as an error.
- Reproducing −0.75 checks the calculation; reading the short review suggests a positive experience despite the negative text score. Retain both observations and explain the method’s difficulty with negation.
- The five-star rating should replace the text score with +5 before the relationship is analyzed, so that both measures agree.
- The pattern in the boxplots is enough to determine this individual review’s meaning without reading its text.
