I'm trying to find the goodness of fit for a model I have generated.
Premise:
I used scipy.optimize.minimize to find the coefficients of the following regression:
Y = B * X + e
where B and X have between 3 and 5 elements depending on the iteration.
I used the minimize package to comply with the following constraints
b >= 0
sum(b) = 1
Therefore, now as I know the value of the coefficients, I need to calculate the r-sq to assess which model has the best fit. Is this possible to do in python?