concept polynomial kernel in category machine learning

This is an excerpt from Manning's book Grokking Machine Learning.
The polynomial kernel, in this case, the kernel of the variables
and
, is precisely the set
. Since the maximum degree of each monomial is 2, we say that this is the polynomial kernel of degree 2. For the polynomial kernel, we always have to specify the degree.
What about a polynomial kernel of higher degree, say, k? This is defined as the set of monomials in the given set of variables, of degree less than or equal to k. For example, the degree 3 polynomial kernel on the variables
and
is precisely the set
.
We can also define a polynomial kernel on many more variables in the same way. Here is the degree 3 polynomial kernel in the set of variables
,
, and
:
.
Here is a question for you: How many elements does the polynomial kernel of degree 4 have, on the variables
,
, and
? Feel free to think about it yourself before reading the answer. The answer is 35. There are 4 of the form
, 12 of the form
, 6 of the form
, 12 of the form
and 1 of the form
.
Coding the polynomial kernel to classify a circular dataset
In this subsection I show you how to code the polynomial kernel in sklearn. For this, we use the following circular dataset called ‘one_circle.csv’ (Figure 9.27).
Figure 9.29. A circular dataset, with some noise. We will use an SVM with the polynomial kernel to classify this dataset.
![]()