Module 8 Lab: Population analytics portfolio

Module 8 Lab: Population analytics portfolio#

Deliver an analytics brief and model card.

Lab Context#

This lab uses synthetic patient-level risk factors including utilization, chronic-condition count, access burden, and prior intervention as a safe proxy for the course setting. It is not a substitute for institutional data, but it lets you practice the reasoning, metrics, and documentation pattern before working with real records.

Lab Tasks#

  1. Run the baseline analysis.

  2. Identify the decision the metric supports.

  3. Change one threshold, score weight, or input assumption.

  4. Compare the result before and after your change.

  5. Record one deployment risk that the synthetic data cannot reveal.

import numpy as np
import matplotlib.pyplot as plt

rng = np.random.default_rng(8)
n = 120
feature_a = rng.normal(0, 1, n)
feature_b = rng.normal(0, 1, n)
feature_c = rng.normal(0, 1, n)
linear_score = 0.9*feature_a - 0.5*feature_b + 0.35*feature_c
probability = 1 / (1 + np.exp(-linear_score))
label = (probability > np.quantile(probability, 0.58)).astype(int)

baseline_pred = (feature_a > np.median(feature_a)).astype(int)
model_pred = (linear_score > np.median(linear_score)).astype(int)
baseline_acc = float((baseline_pred == label).mean())
model_acc = float((model_pred == label).mean())

plt.figure(figsize=(6, 3))
plt.scatter(feature_a, feature_b, c=label, cmap="viridis", s=24)
plt.xlabel("feature_a")
plt.ylabel("feature_b")
plt.title("Module 8 Lab: Population analytics portfolio")
plt.tight_layout()

{"baseline_accuracy": baseline_acc, "model_accuracy": model_acc, "improvement": model_acc - baseline_acc}
{'baseline_accuracy': 0.8333333333333334,
 'model_accuracy': 0.9166666666666666,
 'improvement': 0.08333333333333326}
../_images/1bdba4e64b0c214a104f0060a8cc502ac168734a34ad03be8dfb52801eb875c8.png
reflection = {
    "what_changed": "",
    "metric_before": "",
    "metric_after": "",
    "interpretation": "",
    "synthetic_data_limit": "",
    "next_real_world_evidence_needed": "",
}
reflection
{'what_changed': '',
 'metric_before': '',
 'metric_after': '',
 'interpretation': '',
 'synthetic_data_limit': '',
 'next_real_world_evidence_needed': ''}