Closed amw5g closed 3 years ago
@amw5g Look into the `pygam._linear_predictor' function. You are not creating the model matrix as par the code. After creating the model matrix, according to b-spline or whatever basis you have used to create the coefficients, you have to dot multiply the coefficients with the model matrix.
I'm trying to replicate the predict_mu function for a LinearGam outside of python. Specifically, I have the values from
coef_
and a corresponding vector of candidate input values. I would expect to multiply the two, sum them, and get the predicted value. But something's going wrong. Mycoef_
looks like this (adjusted so that each row represents a feature, and multiple values in a row represent spline coefs):And my vector of inputs looks like this:
Multiplying the input by each coefficient, and summing yields 302988.
predict_mu
yields 12.97.What step am I missing?