The problem of parameter estimation for an epidemic model is crucial for the forecasting of the infection spread. We discuss an approach for learning the time-variant parameters of the dynamic SIR model from data. We formulate the problem in terms of a functional risk that depends on the learning variables through the solutions of the dynamic SIR. The resulting variational problem is then solved using a gradient flow on a suitable, regularized, functional. We show preliminary results on the estimates performed on COVID-19 data
relative to some Italian regions.