/** * Compute the spectrum kernel by Leslie et al. (2002). * @param x first string * @param y second string * @return spectrum kernel */ float kern_spectrum_compare(hstring_t x, hstring_t y) { float k = kernel(x, y); return knorm(n, k, x, y, kernel); }
/** * Internal kernel function. * @param x first string * @param y second string * @return kernel value */ static float kernel(hstring_t x, hstring_t y) { double k = func[kern].measure_compare(x, y); return knorm(norm, k, x, y, func[kern].measure_compare); }
/** * Compute a distance substitution kernel * @param x first string * @param y second string * @return distance substitution kernel */ float kern_distance_compare(hstring_t x, hstring_t y) { float k = kernel(x, y); return knorm(norm, k, x, y, kernel); }
/** * Compute the weighted-degree kernel with shift. If the strings have * unequal size, the remaining symbols of the longer string are ignored (in * accordance with the kernel definition) * @param x first string * @param y second string * @return weighted-degree kernel */ float kern_wdegree_compare(hstring_t x, hstring_t y) { float k = kernel(x, y); return knorm(n, k, x, y, kernel); }