Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/docs/tutorials/hillstrom.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ print(f"Dataset shape: {df.shape}")
print(f"Average spend by segment:\n{df.groupby('segment')['spend'].mean()}")

# Prepare the data for dte_adj analysis
# Create treatment indicator: 0=No E-Mail, 1=Mens E-Mail, 2=Women E-Mail
treatment_mapping = {'No E-Mail': 0, 'Mens E-Mail': 1, 'Women E-Mail': 2}
# Create treatment indicator: 0=No E-Mail, 1=Mens E-Mail, 2=Womens E-Mail
treatment_mapping = {'No E-Mail': 0, 'Mens E-Mail': 1, 'Womens E-Mail': 2}
D = df['segment'].map(treatment_mapping).values

# Use spend as the outcome variable (revenue)
Expand Down Expand Up @@ -62,7 +62,7 @@ print(f"Women's Email: ${revenue[D==2].mean():.2f}")
print("\nConversion Rates:")
print(f"No Email: {df[df['segment']=='No E-Mail']['conversion'].mean():.3f}")
print(f"Men's Email: {df[df['segment']=='Mens E-Mail']['conversion'].mean():.3f}")
print(f"Women's Email: {df[df['segment']=='Women E-Mail']['conversion'].mean():.3f}")
print(f"Women's Email: {df[df['segment']=='Womens E-Mail']['conversion'].mean():.3f}")
```

### Email Campaign Effectiveness Analysis
Expand Down Expand Up @@ -151,14 +151,14 @@ import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 6))

# Women's vs Control PTE
plot(revenue_locations[1:], pte_women_ctrl, pte_lower_women_ctrl, pte_upper_women_ctrl,
plot(revenue_locations, pte_women_ctrl, pte_lower_women_ctrl, pte_upper_women_ctrl,
chart_type="bar",
title="Women's Email vs Control",
xlabel="Spending Category ($)", ylabel="Probability Treatment Effect",
ax=ax1)

# Men's vs Control PTE
plot(revenue_locations[1:], pte_men_ctrl, pte_lower_men_ctrl, pte_upper_men_ctrl,
plot(revenue_locations, pte_men_ctrl, pte_lower_men_ctrl, pte_upper_men_ctrl,
chart_type="bar",
title="Men's Email vs Control",
xlabel="Spending Category ($)", ylabel="Probability Treatment Effect",
Expand Down Expand Up @@ -268,14 +268,14 @@ pte_ml, pte_lower_ml, pte_upper_ml = ml_estimator.predict_pte(
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 6))

# Simple estimator
plot(revenue_locations[1:], pte_simple, pte_lower_simple, pte_upper_simple,
plot(revenue_locations, pte_simple, pte_lower_simple, pte_upper_simple,
chart_type="bar",
title="Spending Category Effects: Women's vs Men's (Simple Estimator)",
xlabel="Spending Category", ylabel="Probability Treatment Effect", color="purple",
ax=ax1)

# ML-adjusted estimator
plot(revenue_locations[1:], pte_ml, pte_lower_ml, pte_upper_ml,
plot(revenue_locations, pte_ml, pte_lower_ml, pte_upper_ml,
chart_type="bar",
title="Spending Category Effects: Women's vs Men's (ML-Adjusted Estimator)",
xlabel="Spending Category", ylabel="Probability Treatment Effect",
Expand Down