A diet-tracking algorithm that recalculates protein/carb/fat targets each week from measured weight-trend data, not just a fixed formula
Every adaptive diet algorithm needs somewhere to start. Before any real-world data exists, the system falls back on a population-derived predictive equation — Mifflin-St Jeor (or Katch-McArdle when body-fat percentage is known) — multiplied by an activity factor to produce a first-guess calorie target and macro split. This estimate is deliberately treated as a hypothesis to be tested, not a fact.
Mifflin-St Jeor (1990) is the most accurate widely-used BMR equation for the general population:
Men: BMR = 10×kg + 6.25×cm − 5×age + 5 Women: BMR = 10×kg + 6.25×cm − 5×age − 161
For a 78kg, 165cm, 32-year-old woman: BMR = 780 + 1,031 − 160 − 161 ≈ 1,490 kcal.
When body-fat percentage is known (from DEXA, BIA, or calipers), the Katch-McArdle formula is often preferred because it estimates expenditure from lean mass alone, which is more physiologically direct:
BMR = 370 + 21.6 × lean mass (kg)
Either BMR is then multiplied by a Physical Activity Level (PAL) factor — roughly 1.2 for sedentary, 1.375 for lightly active, 1.55 for moderately active, up to 1.9 for very active — to produce the initial TDEE estimate that the whole adaptive system starts from.
These equations have a published error margin of roughly ±10% even before individual metabolic variation is considered. That uncertainty is exactly why an adaptive algorithm exists: the formula gives a reasonable starting point, not a verdict.
Once an initial TDEE and a target deficit (commonly 300–750 kcal/day for ~0.3–0.7kg/week of loss) are set, the calorie budget is divided into three macronutrients:
• Protein is set first, in grams per kilogram of bodyweight — typically 1.6–2.2 g/kg for someone in a calorie deficit, because adequate protein is the single strongest dietary lever for preserving lean muscle mass while losing fat. For the sample user: 78kg × 1.8 = 140g (560 kcal).
• Fat is set next, usually with a floor around 0.6–0.8 g/kg to protect hormone production, then
• Carbohydrates fill the remaining calories after protein and fat are subtracted from the total target.
At this stage the split is essentially a reasonable default — the same way the TDEE number is a default. Both will be revised once real data starts coming in from the user's own body.
A predictive formula means nothing until it is checked against reality. The algorithm now needs two data streams from the user: daily logged calorie intake (from food tracking) and daily body weight from the scale. Both are noisy — but weight, in particular, needs careful signal processing before it becomes useful.
Body weight fluctuates far more than actual body-fat mass changes from one day to the next. The main sources of daily noise:
• Glycogen and its bound water: muscle and liver glycogen store roughly 3g of water for every 1g of glycogen. A single high-carbohydrate meal, or a hard training day that depletes glycogen, can shift scale weight by 1–2kg with zero change in body fat.
• Sodium and fluid retention: a salty restaurant meal, hormonal cycles, or heat/hydration status can move water weight by a similar margin overnight.
• Gut contents and bowel timing: the literal mass of food and waste in the digestive tract at the moment of weighing.
Because fat loss itself proceeds at roughly 0.1–0.3kg per day at most (a 500 kcal/day deficit implies about 0.065 kg/day of actual tissue loss), the day-to-day noise from water alone can be 10–20× larger than the true underlying signal. Reading a single day's number as "progress" or "a stall" is close to reading noise.
The standard fix, used by every serious adaptive coaching app, is to replace the single daily weight with a rolling (moving) average over the trailing 7 days:
trend(t) = mean( weight(t−6) … weight(t) )
A 7-day window is chosen deliberately: it is long enough to average out the weekly cycle of weekday vs weekend eating and typical sodium/glycogen swings, but short enough to still react to a genuine multi-week change in trajectory within a couple of weeks. Some tools (MacroFactor, Trendweight) instead use an exponentially-weighted moving average, which reacts slightly faster while still heavily discounting single-day outliers.
Only the smoothed trend line — never the raw daily number — is used as the input to the next stage of the algorithm: comparing measured progress against what the calorie model predicted.
Weighing daily and trusting the trend line (not the number) produces far better long-term adherence and accuracy than weekly weigh-ins, because daily data gives the rolling average more points to average over and makes any single bad reading almost irrelevant.
With a smoothed weight trend and a logged-intake history in hand, the algorithm can finally test its original hypothesis. Energy balance physics gives a simple prediction for how fast weight should change at a given deficit; if the real trend doesn't match, something in the original model was wrong.
The classic dieting rule of thumb states that one pound (0.45kg) of body fat corresponds to roughly 3,500 kcal of stored energy (≈7,700 kcal/kg), derived from the caloric density of adipose tissue. This gives a simple, testable prediction: a sustained 500 kcal/day deficit should produce about 0.45kg (1 lb) of loss per week.
It is a genuinely useful first-order approximation, but it is a static physics conversion, not a model of human metabolism — it assumes the body's energy expenditure stays constant while weight changes, which is not true over multi-week timescales. It also ignores that lost tissue is a mix of fat and lean mass, and that as body weight drops, BMR mechanically drops too, requiring the deficit (or the intake target) to be periodically re-based.
During a sustained calorie deficit, total daily expenditure does not stay fixed at the initial estimate — it typically falls by an additional 5–15% beyond what reduced bodyweight alone would predict. This "adaptive thermogenesis" comes from several compounding effects:
• Reduced NEAT (non-exercise activity thermogenesis): fidgeting, posture, and unconscious daily movement drop measurably during sustained restriction. • Hormonal changes: falling leptin and thyroid hormone (T3) output reduce cellular metabolic rate. • Increased efficiency: skeletal muscle can become more mechanically efficient, burning fewer calories for the same work.
The Minnesota Starvation Experiment (Ancel Keys, 1944–45) first documented this dramatically: men on a semi-starvation diet saw resting metabolic rate fall by roughly 40% relative to bodyweight loss alone. More recently, six-year follow-up data on contestants from "The Biggest Loser" found resting metabolic rate remained suppressed by several hundred kcal/day even years after the show, well below what their post-diet body weight would predict.
A discrepancy between predicted and actual weight trend is not a measurement error to be ignored — it is the most direct evidence available of a person's real expenditure, and it is precisely the signal an adaptive algorithm is designed to detect and act on.
| Product | Indication | Trial Design | Key Result |
|---|---|---|---|
| Week 1 | 2,310 kcal (static) | 2,310 kcal (algorithm has no data yet) | ≈2,280 kcal (true, incl. early adaptation) |
| Week 4 | 2,310 kcal (static, never updates) | ≈2,190 kcal (nudged from trend data) | ≈2,190 kcal (adaptation ≈5%) |
| Week 8 | 2,310 kcal (static, never updates) | ≈2,070 kcal (converging) | ≈2,070 kcal (adaptation ≈10%) |
| Week 12 | 2,310 kcal (still wrong by ~240) | ≈2,040 kcal (near-converged) | ≈2,030 kcal (adaptation ≈12%) |
Rather than replacing the TDEE estimate outright with whatever a single week of noisy data implies, a well-designed adaptive algorithm treats the formula-based estimate as a prior and the measured trend as new evidence, blending the two with a smoothing update — exactly the logic behind a Bayesian or exponentially-weighted filter.
Each week, once the rolling weight trend and total logged intake are known, the algorithm inverts the energy-balance equation to ask: "given how much weight actually changed, what expenditure would have produced that result?"
implied TDEE = average daily intake − (measured weekly Δweight × 7,700 kcal/kg ÷ 7 days)
If someone logged 1,800 kcal/day on average and their trend weight fell by only 0.2kg that week (instead of the ≈0.45kg predicted at a 500 kcal deficit), the implied TDEE is much lower than the model assumed — meaning real expenditure, logging accuracy, or both are different from the starting assumption.
A single week of data is still noisy — one unusually salty or carb-heavy week can swing the rolling trend enough to produce a misleading implied TDEE. Adaptive apps therefore blend the old estimate and the new implied value rather than replacing it outright:
new estimate = old estimate + learning_rate × (implied TDEE − old estimate)
A learning rate of roughly 0.2–0.4 means each week's estimate moves 20–40% of the way toward what that week's data implies, while retaining 60–80% "memory" of prior weeks. This is mathematically equivalent to an exponentially-weighted moving average over the implied-TDEE time series, and functions the same way a Bayesian posterior update blends a prior belief with a new noisy observation, weighted by how much each is trusted.
Logging adherence directly controls how much weight the new data deserves: a highly consistent, low-noise logger can safely use a higher learning rate (faster convergence); a sporadic logger's data is noisier and should move the estimate more cautiously.
MacroFactor's "Expenditure algorithm" and Carbon Diet Coach are the two most widely cited commercial implementations of this exact approach — both explicitly market themselves on recalculating a user's real metabolic expenditure from their own logged data rather than relying on a static formula.
After enough weekly cycles, the gap between the adaptive TDEE estimate and the person's real expenditure shrinks to a small, stable residual — the algorithm has effectively "learned" this individual's true metabolism. From here, only small corrections are needed as the diet progresses and bodyweight (and therefore BMR) continues to decline.
When the algorithm needs to close a gap between the old calorie target and the newly converged, lower (or higher) TDEE estimate, it deliberately does not touch the protein target. Protein intake of roughly 1.6–2.2 g/kg of bodyweight is the single most evidence-backed lever for preserving lean muscle mass during a calorie deficit — cutting it to close an energy gap would undermine the entire point of a body-composition-focused diet, trading fat loss for muscle loss.
Instead, all of the adaptive adjustment is absorbed by the carbohydrate and fat targets, typically split in roughly the same ratio the user started with (e.g., 65% of remaining calories to carbs, 35% to fat), so the overall "feel" of the diet doesn't change dramatically week to week even as the total calorie number shifts.
Convergence isn't a single moment — it's the point where week-over-week changes to the TDEE estimate become small relative to normal data noise, typically after 6–10 weeks of consistent logging. From that point forward:
• The algorithm still updates every week, but the corrections are minor fine-tuning rather than large re-estimates. • As actual bodyweight continues to fall, BMR mechanically decreases too — so a well-designed system keeps nudging the estimate downward slowly even after "convergence," rather than freezing it. • Diet breaks, refeeds, or a plateau in weight loss without a plateau in adherence are themselves new data points that can trigger the next adaptive correction — the algorithm never fully stops learning.
The end result is a set of macro targets that reflect this specific person's real, measured physiology — not a population-average formula — while consistently protecting the one macro (protein) most responsible for keeping the loss mostly fat rather than muscle.