Exercise 3.14

Answers

Consider the Qth order polynomial transform ΦQ for X = Rd. Let’s count the terms with exactly q-degree that can be created with x1,x2,,xd. There are total of (q+d1 d1) such terms. See Number of polynomial terms for certain degree and certain number of variables.

So the total terms for the Qth order polynomical transform (which is also the dimensionality d~ of the feature space Z) is (Excluding the constant 1):

d~(d,Q) = q=1Q(q + d 1 d 1) =( d d 1) +( d + 1 d 1) + +( Q + d 1 d 1) =( d 1) +( d + 1 2) + +( Q + d 1 Q) = ((d + 1 1) ( d 0)) + ((d + 2 2) ( d + 1 1) ) + + ((d + Q Q) ( d + Q 1 Q 1) ) =( d + Q Q) 1

Where we have applied the equality: (N k) =( N1 k) +( N1 k1)

from scipy.special import comb 
print('Feature Space Dimensionality') 
ds = [2,3,5,10] 
Qs = [2,3,5,10] 
for d in ds: 
    for Q in Qs: 
        r = comb(d+Q, Q) - 1 
        print('d = ', d, ' Q = ', Q, ''int(r))
Feature Space Dimensionality
d =  2  Q =  2 :  5
d =  2  Q =  3 :  9
d =  2  Q =  5 :  20
d =  2  Q =  10 :  65
d =  3  Q =  2 :  9
d =  3  Q =  3 :  19
d =  3  Q =  5 :  55
d =  3  Q =  10 :  285
d =  5  Q =  2 :  20
d =  5  Q =  3 :  55
d =  5  Q =  5 :  251
d =  5  Q =  10 :  3002
d =  10  Q =  2 :  65
d =  10  Q =  3 :  285
d =  10  Q =  5 :  3002
d =  10  Q =  10 :  184755

User profile picture
2021-12-07 22:25
Comments