How To Add Regression Functions In Python, Or Create A New Regression Function From Given Coefficients?
I have one regression function, g1(x) = 5x - 1 for one data point. I have another regression function, g2(x) = 3x + 4. I want to add these two models to create a final regression
Solution 1:
The prediction generated by this model should be exactly
np.dot(X_test, res_wls.params)
Thus, if you want to sum several models, e.g.
summed_params = np.array([res_wls.params for res_wls in all_my_res_wls]).sum(axis=0)
your prediction should be
np.dot(X_test, summed_params)
In this case there would be no need to use the built-in functions of the estimator.
Post a Comment for "How To Add Regression Functions In Python, Or Create A New Regression Function From Given Coefficients?"