Stochastic and deterministic finite-time system identification