inner function to compute kernels, extract weights and return predictions
inner_kernel_function(y_matrix, dist_matrix, Levels, weights_function, h)