Multipolyfit is poorly documented. The author even mentions the following in their github readme file:
I rarely respond to questions about this repository. It is oddly popular but the implementation is pretty dense and so this project generates a large number of reasonable questions. Unfortunately I don't have time to respond to all of these.
I would care more about this project if it contained a useful algorithm. It doesn't.
Luckily for us, the code in its entirety is less than a hundred lines and pretty easy to navigate through. It creates permutations of the coefficient powers as:
[[2 0 0 0]
[1 1 0 0]
[1 0 1 0]
[1 0 0 1]
[0 2 0 0]
[0 1 1 0]
[0 1 0 1]
[0 0 2 0]
[0 0 1 1]
[0 0 0 2]]
where the columns correspond to the power of [1,hour,day,temp], respectively. So for your coefficients, you get 27011*(1**2) + 771*(1**1 * hour**1) + ...
. You can get this yourself without digging through the code by setting the keyword argument powers_out=True
:
>>> a,powers=multipolyfit.multipolyfit(numpy.vstack((hour,day,temp)).T,
load, 2, powers_out=True)
[array([2, 0, 0, 0]), array([1, 1, 0, 0]), array([1, 0, 1, 0]), array([1, 0, 0, 1]), array([0, 2, 0, 0]), array([0, 1, 1, 0]), array([0, 1, 0, 1]), array([0, 0, 2, 0]), array([0, 0, 1, 1]), array([0, 0, 0, 2])]