def get_recommendations(input_dict: dict, probability: float) -> list: """Generate retention recommendations based on the 5 key features.""" recs = [] service_calls = int(input_dict.get("Customer Service Calls", 0)) monthly = float(input_dict.get("Monthly Charge", 0)) contract = str(input_dict.get("Contract Type", "Month-to-Month")) account_len = int(input_dict.get("Account Length", 0)) gb_download = float(input_dict.get("Avg Monthly GB Download", 0)) # Critical risk — immediate action if probability >= 0.75: recs.append(( "🎯", "Launch Immediate Retention Campaign", "Customer is at critical risk. Assign a dedicated account manager " "and offer a personalized retention package within 24 hours." )) # High service calls — #1 churn driver if service_calls >= 4: recs.append(( "📞", "Resolve Service Issues Urgently", f"{service_calls} service calls detected — the top churn predictor. " "Escalate to senior support, identify root cause, and follow up proactively." )) elif service_calls >= 2: recs.append(( "🛠", "Proactive Support Check-in", "Schedule a satisfaction call to address any unresolved issues " "before they escalate further." )) # High monthly charge if monthly > 90: recs.append(( "💰", "Review & Optimize Pricing Plan", f"Monthly charge of ${monthly:.0f} is above average. " "Offer a bundled plan or loyalty discount to reduce cost by 15-20%." )) # Month-to-Month contract if contract in ["Month-to-Month", "0", 0]: recs.append(( "📋", "Offer Annual Contract Upgrade", "Month-to-Month customers churn 3x more. " "Offer a 20% discount to switch to a 1 or 2-year contract." )) # New customer if account_len <= 12: recs.append(( "🚀", "New Customer Onboarding Program", f"Only {account_len} months as a customer. " "Assign an onboarding specialist and schedule a 30-day satisfaction check-in." )) # High data usage — valuable customer if gb_download > 40: recs.append(( "📡", "Offer Premium Data Plan Upgrade", f"Averaging {gb_download:.0f} GB/month — a high-value power user. " "Offer an unlimited data plan with priority network access." )) # Low usage — engagement risk elif gb_download < 10 and probability > 0.4: recs.append(( "📊", "Re-engage Low Usage Customer", "Low data usage may indicate disengagement. " "Offer free data credits or a plan downgrade to retain the customer." )) if not recs: recs.append(( "✅", "Customer in Good Standing", "No immediate action required. " "Monitor quarterly and consider a loyalty reward to strengthen retention." )) return recs