--- title: PolicyForge | Decision Intelligence Lab emoji: 🧭 colorFrom: green colorTo: blue sdk: static app_file: index.html pinned: false license: mit short_description: Off-policy evaluation and decision analytics tags: - off-policy-evaluation - causal-inference - contextual-bandits - decision-science - responsible-ai - javascript --- # PolicyForge 2.0 | Counterfactual Decision Studio **Project #33 | Rebuilt from scratch | Browser-only Static Space** PolicyForge evaluates *hypothetical target policies* using logged binary outcomes from A/B action data. Its goal is to make it easier to understand when off-policy comparisons are plausible, and especially when the evidence is **not sufficient** to support a decision. No user data is sent to a server. ## Functionality - **Overview:** business-focused metrics and comparative chart with conditional bootstrap intervals. - **Policy laboratory:** estimate five target policies using IPS, SNIPS, direct method (DM) and doubly robust (DR) estimators. - **Overlap and reliability:** inspect action-support cells, effective sample size, maximum importance weight and capped-weight sensitivity. - **Segment explorer:** compare group-level estimates. - **Decision scenarios:** translate point estimates into *illustrative* economic scenarios. - **Data and methodology:** import/export CSV, download JSON and Markdown reports, and view assumptions. ## Quick start Open the **App** tab, choose a synthetic scenario, pick a target policy and navigate between modules. You may import your own CSV in **Data & methodology**. No Python, server, key or external JavaScript library is required. ### Import CSV format Columns: `id,segment,action,reward,propensity` ```csv id,segment,action,reward,propensity 1,high,B,1,0.7 2,high,A,0,0.3 3,low,A,1,0.8 4,low,B,0,0.2 ``` Requirements: 20 to 5,000 rows; `segment` is `high` or `low`; `action` is `A` or `B`; `reward` is 0 or 1; `propensity` is the logged conditional probability of the *observed* action in the given context and must be in `(0,1]`. CSV rejects malformed data without clearing the last valid dataset. ## Method - Binary outcome with two actions and two contextual groups. - Five example decision policies: always A, always B, context-aware, conservative B, 50/50 mixture. - IPS, self-normalized IPS, direct-method plug-in and doubly robust estimates. - Outcome predictions use deterministic two-fold cross-fitting of smoothed action-by-segment response rates. - The 95% intervals are **conditional percentile bootstrap approximations**, using 180 resamples and holding nuisance outcome predictions fixed; they do not account for all estimation uncertainty. They are not formal deployment guarantees. - Diagnostics flag sample-efficiency problems and missing policy-supported action cells. ### Important limitations These off-policy evaluation methods require **known, correct logging propensities, positivity/overlap and conditional exchangeability** for a causal interpretation. Cross-fitting does not remove unmeasured confounding, interference, or distribution shift. A high point estimate is not evidence that a rollout will succeed. Financial numbers are user-specified what-if calculations, not forecasts. Synthetic example data is labeled as such. Do not rely on this tool for consequential automatic decisions. ## Privacy and reproducibility All computation and file parsing run locally in the browser. Raw records are never stored in a backend. The full analytic core is embedded in `index.html`; the files needed for deployment are `README.md`, `index.html`, and `LICENSE`. See the accompanying external development/test bundle (if available) for tests and development source. Avoid publishing real sensitive data in public repository files. ## Authorship and license Original educational implementation for the **Hugdrigo** portfolio. MIT license. No real commercial model, company dataset or causal claim is implied.