def plongement_phi(sample_element):
- return [1, sample_element[0], sample_element[1], sample_element[0] * sample_element[0], sample_element[0] * sample_element[1], sample_element[1] * sample_element[1]]
+ return [1, sample_element[0], sample_element[1], sample_element[0]**2,
+ sample_element[0] * sample_element[1], sample_element[1]**2]
def apply_plongement(sample, p):
def k1(X1, X2):
- return 1 + X1[0] * X2[0] + X1[1] * X2[1] + X1[0] * X1[0] * X2[0] * X2[0] + X1[0] * X1[1] * X2[0] * X2[1] + X1[1] * X1[1] * X2[1] * X2[1]
+ return 1 + X1[0] * X2[0] + X1[1] * X2[1] + X1[0]**2 * X2[0]**2 \
+ + X1[0] * X1[1] * X2[0] * X2[1] + X1[1]**2 * X2[1]**2
def kg(x, y, sigma=10):