Repository navigation
Personal PK calibration: per-route levels, absorption speed, MCMC - #306
Merged
Merged
Conversation
A new calibration method next to Full Bayes, not the default yet. Each person gets their own pharmacokinetics: a level per route (hierarchical around one personal level), a personal clearance and a personal absorption rate, sampled with four chains of adaptive Metropolis and checked with split R-hat. The curve is the posterior mean of exactly the model the draws were scored on. - routeCurves.ts splits the E2 model by route; the parts add up to the simulation to 1e-9, so per-route factors are exact - mcmc.ts: (clearance, absorption) grid at the lab times, seeded sampler, posterior mean curve and band, latest-lab interval, discounted labs - Full Bayes's per-lab SD moved into labLogSd and shared - Settings card with a new hand-drawn icon, absorption and per-route rows, nine languages; backup and sync accept 'mcmc' - Algorithm Explanation §16, README, wiki and backup test vectors updated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PYdxvXGCTGpTnsjZgUDcnD
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Collaborator
Author
|
Browser E2E failed before any test ran: installing Playwright's system fonts hit Generated by Claude Code |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://claude-project-thread-772trk-hrt-tracker.oyamasmirnona.workers.dev (commit 9c24f1f)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
- New page one level below calibration settings: a chart you can move (method, lab level, a later change, number of labs, one wrong lab), computed by computeCalibration on a runSimulation curve, with the 90% range where the method gives one - Each method with a small hand-drawn picture and its formula (KaTeX), plus how much each lab counts - ModelChart can wash a range between two lines - The Personal PK card uses a pair of dice, as picked - Nine languages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PYdxvXGCTGpTnsjZgUDcnD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Аня · project thread
What changed 修改内容
A sixth calibration method, Personal PK / 个人药代 (
mcmc), next to Full Bayes. It is not the default.Instead of "the model times one correction", each person gets their own pharmacokinetics:
routeCurves.ts, tested). Route offsets u_r are hierarchical around one personal level s, so routes borrow strength from each other. With one route the model is MIPD's plus absorption.factorSdFngives the forecast band;latestIntervalis the 5–95% quantile at the latest lab.labLogSd).samplesglyph; the current fit shows absorption speed and a row per route (replacing the single amplitude row when there are several routes). Nine languages. Backup, sync and the backup test vectors acceptmcmc.Why 原因
Asked for in the project thread: personalised absorption rate, per-route calibration (e.g. sublingual vs injection each with its own bias), and real sampling instead of the Laplace approximation. Per-route levels also give each person their own sublingual factor, which is the open question in #22.
How it was tested 测试方式
tests/mcmcCalibration.test.ts(10 tests): per-route curves sum to the simulation; labs made from a known person (sublingual ×0.5, injection ×1.3) are recovered; injection depot release ×2 and ×0.5 are recovered; daily oral absorption barely shows (about 10%, inside lab noise) and the prior keeps most of its say, which is documented; one lab shrinks and pins k and a; an outlier is discounted; forward mode never rewrites the past; deterministic; split R-hat flags disagreeing chains. Whole suite about 6 s.mcmc.tsc, lint (0 errors),format:check, 915 unit tests andbuildpass locally.Not yet validated against real timed labs (#22): the repo has no timed personal lab data. That is why it ships as an option and not the default.
Checklist 自查清单
npx tsc --noEmit,npm run lint,npm run format:check,npm testandnpm run buildpass locallyzhanden(and the other seven)https://claude.ai/code/session_01PYdxvXGCTGpTnsjZgUDcnD
Generated by Claude Code