chc.marketplace¶
Stability tier: evolving.
Offline causal decision-making under equilibrium interference.
The problem, end to end: learn an incentive policy from confounded, switchback-logged marketplace data where (a) the logging policy is confounded (operators already incentivise busy zones, so demand drives both treatment and outcome), and (b) SUTVA fails because drivers are mobile -- incentivising a zone pulls drivers from its neighbours through a shared equilibrium (Munro-Wager-Xu market-equilibrium interference; Wager-Xu supply cannibalisation; shared-state DML, arXiv 2504.08836). Three failure modes, each a real baseline:
- predictive / MOPO fits an outcome model on the confounded logs -- confounding inflates the response of already-busy zones, so it over-allocates to them (where drivers only cannibalise).
- naive causal adjusts each zone for its own demand (a backdoor) but assumes SUTVA -- it allocates by local uplift, double-counting drivers the market cannot supply (predicts a lift it never gets). The adjustment removes part of the confounding, not all: the logging policy splits one budget by every zone's demand, so a zone's incentive also follows the others' demand, which draws drivers from it too. Against the logs rerun with incentives that do not follow demand, it removed 28-91 % of the predictive response's excess on 30 markets (median 63 %).
- CHC adjusts each zone for its own demand and the shared exposure and plans through the
structural equilibrium (
chc.games) with an offline-pessimism margin (a Wasserstein/DRO-style shrink by the estimate's influence-function SE), so cannibalisation is built in and extrapolation is not trusted.
What the comparison measures: pessimistic_equilibrium_allocation plans through the
equilibrium fit_equilibrium estimates from the logs, passed as equilibrium= (ADR 0114),
never through the simulator's own base demand, attractiveness and equilibrium map, which no log
supplies: through those, a response of zero planned as close to the oracle as the adjusted
one, so the comparison measured knowing the equilibrium. The SUTVA baselines get no such
structure. The plan's value is the fitted equilibrium's. The default objective reads no response:
on 30 markets in float64 its plan won 0.971 of the best plan's lift on 400 blocks (0.920 to 1.000)
and 0.914 on 50 (0.802 to 1.000), the best plan being the exact oracle's
(SharedStateMarket.oracle_allocation). The opt-in tilted objective reads the adjusted
response, and its tilt moved the share by -0.002 +- 0.003 on 400 blocks against a response of
zero (mean +- standard error; -0.08 to +0.03), and by -0.044 +- 0.019 on 50 (-0.41 to +0.12).
Where the market lies outside the fitted class, its attractiveness fixed while the demand moves,
the default plan won 0.88 of the lift on average over 100 logs of 400 blocks (median 0.85, at
worst 0.71), the tilted plan 0.76 (median 0.84, at worst -1.19), and the tilt cost share: 0.83 with
a response of zero. Up to 1.2.0 the expected plan lost 8.4 times the lift on one of those logs,
where the fit read an attractiveness of -1.5e12 for a zone it does not identify and the solve's
leftover drivers there swamped the expectation's variance. Up to 1.1.0, whose tilted plan was
ascended from
the even split alone, these read -0.022 +- 0.012, -0.057 +- 0.025, and 0.73 against 0.79
(ADR 0134; through a fit that stopped early, 0.72 against 0.40). The fit warns on such a market,
and the planner refuses a fit whose drivers do not tell an incentive from none (ADR 0123).
Everything is differentiable and reuses the equilibrium solver in chc.games.
Payment = Literal['lump_sum', 'per_driver']
module-attribute
¶
How SharedStateMarket pays its incentives: a lump sum per zone, sum(u) the money
paid, or a rate per driver, sum(u * x(u)) the money paid.
DitherReference = Literal['wild', 'f']
module-attribute
¶
What dither_check refers its Wald statistic to: "wild", a wild bootstrap of it, or
"f", the F distribution.
PlanObjective = Literal['tilted', 'expected']
module-attribute
¶
What pessimistic_equilibrium_allocation maximises: the fit's completions with the
response's tilt, or the fit's expected completions under its own uncertainty, the default.
SharedStateMarket
dataclass
¶
Mobile drivers reach a congestion equilibrium; the platform allocates a fixed budget.
The shared state is the equilibrium driver distribution x(u) (sum x = mass is conserved,
so an incentive to one zone is a driver taken from the others -- the interference channel).
attract is aligned with demand so the zones a naive allocator wants to feed (high local
uplift) are the already-saturated ones, where extra drivers only cannibalise.
payment says what the budget pays for. "lump_sum", the default and the published world,
pays u_i to zone i whatever its drivers: the money paid is sum(u). "per_driver",
opt-in and experimental, pays u_i to each driver in zone i, as the drivers' utility
reads it: the money paid is sum(u * x(u)) (spend). The plans the lump sum budgets
are a sum of rates no incentive programme pays; paid per driver, the shares the budget reaches
are convex, and the plug-in plan through a fit is a convex program,
chc.games.per_driver_congestion_allocation on the fit's game. Its logs split each
block's money, not its rates, and pessimistic_equilibrium_allocation and
sutva_allocation, which split a lump sum, refuse it.
completions(u)
¶
Total realised rides = sum_i min(demand_i, drivers_i) at the equilibrium.
spend(u)
¶
The money the incentive u pays: sum(u) as a lump sum, sum(u * x(u)) paid per
driver, x(u) the equilibrium's drivers at the base demand.
oracle_allocation()
¶
The allocation that completes the most rides at the market's equilibrium, with full model access, its money paid at most the budget: the regret reference.
Paid as a lump sum it is exact (chc.games.exact_congestion_allocation); paid per
driver it is the convex program's optimum,
chc.games.per_driver_congestion_allocation, whose duality gap certifies it. Its
value moves with the machine only through the equilibrium solve, to about its tolerance
of 1e-6. The ascent it ran before 0.22.0, a local maximum at best, is
chc.games.stackelberg_allocation.
generate_logs(n_blocks, key, *, dither=0.0)
¶
Confounded switchback logs, shape (n_blocks, n_zones): each block draws a demand
season and a budget scale (switchback), assigns a demand-chasing (confounded) allocation,
and records the shared-state exposure aggregate and realised completions.
Paid per driver, a block's rates are scaled so that its drivers are paid the budget scale's
share of the budget, and spend, each block's money paid, is logged beside them.
dither, opt-in, moves the logging policy's logits by +-dither: each block draws
n_zones // 2 signs of each kind, a 0 on an odd zone out, so every incentive stays
positive and each block's total of the rates holds (paid per driver, the money paid moves
with the dither, to first order by nothing on average). The logits' shift is logged as
dither, which dither_check reads. The signs come from a stream of the block's
key apart from its other draws, so the demand, the scale and the noise are those of the
logs without a dither. With no dither the logs are the published ones, bit for bit, and
carry no dither.
Raises:
| Type | Description |
|---|---|
ValueError
|
on a dither that is not a finite non-negative number. |
ExposureResponse
dataclass
¶
A calibrated per-zone incentive response dY/du plus its influence-function SE.
se is each zone's HC0 sandwich, White's heteroskedasticity-robust standard error with no
small-sample correction: right as the log grows, short in a short one. On
SharedStateMarket(seed=0) read by calibrate_naive_causal, marginal +- 1.96 se
held the slope of three logs of 40,000 blocks in 91.3% of the twelve zones' reads over 300 logs
of 400 blocks (MC SE about 0.5%), 79% in the worst zone, whose slope spread 1.18 times its mean
se; about the reads' own mean, 91.8%. HC3's leverage correction raised that to only 92.1%.
Over 150 logs of 4,000 blocks it held in 94.2%, and in 95.0% over another 150. A pessimism
radius in units of se (sutva_allocation,
pessimistic_equilibrium_allocation) discounts less than its normal quantile says in
logs that short.
BudgetScaleResponse
dataclass
¶
The completions' slope on the block's total incentive: what logs whose only randomised move
is the budget's scale identify without a model (calibrate_budget_scale).
GradientDitherCheck
dataclass
¶
A Wald test of the fit's gradient in the incentive, read off a zero-sum dither
(dither_check). Experimental. Named DitherCheck before 0.24.0, a name
chc.decision.DitherCheck, a different test, also holds.
DitherSize
dataclass
¶
The dither a study logs, sized from a pilot fit (dither_size). Experimental.
FittedEquilibrium
dataclass
¶
A congestion equilibrium estimated from logs by fit_equilibrium.
Drivers settle at x = mass * softmax(beta * (attract * demand + u - congestion * x / mass))
and a zone completes min(demand, x), the model class SharedStateMarket simulates,
with each zone's attractiveness proportional to its demand. The planning demand is each zone's
mean logged demand, the typical block's.
calibrate_predictive(logs)
¶
MOPO-style: regress completions on the incentive per zone, ignoring the demand confounder.
calibrate_naive_causal(logs)
¶
Backdoor per zone: adjust each zone for its own demand, and assume SUTVA (no shared state).
The adjustment leaves the confounding that runs through the other zones' demand (see the module).
calibrate_shared_state(logs)
¶
Shared-state calibration: adjust each zone for its own demand and the shared exposure aggregate, the block's total incentive, so the marginal reads the zone's response at a fixed total, net of the cannibalisation the total absorbs.
It is not de-confounded. A block's incentives are its total split by a softmax of every zone's
demand, so at a fixed total and a fixed own demand a zone's incentive moves only with the other
zones' demand, which draws drivers from it too. Holding the total takes out the randomised
budget and keeps that part. Against its logs rerun with incentives that do not follow demand, it
read 0.20 to 0.59 higher on 30 markets at either precision, where calibrate_naive_causal
read up to 0.33 higher. pessimistic_equilibrium_allocation reads it only through the
tilted objective's tilt, -min(max(marginal, 0), radius * se); its default objective reads
no response.
calibrate_budget_scale(logs, *, equilibrium=None)
¶
The one response the logs identify with no model: completions per unit of the block's total incentive, along the split the logging policy made.
SharedStateMarket.generate_logs draws each block's budget scale independently of its
demand and splits it by a softmax of every zone's demand. Given the demand, the scale is the
only randomised move, so the slope of a zone's completions on the block's total, its own demand
held, is unconfounded for sum_j (dY_i/du_j) pi_j, the response along the logged split
pi, averaged over the blocks with the weights an OLS slope puts on a uniform regressor
(Yitzhaki 1996). The demand is held only to narrow the error. Neither the n x n response
nor a zone's response net of what it draws from the others is identified from one randomised
number per block (Berry and Haile 2014); only a model reads them, as fit_equilibrium's
does. calibrate_shared_state holds this very total fixed, which takes out the
randomised move.
With equilibrium, BudgetScaleResponse.z compares the total's slope with the one the
fit's own completions read at the logged blocks: a check of the model along the one randomised
direction, and a weak one. The slope is one number per market, and a fit of the wrong class can
match it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs
|
dict[str, Array]
|
|
required |
equilibrium
|
FittedEquilibrium | None
|
a fit to check against the logs, |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
on columns that are not finite matrices of one shape, or an equilibrium whose zones are not the logs'. |
dither_check(logs, equilibrium, *, level=0.05, power=0.8, reference='wild', draws=1999, seed=0)
¶
Whether the fit's gradient in the incentive is the logs', read off the dither
SharedStateMarket.generate_logs logs (Wager and Xu 2021's local perturbations).
Experimental.
The dither moves each block's rates by du, to first order u0 * (shift - pi . shift)
(_undithered), zero-sum and of mean zero given the block's demand and scale. The
block's completions less the fit's prediction at the logged rates are regressed on du in
n_zones - 1 of its coordinates and an intercept. Where the fit is right the residual does
not follow du and the coefficients are zero; where its gradient errs by e, they read
e in the zero-sum directions, which is what a plan on a fixed budget reads. The fit's
prediction as an offset makes the test model-assisted: the completions' variation with the
demand and the scale leaves the residual, which the design-based reading, on the completions
alone, keeps.
The Wald statistic, with the HC3 sandwich, is referred by default (reference="wild") to a
wild bootstrap of itself (Wu 1986; Davidson and Flachaire 2008): draws copies of the
residual under the null's fit, its mean plus Rademacher signs times its deviations from it,
each regressed and tested as the logs are. The p-value is (1 + count) / (1 + draws),
count the copies at or above the logs' statistic; its Monte Carlo error at p is
sqrt(p * (1 - p) / draws), 0.0049 at 0.05 and 0.0022 at 0.01 with the default 1999 draws,
and seed seeds the signs. reference="f" refers it to F on n_zones - 1 and
n_blocks - n_zones degrees, the reference before 0.24.0, which treats the sandwich as
known: with 12 regressors its own noise is not small at a few blocks a direction (Long and
Ervin 2000). With the true fit, a dither of 0.3 and 400 logs a cell (Monte Carlo standard error
about 1.1% at 5% and 0.5% at 1%), the share of logs rejected at 5% and at 1%, 12 zones:
| market | blocks | wild, 5% | wild, 1% | F, 5% | F, 1% |
|---|---|---|---|---|---|
| 3 | 25 | 0.075 | 0.025 | 0.145 | 0.068 |
| 3 | 44 | 0.045 | 0.003 | 0.107 | 0.052 |
| 3 | 50 | 0.055 | 0.013 | 0.125 | 0.052 |
| 3 | 100 | 0.045 | 0.010 | 0.100 | 0.037 |
| 3 | 400 | 0.043 | 0.003 | 0.055 | 0.018 |
| 7 | 25 | 0.037 | 0.003 | 0.138 | 0.060 |
| 7 | 44 | 0.048 | 0.007 | 0.113 | 0.048 |
| 7 | 50 | 0.052 | 0.013 | 0.113 | 0.055 |
| 7 | 100 | 0.068 | 0.015 | 0.105 | 0.040 |
| 7 | 400 | 0.028 | 0.005 | 0.050 | 0.010 |
On 5 zones and 16 blocks (market 3) the wild bootstrap rejected 0.035 and 0.013. Below 4
blocks a tested direction, 44 for 12 zones, the check refuses: at 25 the bootstrap still
rejected 7.5% at 5% on market 3. The power, at 5%: a gradient error of norm 1.28 on market 3
and 50 blocks, in the direction of the error covariance's largest eigenvalue, the hardest to
find, was found on 50.0% of 400 logs by the wild bootstrap and on 79.0% referred to F, whose
share is in part its excess size; of norm 2.55, on 98.0% and 99.8%; the error
0.4 * linspace(-1.5, 1.5, 12), of norm 1.30, on 100 blocks on every log of markets 3 and 7
by both.
minimum_detectable is sqrt(lambda * l_max), lambda the noncentrality at which a
chi-square on n_zones - 1 degrees exceeds the reference's critical value with power,
l_max the largest eigenvalue of the error's covariance: the least norm of an error the test
finds in every direction, read as if the sandwich were known. Under the wild bootstrap the
critical value is its draws' 1 - level quantile, above the chi-square's at few blocks, so
the norm grows with it; under "f" it is the chi-square's, the F's limit in the blocks. On
market 3 at 50 blocks an error of the median norm read under the null, 2.55, planted in the
direction of the largest eigenvalue, was found at 5% on 98.0% of 400 logs where power asked
80%: the norm errs large, not small. It and
FittedEquilibrium.lack_of_fit read different things: the F test the residuals' level,
the dither the gradient a plan follows. validation/marketplace_dither.mac checks the first-
order move, its zero mean and its second moment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs
|
dict[str, Array]
|
|
required |
equilibrium
|
FittedEquilibrium
|
the fit to test, |
required |
level
|
float
|
the test's size, in (0, 1). |
0.05
|
power
|
float
|
the power |
0.8
|
reference
|
DitherReference
|
what the Wald statistic is referred to: |
'wild'
|
draws
|
int
|
the wild bootstrap's draws, at least 1. |
1999
|
seed
|
int
|
the seed of the wild bootstrap's signs. |
0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
on columns that are not finite matrices of one shape, negative rates, logs with no dither, an equilibrium of other zones, fewer than 4 blocks a tested direction, a level or a power outside its range, a reference that is neither, or no draws. |
dither_size(logs, equilibrium, *, error, blocks=None, level=0.05, power=0.8, max_cost=0.01, draws=16, seed=0)
¶
The smallest dither at which dither_check finds a gradient error of norm error
with power at level on blocks blocks, from a pilot's logs and fit; or, where that
dither costs more than max_cost of the logged completions, the blocks the study needs at
the dither that costs that much. Experimental.
The rule: a study pre-registers the error it must find, the gradient error that would cost
its tolerance of the plan's lift. A plan on a concave objective of curvature H along the
budget, read with its gradient off by e, loses e' (-H)^-1 e / 2, at most
|e|**2 / (2 * k), k the least eigenvalue of -H; so the error that costs a share
tau of a lift L is sqrt(2 * k * tau * L). The dither that finds it is
h = sqrt(lambda * rho / N) / error: lambda the noncentrality at which the test has the
power, N the blocks, and rho / (N * h**2) the largest variance of the test's error,
rho the largest eigenvalue of G^-1 K G^-1 in the zero-sum coordinates, where G and
K are the pilot blocks' means of the dither's second moment M_b and of r_b**2 M_b,
r_b a block's residual about its mean. Per unit of h, the balanced signs have the
covariance c_n (I - 11'/n), c_n = n/(n - 1) for an even count of zones and 1 for an
odd one, so M_b = c_n D(u0) (I - 1 pi')(I - pi 1') D(u0). The cost is what the fit says
the dither loses: its completions at the undithered rates less at draws dithers a block,
over the pilot blocks, as a share of the logged completions. Where it exceeds max_cost
the dither is cut to the size that costs max_cost and the blocks grow as (h / size)**2:
a capped perturbation is a rate constraint, and the remedy is a longer study, not a larger
move. validation/marketplace_dither.mac checks M_b, c_n and the loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs
|
dict[str, Array]
|
the pilot's |
required |
equilibrium
|
FittedEquilibrium
|
the pilot's fit, |
required |
error
|
float
|
the norm of the gradient error to find, positive. |
required |
blocks
|
int | None
|
the study's blocks; the pilot's where None. |
None
|
level
|
float
|
the test's size, in (0, 1). |
0.05
|
power
|
float
|
its power at |
0.8
|
max_cost
|
float
|
the share of the logged completions the dither may cost, positive. |
0.01
|
draws
|
int
|
dithers drawn a pilot block to read the cost. |
16
|
seed
|
int
|
the cost's draws' seed. |
0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
on logs or an equilibrium |
sutva_allocation(market, response, radius)
¶
Baseline allocation: fund zones by their pessimistic local uplift (the SUTVA assumption).
Raises:
| Type | Description |
|---|---|
ValueError
|
on a market that pays per driver, whose budget is not a sum of rates; on a radius that is not a finite non-negative number. |
fit_equilibrium(logs, *, max_iter=500)
¶
Estimate the congestion equilibrium the logs were generated under, by least squares.
The fitted model is FittedEquilibrium's: per zone, an attractiveness per unit of
demand, and for the market, the drivers' sensitivity, the crowding penalty and the drivers'
total, n_zones + 3 parameters, fitted to each block's completions y through each
block's equilibrium under its logged incentive u and demand. The positive parameters are
fitted on their logarithms, by L-BFGS on gradients implicit in the equilibrium; the solve
starts from an attractiveness of 1, a sensitivity and a penalty of 1, and a total 1.2 times
the largest block's completions, since a block completes no more rides than it has drivers.
Levenberg-Marquardt and Gauss-Newton steps on the blocks' residuals then polish it until the
step left is a thousandth of the radius of the parameters' confidence region (Bates and Watts'
relative offset, 1981). L-BFGS alone stopped on the relative fall of its objective, 2.2e-9 of
1 where the mean squared residual is 4e-4, and said it converged: on markets 0-3 at offsets of
0.08 to 2.6, its mean squared residual up to 2.1% above the polished fit's.
The demand is logged and enters the model, so the logging policy's chase of it does not
confound the fit. What is assumed: the model class, which is the simulator's, and an
attractiveness that moves with the demand. Neither is proved, but a market that breaks them
leaves its mark on the residuals, and FittedEquilibrium.lack_of_fit reads it: an F test
of each zone's residual on its own demand and incentive to the second order. Below 0.01 the
fit warns. On 20 logs of 400 blocks from five markets whose attractiveness stays put while the
demand moves, the fit converged on every one with the sensitivity 0.54 too high on average
(1.17 at most), its residual 2.4 to 3.1 times the noise's, and nothing said; the test read
below 3e-226 on each, and below 1e-15 on 20 logs of 50 blocks. On 50 logs of the class itself
it read under 0.01 once (0.009) at 400 blocks, and never at 50.
The fit is then fitted again with every incentive at zero, and
FittedEquilibrium.incentive_z is Vuong's z of what the incentives gain, block by
block: a fit whose drivers do not tell an incentive from none plans nothing, and
pessimistic_equilibrium_allocation refuses it. On the same markets' logs with the
incentives shuffled across the blocks, the planner had spent the whole budget through the fit,
and on some markets lost completions by it; its z read -5.0 to 1.0 on 400 blocks and at
most 1.28 on 50, under the one-sided 5% quantile 1.645 on all 40, where the logs themselves
read at least 11.7 and 3.3, and the markets outside the class at least 14.2 and 3.8.
The fit reads its n_zones + 3 parameters from at least as many blocks: on five markets of
12 zones, 3 blocks read the sensitivity 1.7 off at the median and 94 at worst, and 15 blocks
0.055 and 0.26. A zone that draws
almost no drivers in any logged block tells little of its attractiveness: the default market's
zone 8 averages 0.0008 drivers on a demand of 0.50, and its attractiveness read 0.73 for 0.63
on 400 blocks and 0.67 on 6400, where moving it from 0.63 to 0.95 moves the mean squared
residual by 1e-10 of its 4e-4. On short logs such a zone's attractiveness is read by little
but the fit's own path: on 50 blocks of markets 0-29, four fits read a zone's more than 1 off
and one ran it to -4.8e4, the logs' drivers there no fewer for it.
FittedEquilibrium.attract_se is each zone's standard error from the Gauss-Newton
covariance s**2 (J'J)^+ at the fit, J the drivers' Jacobian in the parameters on the
blocks where a zone is below its demand, s**2 the mean square of the residual over the
blocks' zones less the rank. A zone whose direction the pseudo-inverse drops, for want of any
block that moves its drivers, reads inf. Of the 60 fits in float64 five read a zone's
error infinite or above its attractiveness's size: those four, and on 400 blocks one zone read
-0.01 with an error of 0.40. pessimistic_equilibrium_allocation holds such a zone at
zero incentive.
FittedEquilibrium.covariance is the parameters' block-clustered sandwich
H^-1 M H^-1 (Cameron and Miller 2015): H the Gauss-Newton matrix on the same rows, M
the blocks' scores, so the zones' errors within a block may correlate. It is read over the zones
the planner does not hold and the three market parameters, the held zones' attractiveness
fixed at the fit, and is nan where the logs leave a combination of those unread.
FittedEquilibrium.demand_covariance is the planning demand's. The planner's expected
objective reads both; the tilted one reads neither. Over 100 logs of 400 blocks of market 0
(market 1), its 95% intervals held the sensitivity, the penalty and the total in 99% (96%),
98% (96%) and 96% (97%) of the logs, and the median zone's attractiveness in 96% (94%), the
worst zone's in 83% (87%). On 50 blocks of market 0, in 94%, 95% and 89%, and 96% at the median
zone; a zone that draws almost no drivers, held on 64 of those logs, in 64% of the rest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs
|
dict[str, Array]
|
|
required |
max_iter
|
int
|
L-BFGS iterations at most, before the polish. |
500
|
Raises:
| Type | Description |
|---|---|
ValueError
|
on columns that are not finite matrices of one shape, fewer blocks than parameters, or a demand that is not positive. |
Warns:
| Type | Description |
|---|---|
UserWarning
|
where |
pessimistic_equilibrium_allocation(market, response=None, *, radius=1.0, steps=600, equilibrium, objective='expected')
¶
CHC allocation: plan the budget through the congestion equilibrium (chc.games) so the
driver-conservation (cannibalisation) channel the SUTVA baselines assume away is structural. By
default the plan maximises the completions the fit expects under its own uncertainty, which
hedges each zone's kink at its demand; on request, objective="tilted", the adjusted
response gates it through a W-DRO pessimism tilt (radius * SE): where the offline estimate
is weak or unsupported, the incentive is discounted rather than trusted.
A zone whose attractiveness the fit does not identify, its
FittedEquilibrium.attract_se infinite or above the attractiveness's size, is held at
zero incentive, and the budget is planned over the rest: the logs do not say what an incentive
there buys. Such a zone draws almost no drivers in any logged block; on 50 blocks of market 2
the plan had spent 3.1 of the budget of 6 on one and won 0.15 of the exact oracle's lift.
equilibrium is the one planned through, and is required, a keyword with no default:
fit_equilibrium's, estimated from the logs. market gives only the budget and the
zones; its own base demand, attractiveness and solver are the simulator's truth, which no log
supplies, and the planner does not read them. response and radius enter only through
the tilt.
objective chooses what the plan maximises. "expected", the default since 1.3.0, is the
fit's expected completions under its own uncertainty, S(u) = sum_i E[min(D_i, X_i(u))],
X_i - D_i normal about the fit's drivers less the planning demand, of variance
g_i' C g_i + h_i' C_d h_i: C the fit's sandwich (FittedEquilibrium.covariance)
over the zones it identifies and the market's parameters, C_d the planning demand's
(FittedEquilibrium.demand_covariance), g_i and h_i the drivers' Jacobians in
them, in closed form. Each term is the normal loss function
(validation/marketplace_expected_completions.mac). A plug-in plan sits on each zone's kink
at its demand, where an error in either direction costs (Liyanage and Shanthikumar 2005); the
expectation hedges it. It reads no response: leave response out, since one given is
refused rather than planned as if it were read. Nearly all of the hedge is the demand's error:
at the plan the parameters' SD per zone is 0.07 to 0.18 of the demand's (markets 0-9). What it
assumes: the drivers' error is normal, the fit's parameters and its planning demand are
uncorrelated though read from the same logs, and a plan is scored at the planning demand. A fit
outside its class, which warns, can read an absurd attractiveness for a zone it does not
identify, -1.5e12 on one of 100 such logs; held at zero incentive, such a zone's share is 0 and
adds nothing to the variance, where up to 1.2.0 the solve's leftover drivers there did and the
plan lost 8.4 times the lift. "tilted", the default up to 1.2.0, is the fit's completions
plus the response's tilt, and needs a response: pass objective="tilted" with one to keep
those plans.
Either objective is ascended steps times from the even split and from the fitted game's
exact optimum (chc.games.exact_congestion_allocation), and the plan better on it is
kept: one ascent alone stops on a kink short of what is reachable. On markets 0-29, logs of 400
blocks, the expected plan won 0.971 of the exact oracle's lift on average in float64, where the
tilted plan won 0.948 (more on 14 markets, less on 1, by 0.018), and 0.984 in float32 against
0.941 (more on 20, less on 1, by 0.015), neither less than the naive plan on any; on logs of 50
blocks in float64, 0.914 against 0.815 (more on 24, less on 2, by 0.031). Up to 1.1.0
the tilted objective was ascended from the even split alone and won 0.900 and 0.907; on float32
market 18 its surrogate stopped at 9.83 where 10.67 is reachable, and it won 0.735, below the
naive plan's 0.805, where it now wins 0.978. In float64 the second start raised the tilted
plan's share on 17 markets and lowered it on 3, by up to 0.079, its surrogate higher on each of
them: the surrogate is the fit's, not the market's.
Raises:
| Type | Description |
|---|---|
ValueError
|
on a market that pays per driver, whose budget is not a sum of rates; on a
radius that is not a finite non-negative number; on a
response or an equilibrium whose zones are not |
TypeError
|
when |
Warns:
| Type | Description |
|---|---|
UserWarning
|
where the fit's |
interference_bias(market, response, allocation)
¶
SUTVA over-count: the lift a per-zone (additive) model predicts minus the lift realised at the equilibrium -- the interference the naive planner ignores (positive = over-prediction).