Building a Kid-Suitability Filter for Rental Listings
Machine LearningModel answerLast updated
Design a probabilistic classifier that marks rental listings as suitable for infants and children, covering labeling, features, modeling, evaluation, host gaming, fairness, and cold start.
A vacation-rental marketplace wants a "family-friendly" toggle in search. When a guest traveling with kids flips it on, the results should contain only homes that are genuinely safe and comfortable for children.
Walk through the full design as an interview answer:
- Nail down the prediction target and the product goal — what are we optimizing, and how costly is a wrong positive versus a wrong negative?
- No clean labels exist for "kid-friendly." Show how you'd construct training labels and a trustworthy evaluation set.
- List features by data source and flag the dangerous ones.
- Give a baseline and an advanced model, plus how scores are calibrated, thresholded, and served within search latency.
- Specify offline metrics and the online experiment metrics, guardrails included.
- Hosts have an incentive to overstate child-safety amenities — how do you counter that?
- How do you keep the toggle from becoming a discrimination vector (against families, or by familial status)?
- Brand-new listings have no booking history — how do they still get a sensible score?
Interviewers want trade-off reasoning, plausible numbers, and awareness of the legal and trust-and-safety angles — not just a model diagram.
Hints
Hint 1
Pin down the product surface first: hard filter, ranking boost, or both? The latency and precision bar shifts depending on the answer.
Hint 2
Think about which errors hurt. A false positive (a home with an unfenced pool shown as kid-safe) ruins a family's trip; a false negative just hides a good listing. Let that asymmetry set your threshold.
Hint 3
Host claims ('crib on site', 'no children allowed') are features, not ground truth — reconcile them against photos, reviews, and complaint records.
Hint 4
Separate infants from older children: cribs and outlet covers versus fenced pools and open lofts. One binary label smears these needs together.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Framing
Treat this as a trust-and-safety-sensitive, multi-label classification problem sitting behind a search filter, not a generic ranker. The two error types cost very different amounts. Labeling a home kid-friendly when it has an unfenced pool, an open loft, or no crib produces a safety incident and a support escalation. Hiding a genuinely great home just costs a bit of coverage. That asymmetry should drive label design, threshold selection, and evaluation.
1. Target and objective
Clarify scope up front: roughly how many listings (~7M active), how much churn per day (~100–300K edits), and search traffic (tens of thousands of QPS). Also clarify granularity — "family" spans infants (crib, outlet covers) and older kids (space, fenced pool, not on a cliff), and those need different signals.
Proposed task: for each listing, predict two calibrated probabilities, p_infant and p_child, that a family in that age band would have a safe, satisfying stay. Score offline, store in the search index, and make the toggle a cheap predicate over those scores plus a threshold. If a query mentions children, the same scores can bump ranking — but the toggle is the primary surface.
Objective: raise booking conversion and post-stay satisfaction on child-inclusive searches without increasing child-safety complaints. Precision protects families, so set thresholds to hit a precision target on the gold set (say ≥90% for infants) and accept the resulting recall. Zero results in a market is a failure mode, so treat coverage as a floor constraint.
2. Labels
No clean target exists, so aggregate weak supervision into probabilistic labels (Snorkel-style label model or a weighted rule) and keep a separately hand-labeled gold set:
| Source | Signal | Caveat |
|---|---|---|
| House rules | "Not suitable for children/infants" → hard negative | Reliable negative |
| Bookings | Stays with kids in guest count + high rating + no complaint → positive | Popularity/selection bias |
| Reviews | NLP mentions ("crib was there", "steep stairs, scary for toddler") | Sparse, noisy |
| Support tickets | Child-safety or "not as described" complaints → strong negative | Rare |
| Amenities/photos | Crib, gate, high chair detected by a vision model | Host-reported, gameable |
| Human annotation | 10–20K listings scored against a rubric (hazards, amenities, space, rules) | Expensive — this is the gold/eval set |
Never use host claims as ground-truth labels; that imports exactly the gaming you're defending against. Stratify the gold set by market, property type, and price tier so slice metrics mean something.
3. Features
- Structured: bedrooms, beds, bathrooms, property type, square footage, kitchen, washer/dryer, amenities (crib, pack-n-play, high chair, outlet covers, stair gates), house rules, minimum stay.
- Hazards: pool/hot tub and whether fenced, balcony, loft/stairs, fireplace, waterfront or cliff proximity, smoke and CO detectors.
- Text: embeddings of title, description, and rules; keyword flags for "adults only", "no parties", "quiet".
- Images: vision outputs for crib, toys, stair gates, unfenced pool, open balcony, fragile decor — and cross-checks against claimed amenities.
- Behavioral (warm listings only): share of past stays with children, family-stay ratings, child-related review sentiment, complaint rate.
- Location: POI proximity to parks and beaches only. Never neighborhood demographics — that's the line into discriminatory filtering.
4. Models and serving
Baseline: rules (hard negatives from house rules, required infant amenities), then logistic regression or GBDT on structured features. Fast, interpretable, often within a few points of the fancy model. Advanced: GBDT or a multi-task network with p_infant/p_child heads fed by structured features, text embeddings, pooled image-hazard outputs, and behavioral features. Train with feature dropout on behavioral inputs so the model degrades gracefully on new listings.
Post-process with isotonic calibration, per-age thresholds set against the precision target, and the top contributing reasons surfaced to the guest. Serve with daily batch scoring plus event-driven rescoring whenever text/photos/amenities change or a review or complaint lands; write results into the search index so the filter stays a cheap lookup.
5. Evaluation
Offline on the gold set: PR-AUC, precision/recall at the operating threshold, calibration error (ECE), coverage per market, and slices by market, property type, price tier, new vs. established. Online A/B (randomize by user): primary = booking conversion on child-inclusive searches; secondary = filter usage and family-stay ratings; guardrails = child-safety / "not as described" complaint rate, overall bookings, cancellations, empty-result rate, and host earnings distribution (so traffic doesn't concentrate unfairly). Run long enough to capture post-stay outcomes since complaints lag, and hand-audit high-traffic passing listings periodically.
6. Host gaming
Treat host claims as features, cross-checked against photos, reviews, and complaint history, and compute claim-consistency and host-trust scores. Post-stay micro-surveys ("Was the crib available?") catch contradictions. Watch for sudden amenity additions after policy or ranking changes, and queue high-traffic, low-consistency listings for manual verification. Enforce through policy (removal from the filter, "not as described" consequences), not just model weights, and retrain on a schedule since adversaries adapt.
7. Fairness
Guest side: the toggle is opt-in and guest-driven; never infer children from name, photo, or demographics; never hide listings from guests based on who they are. Host side: familial status is a protected class under housing law in many jurisdictions, so involve legal per market — child-exclusion rules should be permitted only where documented and lawful, and "no children" claims must not become a backdoor for excluding families from the platform.
8. Cold start
New listings lack behavioral signal. Levers: (a) feature dropout in training so the model leans on content when behavior is missing; (b) a rules/prior fallback from structured plus image features; (c) calibrate with wider uncertainty and, if precision is at risk, keep the listing out of the infant filter until evidence accrues; (d) fast feedback — event-driven rescoring as soon as the first bookings, reviews, or surveys arrive, so a good new listing enters the filter within days, not months.
Common mistakes: treating host self-labels as truth, a single binary "family" label, optimizing accuracy instead of precision-at-threshold, forgetting coverage/empty-result guardrails, and using neighborhood demographics as a feature.