harbor run -t bespokelabs/sketched-newton-cov-estimatorharbor download bespokelabs/sketched-newton-cov-estimatorEstimate the optimizer's limiting covariance matrix $\Xi$ from the records of one run.
The fixed optimizer in /app/harness/runner.py processes one linear regression sample at a time.
Its final estimate varies across repeated runs. After scaling by the final step size, that
variation approaches a normal distribution with covariance matrix $\Xi$:
$$ \sqrt{1/\alpha_t},\left(x_t - x^\star\right) ;\Rightarrow; N(0, \Xi) \quad \text{as } t \to \infty, $$
The grader checks the variance that your matrix gives for the fixed direction $w = (1/d, \ldots, 1/d)$.
At each step, the optimizer gives you its current estimate, step size, gradient, Hessian, running
Hessian average, and sampled sketch indices. /app/harness/runner.py defines this process.
Write /app/output/estimator.py with this function:
def estimate(stream, config) -> numpy.ndarray:
The function gets one pass over the records from one run. It must return an estimate of $\Xi$.
The direction $w$ is also available as config["w"].
stream is an iterator over exactly T records, one per iteration, in order. Each record is a
dict whose arrays are read-only and stay valid for as long as you hold them.
| key | shape | meaning |
|---|---|---|
t |
int | iteration index, 0 .. T-1 |
x |
(d,) |
x_{t+1}, the iterate after this step's update |
alpha |
float | the realized stepsize alpha_t |
g |
(d,) |
the stochastic gradient at x_t |
H |
(d, d) |
the sample Hessian at x_t |
B |
(d, d) |
the Hessian average B_t this step's inner solve used |
sketch_idx |
(tau,) |
the Kaczmarz indices this step's inner solve drew |
config also contains d, T, tau, q, sketch, beta, c_beta, loss, x0, B0, and
w. It does not reveal the instance's design covariance, noise scale, x_star, or seed.
estimate in /app/output/estimator.py. Everything else under /app/output/
travels with it: helper modules are importable, and .npy/.npz files load normally. Nothing
outside that directory reaches the grader.(d, d) array that can be converted to float64. Every entry must be finite. The
grader reads it as float64 and uses only $w^\top \hat\Xi w$.numpy and scipy are installed. There is no network.$$ \text{error(instance)} = \left| \operatorname{mean}{\text{replications}} \left( \frac{w^\top \hat\Xi w - v}{v} \right) \right|, \qquad \text{metric} = \operatorname{mean}{\text{instances}}\big[\text{error(instance)}\big] \quad \text{(lower is better)} $$
1.0. This is the same error
as an all-zero matrix./app/harness/dev/ has:
inst_*.json: full parameters (equi_r, sigma, x_star, tau, seed_base).inst_*_xi_star.npy: that instance's exact Xi.Build a stream for one of them with
cfg = runner.make_config(inst["d"], inst["T"], inst["tau"])
stream = runner.make_stream(inst, cfg, sample_seed, alg_seed)
The grader builds its own streams from the same frozen runner and grades its own copy, so
editing /app/harness/ changes nothing.
Every instance, sealed or development, comes from one procedure: