Homepage › Solution manuals › Yaser Abu-Mostafa › Learning from Data › Exercise 3.14
Exercise 3.14
Answers
Consider the th order polynomial transform for . Let’s count the terms with exactly -degree that can be created with . There are total of such terms. See Number of polynomial terms for certain degree and certain number of variables.
So the total terms for the th order polynomical transform (which is also the dimensionality of the feature space ) is (Excluding the constant ):
Where we have applied the equality:
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