Spaces:
Sleeping
Sleeping
mike boone commited on
Commit ·
cfcdfcd
1
Parent(s): 8997cc3
feat: add ad monetization dataset scenario
Browse files
demoprep_app/dataset/generators/template_generator.py
CHANGED
|
@@ -116,6 +116,37 @@ class TemplateDatasetGenerator(ScenarioDatasetGenerator):
|
|
| 116 |
rows.update({"APPLICATIONS": conversions, "APPROVED_ACCOUNTS": approved, "ACCOUNTS_OPENED": approved, "APPROVAL_RATE_PCT": self._pct(approved, conversions)})
|
| 117 |
return rows
|
| 118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
if profile == "pipeline":
|
| 120 |
amount = round(rng.uniform(12_000, 420_000) * mult, 2)
|
| 121 |
probability = round(rng.uniform(8, 82), 2)
|
|
@@ -1397,6 +1428,72 @@ def _dimension_values(
|
|
| 1397 |
"Limited Service",
|
| 1398 |
],
|
| 1399 |
"PRODUCT_CATEGORIES": ["Denim", "Outerwear", "Sportswear", "Dresses", "Footwear", "Accessories", "Kids", "Underwear"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1400 |
"STORES": [f"{company} Flagship", f"{company} Core", f"{company} Outlet", f"{company} Digital", f"{company} Urban", f"{company} Suburban"],
|
| 1401 |
"WAREHOUSES": warehouse_values,
|
| 1402 |
"SUPPLIERS": supplier_values,
|
|
@@ -1901,6 +1998,11 @@ def _clean_values(values: list[Any]) -> list[str]:
|
|
| 1901 |
def _dimension_base(name: str) -> str:
|
| 1902 |
singulars = {
|
| 1903 |
"PRODUCT_CATEGORIES": "PRODUCT_CATEGORY",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1904 |
"CUSTOMER_SEGMENTS": "CUSTOMER_SEGMENT",
|
| 1905 |
"EQUIPMENT_TYPES": "EQUIPMENT_TYPE",
|
| 1906 |
"TERRITORIES": "TERRITORY",
|
|
@@ -1923,11 +2025,11 @@ def _dimension_base(name: str) -> str:
|
|
| 1923 |
def _dimension_target_count(name: str) -> int:
|
| 1924 |
if name == "SCENARIOS":
|
| 1925 |
return 3
|
| 1926 |
-
if name in {"REGIONS", "CHANNELS", "PRIORITIES", "SHIFTS", "CABIN_CLASSES", "SEVERITIES", "TERMS"}:
|
| 1927 |
return 8
|
| 1928 |
if name in {"PRODUCTS", "STORES", "ACCOUNTS", "CUSTOMERS", "CAMPAIGNS", "ROUTES", "EVENTS", "CLIENTS", "DEALERS", "PROPERTIES"}:
|
| 1929 |
return 36
|
| 1930 |
-
if name in {"SALES_REPS", "SUPPLIERS", "CARRIERS", "AIRPORTS", "AIRCRAFT", "WAREHOUSES", "TEAMS", "VENUES", "FAN_SEGMENTS", "CONSULTANTS", "VEHICLE_MODELS"}:
|
| 1931 |
return 24
|
| 1932 |
return 18
|
| 1933 |
|
|
|
|
| 116 |
rows.update({"APPLICATIONS": conversions, "APPROVED_ACCOUNTS": approved, "ACCOUNTS_OPENED": approved, "APPROVAL_RATE_PCT": self._pct(approved, conversions)})
|
| 117 |
return rows
|
| 118 |
|
| 119 |
+
if profile == "ad_monetization":
|
| 120 |
+
active_users = self._whole(rng, 25_000, 1_800_000, mult)
|
| 121 |
+
sessions = self._whole(rng, active_users, max(active_users + 1, active_users * 8), 1.0)
|
| 122 |
+
watch_hours = round(sessions * rng.uniform(0.35, 2.4), 2)
|
| 123 |
+
ad_requests = self._whole(rng, sessions * 2, max(sessions * 3, sessions * 14), 1.0)
|
| 124 |
+
filled_impressions = self._bounded_child(rng, ad_requests, 0.62, 0.94)
|
| 125 |
+
completed_views = self._bounded_child(rng, filled_impressions, 0.58, 0.91)
|
| 126 |
+
ecpm = round(rng.uniform(11.0, 54.0), 2)
|
| 127 |
+
ad_revenue = round(filled_impressions / 1000.0 * ecpm, 2)
|
| 128 |
+
yield_per_hour = self._div(ad_revenue, watch_hours)
|
| 129 |
+
arpu = self._div(ad_revenue, active_users)
|
| 130 |
+
unfilled = max(ad_requests - filled_impressions, 0)
|
| 131 |
+
revenue_leakage = round(unfilled / 1000.0 * ecpm * rng.uniform(0.35, 0.85), 2)
|
| 132 |
+
return {
|
| 133 |
+
"ACTIVE_USERS": active_users,
|
| 134 |
+
"SESSIONS": sessions,
|
| 135 |
+
"WATCH_HOURS": watch_hours,
|
| 136 |
+
"AD_REQUESTS": ad_requests,
|
| 137 |
+
"FILLED_IMPRESSIONS": filled_impressions,
|
| 138 |
+
"COMPLETED_VIEWS": completed_views,
|
| 139 |
+
"FILL_RATE_PCT": self._pct(filled_impressions, ad_requests),
|
| 140 |
+
"COMPLETION_RATE_PCT": self._pct(completed_views, filled_impressions),
|
| 141 |
+
"ECPM_USD": ecpm,
|
| 142 |
+
"AD_REVENUE_USD": ad_revenue,
|
| 143 |
+
"ARPU_USD": arpu,
|
| 144 |
+
"REVENUE_PER_SESSION_USD": self._div(ad_revenue, sessions),
|
| 145 |
+
"AD_YIELD_PER_WATCH_HOUR_USD": yield_per_hour,
|
| 146 |
+
"UNFILLED_REQUESTS": unfilled,
|
| 147 |
+
"REVENUE_LEAKAGE_USD": revenue_leakage,
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
if profile == "pipeline":
|
| 151 |
amount = round(rng.uniform(12_000, 420_000) * mult, 2)
|
| 152 |
probability = round(rng.uniform(8, 82), 2)
|
|
|
|
| 1428 |
"Limited Service",
|
| 1429 |
],
|
| 1430 |
"PRODUCT_CATEGORIES": ["Denim", "Outerwear", "Sportswear", "Dresses", "Footwear", "Accessories", "Kids", "Underwear"],
|
| 1431 |
+
"AD_PLACEMENTS": [
|
| 1432 |
+
"SmartCast Home Hero",
|
| 1433 |
+
"SmartCast Home Rail",
|
| 1434 |
+
"FAST Channel Pre-Roll",
|
| 1435 |
+
"FAST Channel Mid-Roll",
|
| 1436 |
+
"WatchFree Plus Pause Ad",
|
| 1437 |
+
"Search Sponsored Tile",
|
| 1438 |
+
"App Launch Takeover",
|
| 1439 |
+
"Content Detail Native",
|
| 1440 |
+
"Screensaver Sponsorship",
|
| 1441 |
+
"Recommendation Rail",
|
| 1442 |
+
"Voice Search Sponsored Result",
|
| 1443 |
+
"Live Guide Sponsored Row",
|
| 1444 |
+
],
|
| 1445 |
+
"CONTENT_CATEGORIES": [
|
| 1446 |
+
"Movies",
|
| 1447 |
+
"Sports",
|
| 1448 |
+
"News",
|
| 1449 |
+
"Lifestyle",
|
| 1450 |
+
"Kids and Family",
|
| 1451 |
+
"Reality",
|
| 1452 |
+
"Documentary",
|
| 1453 |
+
"Comedy",
|
| 1454 |
+
"Drama",
|
| 1455 |
+
"Home and Design",
|
| 1456 |
+
"Food",
|
| 1457 |
+
"Music",
|
| 1458 |
+
],
|
| 1459 |
+
"AUDIENCE_SEGMENTS": [
|
| 1460 |
+
"High Engagement Streamers",
|
| 1461 |
+
"FAST Channel Loyalists",
|
| 1462 |
+
"Sports Heavy Households",
|
| 1463 |
+
"Movie Night Families",
|
| 1464 |
+
"Cord Cutter Households",
|
| 1465 |
+
"New SmartCast Users",
|
| 1466 |
+
"Lapsed Viewers",
|
| 1467 |
+
"Premium App Users",
|
| 1468 |
+
"Value Seekers",
|
| 1469 |
+
"Weekend Bingers",
|
| 1470 |
+
"News Daily Viewers",
|
| 1471 |
+
"Low Ad Load Cohort",
|
| 1472 |
+
],
|
| 1473 |
+
"DEVICE_TYPES": [
|
| 1474 |
+
"OLED Smart TV",
|
| 1475 |
+
"Quantum Pro TV",
|
| 1476 |
+
"M-Series TV",
|
| 1477 |
+
"V-Series TV",
|
| 1478 |
+
"Bedroom TV",
|
| 1479 |
+
"Living Room TV",
|
| 1480 |
+
"Large Format TV",
|
| 1481 |
+
"Legacy SmartCast TV",
|
| 1482 |
+
],
|
| 1483 |
+
"AD_PRODUCTS": [
|
| 1484 |
+
"Programmatic Video",
|
| 1485 |
+
"Direct Sold Video",
|
| 1486 |
+
"Sponsored Home Screen",
|
| 1487 |
+
"FAST Channel Sponsorship",
|
| 1488 |
+
"Native Recommendation",
|
| 1489 |
+
"Pause Ad",
|
| 1490 |
+
"Interactive Overlay",
|
| 1491 |
+
"Shoppable TV",
|
| 1492 |
+
"Frequency Extension",
|
| 1493 |
+
"Audience Retargeting",
|
| 1494 |
+
"Contextual Package",
|
| 1495 |
+
"Seasonal Takeover",
|
| 1496 |
+
],
|
| 1497 |
"STORES": [f"{company} Flagship", f"{company} Core", f"{company} Outlet", f"{company} Digital", f"{company} Urban", f"{company} Suburban"],
|
| 1498 |
"WAREHOUSES": warehouse_values,
|
| 1499 |
"SUPPLIERS": supplier_values,
|
|
|
|
| 1998 |
def _dimension_base(name: str) -> str:
|
| 1999 |
singulars = {
|
| 2000 |
"PRODUCT_CATEGORIES": "PRODUCT_CATEGORY",
|
| 2001 |
+
"AD_PLACEMENTS": "AD_PLACEMENT",
|
| 2002 |
+
"CONTENT_CATEGORIES": "CONTENT_CATEGORY",
|
| 2003 |
+
"AUDIENCE_SEGMENTS": "AUDIENCE_SEGMENT",
|
| 2004 |
+
"DEVICE_TYPES": "DEVICE_TYPE",
|
| 2005 |
+
"AD_PRODUCTS": "AD_PRODUCT",
|
| 2006 |
"CUSTOMER_SEGMENTS": "CUSTOMER_SEGMENT",
|
| 2007 |
"EQUIPMENT_TYPES": "EQUIPMENT_TYPE",
|
| 2008 |
"TERRITORIES": "TERRITORY",
|
|
|
|
| 2025 |
def _dimension_target_count(name: str) -> int:
|
| 2026 |
if name == "SCENARIOS":
|
| 2027 |
return 3
|
| 2028 |
+
if name in {"REGIONS", "CHANNELS", "PRIORITIES", "SHIFTS", "CABIN_CLASSES", "SEVERITIES", "TERMS", "DEVICE_TYPES"}:
|
| 2029 |
return 8
|
| 2030 |
if name in {"PRODUCTS", "STORES", "ACCOUNTS", "CUSTOMERS", "CAMPAIGNS", "ROUTES", "EVENTS", "CLIENTS", "DEALERS", "PROPERTIES"}:
|
| 2031 |
return 36
|
| 2032 |
+
if name in {"SALES_REPS", "SUPPLIERS", "CARRIERS", "AIRPORTS", "AIRCRAFT", "WAREHOUSES", "TEAMS", "VENUES", "FAN_SEGMENTS", "CONSULTANTS", "VEHICLE_MODELS", "AD_PLACEMENTS", "CONTENT_CATEGORIES", "AUDIENCE_SEGMENTS", "AD_PRODUCTS"}:
|
| 2033 |
return 24
|
| 2034 |
return 18
|
| 2035 |
|
demoprep_app/pipeline/dataset_first.py
CHANGED
|
@@ -134,6 +134,7 @@ def build_dataset_first_demo(
|
|
| 134 |
"workforce_hr",
|
| 135 |
"legal_matter_management",
|
| 136 |
"marketing_funnel",
|
|
|
|
| 137 |
"ecommerce_marketing",
|
| 138 |
"finance_unit_economics",
|
| 139 |
"subscription_revenue",
|
|
|
|
| 134 |
"workforce_hr",
|
| 135 |
"legal_matter_management",
|
| 136 |
"marketing_funnel",
|
| 137 |
+
"ad_monetization",
|
| 138 |
"ecommerce_marketing",
|
| 139 |
"finance_unit_economics",
|
| 140 |
"subscription_revenue",
|
demoprep_app/scenario/extractor.py
CHANGED
|
@@ -224,6 +224,8 @@ def _infer_from_text(text: str) -> str | None:
|
|
| 224 |
return "professional_services_engagements"
|
| 225 |
if _has_any(low, ("arena", "venue", "stadium", "ticket", "attendance", "fan", "season ticket", "suite", "sponsorship", "basketball", "hockey", "concert", "theater", "theatre")):
|
| 226 |
return "sports_venue_fan_engagement"
|
|
|
|
|
|
|
| 227 |
return None
|
| 228 |
|
| 229 |
|
|
|
|
| 224 |
return "professional_services_engagements"
|
| 225 |
if _has_any(low, ("arena", "venue", "stadium", "ticket", "attendance", "fan", "season ticket", "suite", "sponsorship", "basketball", "hockey", "concert", "theater", "theatre")):
|
| 226 |
return "sports_venue_fan_engagement"
|
| 227 |
+
if _has_any(low, ("ad yield", "ad monetization", "advertising monetization", "arpu", "ecpm", "fill rate", "ctv", "connected tv", "smart tv", "smartcast", "fast channel", "ad requests", "completion rate")):
|
| 228 |
+
return "ad_monetization"
|
| 229 |
return None
|
| 230 |
|
| 231 |
|
demoprep_app/scenario/families.py
CHANGED
|
@@ -68,6 +68,20 @@ SCENARIO_FAMILIES: dict[str, ScenarioFamilyTemplate] = {
|
|
| 68 |
"digital_funnel",
|
| 69 |
("Where is the biggest funnel drop-off?", "Which campaigns have the best conversion?", "How is CPA trending?"),
|
| 70 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
"apparel_marketing": ScenarioFamilyTemplate(
|
| 72 |
"apparel_marketing",
|
| 73 |
"APPAREL_MARKETING",
|
|
|
|
| 68 |
"digital_funnel",
|
| 69 |
("Where is the biggest funnel drop-off?", "Which campaigns have the best conversion?", "How is CPA trending?"),
|
| 70 |
),
|
| 71 |
+
"ad_monetization": ScenarioFamilyTemplate(
|
| 72 |
+
"ad_monetization",
|
| 73 |
+
"AD_MONETIZATION",
|
| 74 |
+
"placement-content-audience-device-region-month",
|
| 75 |
+
"AD_REVENUE_USD",
|
| 76 |
+
("AD_PLACEMENTS", "CONTENT_CATEGORIES", "AUDIENCE_SEGMENTS", "DEVICE_TYPES", "REGIONS", "AD_PRODUCTS"),
|
| 77 |
+
("CTV Homescreen", "FAST Channel", "Video Pre-Roll", "Video Mid-Roll", "Native Placement", "Sponsored Content"),
|
| 78 |
+
"ad_monetization",
|
| 79 |
+
(
|
| 80 |
+
"Which placements, content categories, and audience cohorts drive ad yield?",
|
| 81 |
+
"Where are fill rate, eCPM, or completion issues suppressing revenue?",
|
| 82 |
+
"Which Smart TV user segments have the highest ARPU and revenue expansion opportunity?",
|
| 83 |
+
),
|
| 84 |
+
),
|
| 85 |
"apparel_marketing": ScenarioFamilyTemplate(
|
| 86 |
"apparel_marketing",
|
| 87 |
"APPAREL_MARKETING",
|
demoprep_app/scenario/selector.py
CHANGED
|
@@ -25,6 +25,7 @@ def infer_scenario_family(use_case: str, vertical: str | None = None, function:
|
|
| 25 |
("hotel_finance", ("hotel", "hotels", "hospitality", "property", "room", "rooms", "occupancy", "revpar", "adr"), ("finance", "margin", "budget", "forecast")),
|
| 26 |
("apparel_marketing", ("apparel", "fashion", "garment", "footwear", "seasonal drop", "markdown"), ("marketing", "campaign", "loyalty", "channel", "conversion")),
|
| 27 |
("sports_venue_fan_engagement", ("sports", "arena", "venue", "stadium", "ticket", "tickets", "ticketing", "attendance", "fan", "fans", "season ticket", "premium seating", "suite", "suites", "sponsorship", "sponsor", "team", "league", "basketball", "hockey", "soccer", "baseball", "football", "theater", "theatre", "concert"), ("marketing", "email", "demographics", "tiers", "events", "live entertainment")),
|
|
|
|
| 28 |
("airline_route_operations", ("air transport", "airline", "airport", "aircraft", "flight", "passenger", "baggage", "route"), ("transportation", "logistics", "operations", "sales")),
|
| 29 |
("restaurant_store_operations", ("restaurant", "coffee", "cafe", "store operations", "daypart", "drive-thru", "mobile order", "delivery"), ("store", "transactions", "labor", "wait time", "customer satisfaction")),
|
| 30 |
("retail_sales", ("retail", "store", "merchandising", "apparel", "fashion", "electronics"), ("sales", "revenue", "margin")),
|
|
|
|
| 25 |
("hotel_finance", ("hotel", "hotels", "hospitality", "property", "room", "rooms", "occupancy", "revpar", "adr"), ("finance", "margin", "budget", "forecast")),
|
| 26 |
("apparel_marketing", ("apparel", "fashion", "garment", "footwear", "seasonal drop", "markdown"), ("marketing", "campaign", "loyalty", "channel", "conversion")),
|
| 27 |
("sports_venue_fan_engagement", ("sports", "arena", "venue", "stadium", "ticket", "tickets", "ticketing", "attendance", "fan", "fans", "season ticket", "premium seating", "suite", "suites", "sponsorship", "sponsor", "team", "league", "basketball", "hockey", "soccer", "baseball", "football", "theater", "theatre", "concert"), ("marketing", "email", "demographics", "tiers", "events", "live entertainment")),
|
| 28 |
+
("ad_monetization", ("ad yield", "ad monetization", "advertising monetization", "arpu", "ecpm", "fill rate", "ctv", "smart tv", "smartcast", "fast channel", "connected tv"), ("placement", "impressions", "ad requests", "completion rate", "watch time", "audience", "inventory")),
|
| 29 |
("airline_route_operations", ("air transport", "airline", "airport", "aircraft", "flight", "passenger", "baggage", "route"), ("transportation", "logistics", "operations", "sales")),
|
| 30 |
("restaurant_store_operations", ("restaurant", "coffee", "cafe", "store operations", "daypart", "drive-thru", "mobile order", "delivery"), ("store", "transactions", "labor", "wait time", "customer satisfaction")),
|
| 31 |
("retail_sales", ("retail", "store", "merchandising", "apparel", "fashion", "electronics"), ("sales", "revenue", "margin")),
|
tests/test_dataset_first_builders.py
CHANGED
|
@@ -447,6 +447,37 @@ def test_trucking_sales_does_not_route_to_trucking_finance():
|
|
| 447 |
assert "TRUCKING_FINANCIALS" not in build.dataset.table_map()
|
| 448 |
|
| 449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
def test_grocery_finance_routes_to_cpg_financials_not_sales_fact():
|
| 451 |
build = build_dataset_first_demo(
|
| 452 |
company_name="General Mills",
|
|
|
|
| 447 |
assert "TRUCKING_FINANCIALS" not in build.dataset.table_map()
|
| 448 |
|
| 449 |
|
| 450 |
+
def test_ad_yield_arpu_routes_to_ad_monetization_not_sales_pipeline():
|
| 451 |
+
build = build_dataset_first_demo(
|
| 452 |
+
company_name="Vizio",
|
| 453 |
+
company_url="https://www.vizio.com/",
|
| 454 |
+
use_case=(
|
| 455 |
+
"Focus on Ad yield and ARPU, optimizing revenue through SmartCast users "
|
| 456 |
+
"across CTV placements, FAST channels, ad requests, eCPM, fill rate, "
|
| 457 |
+
"completion rate, watch time, and audience cohorts."
|
| 458 |
+
),
|
| 459 |
+
vertical="Media & Entertainment",
|
| 460 |
+
function="Revenue",
|
| 461 |
+
row_count_guidance=100,
|
| 462 |
+
)
|
| 463 |
+
|
| 464 |
+
assert build is not None
|
| 465 |
+
assert build.scenario.scenario_type == "ad_monetization"
|
| 466 |
+
table_map = build.dataset.table_map()
|
| 467 |
+
assert "AD_MONETIZATION" in table_map
|
| 468 |
+
assert "SALES_PIPELINE" not in table_map
|
| 469 |
+
fact_columns = {column.name for column in table_map["AD_MONETIZATION"].columns}
|
| 470 |
+
assert {
|
| 471 |
+
"AD_REVENUE_USD",
|
| 472 |
+
"ARPU_USD",
|
| 473 |
+
"ECPM_USD",
|
| 474 |
+
"FILL_RATE_PCT",
|
| 475 |
+
"AD_YIELD_PER_WATCH_HOUR_USD",
|
| 476 |
+
"REVENUE_LEAKAGE_USD",
|
| 477 |
+
}.issubset(fact_columns)
|
| 478 |
+
assert validate_dataset_quality(build.dataset).ok
|
| 479 |
+
|
| 480 |
+
|
| 481 |
def test_grocery_finance_routes_to_cpg_financials_not_sales_fact():
|
| 482 |
build = build_dataset_first_demo(
|
| 483 |
company_name="General Mills",
|