I have about 100 7x7 matrices of dependent variables (so 49 dependent variables). My independent variable is time. I am doing a physics project in which I am supposed to get a matrix function (every element of the matrix is a function of time) by solving an ODE. I used numpy's ODE solver which goves me numerical answers of my matrix function evaluated at different times. Now with these matrices and times I want to find a time-dependent expression for each element matrix to get the time-dependent matrix. I have heard that what I should do is find a hat matrix and I guess that the predicted or fitted values would be my 7x7 matrices and the response values would be the array of times. So how can I find this hat matrix in Python?
I was originally thinking of doing polynomial regression in scikit-learn using their LinearRegression model. Will that work? Is there a possible way in StatsModel, or better, in scipy or numpy?
Basically I want to go from:

to:

Clearly, I will use more test cases, but this is the overall idea. So I will have univariate X (X will be an array of the different times) and multivariate Y (Y will be the matrices evaluated at different times)
In the above example, t=1 would be included in the X array and the Y array would have the first matrix