pyGAM
pyGAM copied to clipboard
Unclear about documentation for `generate_X_grid`?
if term is >= 0, we generate n samples per feature, which results in n^deg samples, where deg is the degree of the interaction of the term
n (int, optional) – number of data points to create
I'm finding this a little unclear. Are the n samples chosen randomly? What is their meaning?
Example:
i = 0
XX = gam_kudos.generate_X_grid(term=i,n=100)
plt.plot(gam_kudos.partial_dependence(term=i, X=XX))
The above code generates the following plot.
I know that my _i_th feature is bound between [0,1], and the response variable is bound between [-6, 10]. This leaves me confused with this plot - what is the meaning of the
x
and y
axis?
Am I missing something here? I sincerely appreciate any help.
Update: after some more checking I think the problem comes from the code:
i = 0
XX = gam_kudos.generate_X_grid(term=i,n=100)
plt.plot(gam_kudos.partial_dependence(term=i, X=XX))
print(XX[:,0])
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
For some reason it doesn't pick up the range of my _i_th feature.
could you quickly check which term is your intercept? (Just in case it is an easy fix)