  We describe an optimized, self-correcting procedure for the Bayesian
inference of pure quantum states. By analyzing the history of measurement
outcomes at each step, the procedure returns the most likely pure state, as
well as the optimal basis for the measurement that is to follow. The latter is
chosen to maximize, on average, the fidelity of the most likely state after the
measurement. We also consider a practical variant of this protocol, where the
available measurement bases are restricted to certain limited sets of bases. We
demonstrate the success of our method by considering in detail the single-qubit
and two-qubit cases, and comparing the performance of our method against other
existing methods.
