  Estimating the parameters governing the dynamics of a system is a
prerequisite for its optimal control. We present a simple but powerful method
that we call STEADY, for STochastic Estimation algorithm for DYnamical
variables, to estimate the Hamiltonian (or Lindbladian) governing a quantum
system of a few qubits. STEADY makes efficient use of all measurements and its
performance scales as the information-theoretic limits for such an estimator.
Importantly, it is inherently robust to state preparation and measurement
errors. It is not limited to evaluating only a fixed set of possible gates,
rather it estimates the complete Hamiltonian of the system. The estimator is
applicable to any Hamiltonian that can be written as a piecewise-differentiable
function and it can easily include estimators for the non-unitary parameters as
well. At the heart of our approach is a stochastic gradient descent over the
difference between experimental measurement and model prediction.
