We propose an algorithm for electrical source imaging of epileptic discharges that takes a data-driven approach to regularizing the dynamics of solutions. The method is based on linear system identification on short time segments, combined with a classical inverse solution approach. Whereas ensemble averaging of segments or epochs discards inter-segment variations by averaging across them, our approach explicitly models them. Indeed, it may even be possible to avoid the need for the time-consuming process of marking epochs containing discharges altogether. We demonstrate that this approach can produce both stable and accurate inverse solutions in experiments using simulated data and real data from epilepsy patients. In an illustrative example, we show that we are able to image propagation using this approach. We show that when applied to imaging seizure data, our approach reproducibly localized frequent seizure activity to within the margins of surgeries that led to patients' seizure freedom. The same approach could be used in the planning of epilepsy surgeries, as a way to localize potentially epileptogenic tissue that should be resected.