✦ Want a lab built just for you? ✦
Request a Lab ↗

End-to-End AI + ML on Snowflake: Predicting Subscription Churn from Usage, Billing, and Support Text

About this lab

Strideline is a subscription fitness streaming app with 5,000 members. Every month a few percent of them cancel, and the retention team only finds out when the goodbye ticket arrives. The data to see it coming is already in Snowflake, split across two worlds: structured tables (plans, weekly usage, invoices) and unstructured text (support tickets, chat transcripts, cancellation surveys). This lab joins the two worlds end to end, and every step runs on your own account.

You generate 21 months of seeded data with a Python stored procedure, read what churned customers said with AI_SUMMARIZE_AGG, and mask personal data with AI_REDACT. You turn every ticket and chat into features with two models you register yourself: a complaint-theme classifier trained on the support agents' disposition codes, and the open-source VADER sentiment model wrapped as a custom model, both called from plain SQL. You register an entity and three feature views in the Snowflake Feature Store and build a point-in-time correct training set, and you measure how badly a naive join would leak the future.

In a Snowflake Notebook you tune XGBoost with Experiment Tracking, prove that the text features lift ROC AUC and the share of churners caught in the riskiest 10%, register the winner with explainability, and rank features by SHAP. You then score in batch from SQL, attach a Model Monitor that catches a bad Android release through feature drift, automate weekly scoring with streams, a task graph and ASOF joins, and close the loop with AI_AGG: a grounded retention note for each of the 15 riskiest accounts, built from the model's SHAP drivers and the customer's own redacted words.

Account requirements, stated precisely: tested on a Snowflake Enterprise trial in AWS EU (Ireland) with ACCOUNTADMIN. The AI functions used (AI_AGG, AI_SUMMARIZE_AGG, AI_REDACT) worked there with cross-region inference disabled. Trial accounts block AI_COMPLETE, AI_CLASSIFY, AI_SENTIMENT, AI_EXTRACT and AI_EMBED, which is why the lab trains and registers its own text models instead. If your region does not offer AI_AGG, AI_SUMMARIZE_AGG or AI_REDACT, an ACCOUNTADMIN can enable cross-region inference (CORTEX_ENABLED_CROSS_REGION); that path was not tested.

Lab details

  • Level: Advanced
  • Cloud: Snowflake
  • Domain: Data Science & MLOps
  • Duration: 150 minutes

What you will learn

  • Turn tickets and chats into churn features with a theme classifier and an open-source sentiment model registered in Snowflake and called from SQL
  • Build a point-in-time correct training set with the Snowflake Feature Store and measure the leakage a naive join would cause
  • Tune and compare XGBoost models with Experiment Tracking and prove the lift the text features add
  • Explain predictions with SHAP from the registered model and monitor performance and drift with a Model Monitor
  • Automate text enrichment and weekly scoring with streams, a task graph and ASOF joins
  • Write grounded, privacy-safe retention notes with AI_REDACT and AI_AGG

Concepts covered

  • Joining structured and unstructured data for ML
  • Text features from registered NLP models
  • Point-in-time correctness and label leakage
  • Feature Store entities and feature views
  • Experiment tracking and fair model comparison
  • SHAP explainability
  • Model monitoring and drift
  • Incremental scoring with streams and tasks
  • Grounded generative AI with redaction

Technologies used

  • Snowflake AI SQL functions
  • Snowflake Model Registry
  • Snowflake Feature Store
  • Snowflake Notebooks + Experiment Tracking
  • Snowflake ML Observability
  • Streams, Tasks and SQL procedures

Prerequisites

  • Comfortable with SQL (CTEs, window functions, joins) and Python with pandas
  • Know what a classifier, ROC AUC and a train/test split are
  • A Snowflake account (Enterprise trial works) where you can use the ACCOUNTADMIN role
  • About 150 minutes; the lab uses an X-Small warehouse and a few AI function calls

Topics

  • Snowflake
  • Snowflake ML
  • Snowflake Cortex AI
  • AI_AGG
  • AI_REDACT
  • Feature Store
  • Model Registry
  • Experiment Tracking
  • Model Monitoring
  • XGBoost
  • SHAP
  • NLP
  • Churn Prediction
  • Snowpark
  • Streams
  • Tasks
  • MLOps
  • Python
  • SQL