DEV Community

Cover image for Two Curves Fit the Data. What Should We Measure Next?
Arnav Mittal
Arnav Mittal

Posted on

Two Curves Fit the Data. What Should We Measure Next?

This is a submission for the MLH x DEV Writing Challenge.

What I Built

We gave Dr. Bean five concentration readings and a claim that the elimination rate was between 0.10 and 0.17 per hour. A curve inside that range fit the readings. So did a curve outside it.

That second curve was what we wanted a researcher to see. If both curves agree with the measurements, what would you measure next to tell them apart?

My team built Dr. Bean at HackPrinceton Fall ’26 to answer that question for supported scientific models. Our inspiration was Lean. We liked that a mathematical claim could travel with a proof someone else could check. For experimental data, we wanted the researcher to be able to see which measurements, model, and error bounds went into a conclusion, then rerun the calculation.

AI made the problem feel more urgent. A summary can quietly become “this curve fits” into “the data establish this parameter.” In Dr. Bean, the researcher reviews the inputs and approves the proposed calculation. The software saves the result with the values and assumptions used to obtain it.

I led the scientific engine and integration work. We published two standalone Python packages so other developers can use the math in their own scripts or notebooks:

  • Counterdex searches for candidate parameters, checks them with rational bounds, and produces evidence that can be replayed. It also checks whether a proposed measurement can distinguish two selected candidates. Counterdex on PyPI
  • counterdex-models lets developers register their own models, fit them to observations, and explore how noise or detection thresholds change the comparison. It can rank a supplied set of measurement settings and run reproducible Monte Carlo simulations. counterdex-models on PyPI

Demo

In the built-in synthetic concentration example, the claim is that the elimination rate lies in [0.10, 0.17] per hour. Counterdex finds a value of 101/1016, about 0.0994 per hour. That candidate fits all five readings within their reviewed allowances. Its existence is enough to show that the measurements do not force the claimed range.

At eight hours, the two selected curves predict about 3.27 and 3.93 mg/L. With a hard measurement allowance of ±0.20 mg/L, their possible reading ranges are separated by about 0.26 mg/L. A reading taken at that time and precision could agree with at most one of the two candidates. The study shows the curves, and the evidence can be downloaded for replay. Worked example and replay instructions

Source code and local setup · Project on Devpost

Partner Technologies

Google Gemini API. Gemini reads research files and proposes interpretations with source passages. The difficult part was carrying the meaning of a number through every step. A standard deviation reported in a paper and a hard bound on a measurement answer different questions. We surface the source and the extracted values so the researcher can check both before submitting them to the scientific engine.

LangChain Deep Agents and LangGraph. We used Deep Agents’ built-in write_todos tool to keep an investigation plan. We wrote five tools to prepare a proposal, run an approved calculation, read evidence, ask for clarification, and publish a report. A LangGraph interrupt pauses the run for approval, and a checkpoint in SQLite saves its progress. When the run resumes, the backend checks that the calculation still uses the scope the researcher approved.

The main study interface uses a deterministic coordinator through the same Deep Agents graph. We also recorded a separate live run in which four Gemini requests took the workflow through planning, an approval pause, a Counterdex calculation, and a report. Live run record

Grok Bot. We scheduled one overnight browser QA run. It checked whether a new study opened empty, whether the concentration sample loaded, and whether the reset cleared it. Four checks passed. The fifth caught something the screenshots couldn’t show: the form looked empty after reset, but a screen reader would still hear a label describing the old sample and its parameter range. Grok saved the reproduction steps and screenshots, then paused the routine. QA evidence in the Devpost gallery

Hackathon Experience

At Princeton, I worked with three teammates to bring the scientific engine, backend, and study interface together. One late surprise was that the landing page could look fine while Start a study returned a 502. Vercel was serving the landing page, but the research backend was running on my Mac through a temporary Cloudflare tunnel. When the tunnel dropped, we had to restore it, update Vercel’s upstream address, and test the actual study flow again.

I also asked researchers what made a follow-up measurement worthwhile in practice. Dr. Xiao explained how much time can go into aligning an ultrafast optical setup before a reading is possible. Rishika Porandla ’28 shared feedback on comparing models when noise and detection sensitivity matter. That feedback shaped the question we put on the next-measurement screen: given the settings and precision you can achieve, would another observation actually help you decide between these explanations?

Top comments (1)

Collapse
 
arnavm10 profile image
Arnav Mittal •

Leave feedback below!