xnn.krnn.models.sgdml.kernel_energy#

xnn.krnn.models.sgdml.kernel_energy(x, xp, wp, ec, kernel, gradient=False)[source]#

sum_{j,q} g(r) (D.w) + k(r) a_j for descriptors x (B, D) (paper eq. 5).

xp and wp are the (M, Q, D) permuted training descriptors and weights, ec the (M,) energy coefficients (possibly empty). With gradient the (B, D) gradient (kernel_energy_gradient()) is formed in the same pass over the differences and returned as well.

Parameters: