|
397 | 397 | - Next step: Deploy hf_space/ to HF Space (push random_forest.pkl + app.py) |
398 | 398 |
|
399 | 399 | --- |
| 400 | + |
| 401 | +## Day 6 (addendum 2) — 2026-04-09 — Live Evidently report per user + README overhaul |
| 402 | +> Project: B5-Drift-Monitor |
| 403 | +
|
| 404 | +### What was done |
| 405 | +- Changed Evidently HTML from static pre-baked file to live generation per user simulation. |
| 406 | +- `run_simulation()` now collects `X_reference` (normal batches) and `X_current` (drifted batches). |
| 407 | +- Added `generate_evidently_html()` inlined in hf_space/app.py — calls `Report([DataDriftPreset()])`. |
| 408 | +- Added `evidently==0.7.21` to `hf_space/requirements.txt`. |
| 409 | +- Each user gets their own HTML report matching their chosen drift intensity — downloaded via `gr.File`. |
| 410 | +- Overhauled README: badges, full architecture ASCII diagram, results section with all 3 plots, detailed tech table, portfolio table, HF Space link. |
| 411 | + |
| 412 | +### Why it was done |
| 413 | +- Static pre-baked report shows the same drift regardless of what intensity the user chose — misleading. |
| 414 | +- Live generation means PSI values, drifted feature rankings, and distribution plots in the HTML actually match what the user just simulated. |
| 415 | +- README overhaul needed: the old one was too thin for a portfolio project. |
| 416 | + |
| 417 | +### How it was done |
| 418 | +- Collected `X_normal_batches` and `X_drifted_batches` lists during the simulation loop, then `pd.concat()` at the end. |
| 419 | +- `generate_evidently_html()` runs `Report([DataDriftPreset()]).run(reference_data, current_data)` and saves to a `NamedTemporaryFile`. |
| 420 | +- The temp file path is returned as the 13th output of `simulate()` and received by `gr.File(label="Evidently Drift Report (HTML)")`. |
| 421 | +- README uses GitHub-flavored markdown badges via shields.io, centered with `<div align="center">`. |
| 422 | + |
| 423 | +### Why this tool / library — not alternatives |
| 424 | +| Tool Used | Why This | Rejected Alternative | Why Not | |
| 425 | +|-----------|----------|---------------------|---------| |
| 426 | +| Live Evidently generation | Report matches user's simulation exactly | Static pre-baked HTML | Shows wrong PSI values for different intensities | |
| 427 | +| evidently==0.7.21 | DataDriftPreset API is stable, matches main repo version | Latest evidently | Version mismatch with main requirements.txt | |
| 428 | +| shields.io badges | Standard GitHub badge style, renders on GitHub/HF | Custom HTML badges | Don't render on plain GitHub markdown | |
| 429 | + |
| 430 | +### Status |
| 431 | +- [x] Done |
| 432 | +- Next step: Update HF Space repo with new app.py + requirements.txt |
| 433 | + |
| 434 | +--- |
0 commit comments