<commit_before>/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Written (W) 1999-2008 <NAME>
 * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
 */

#ifndef _GAUSSIANSHIFTKERNEL_H___
#define _GAUSSIANSHIFTKERNEL_H___

#include "lib/common.h"
#include "kernel/GaussianKernel.h"

/** An experimental kernel inspired by the WeightedDegreePositionStringKernel
 * and the Gaussian kernel. It is computed as
 *
 * \f[
 * k({\bf x},{\bf x'})= exp(-\frac{||{\bf x}-{\bf x'}||^2}{\tau}) + \sum_{...}
 * \f]
 *
 * where \f$\tau\f$ is the kernel width.
 */
class CGaussianShiftKernel: public CGaussianKernel
{
	public:
		/** constructor
		 *
		 * @param size cache size
		 * @param width width
		 * @param max_shift maximum shift
		 * @param shift_step shift step
		 */
		CGaussianShiftKernel(INT size, double width, int max_shift,
			int shift_step);

		/** constructor
		 *
		 * @param l features of left-hand side<commit_msg>added some documentation of the GaussianShift kernel<commit_after>/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Written (W) 1999-2008 <NAME>, <NAME>
 * Copyright (C) 1999-2008 Max-Planck-Society and Fraunhofer Institute FIRST
 */

#ifndef _GAUSSIANSHIFTKERNEL_H___
#define _GAUSSIANSHIFTKERNEL_H___

#include "lib/common.h"
#include "kernel/GaussianKernel.h"

/** An experimental kernel inspired by the WeightedDegreePositionStringKernel
 * and the Gaussian kernel. It is computed as
 *
 * \f[
 * k({\bf x},{\bf x'})= \exp(-\frac{||{\bf x}-{\bf x'}||^2}{\tau}) + 
                        \sum_{s=1}^{S_{\mathrm{max}}/S_{\mathrm{step}}} \frac{1}{2s}
						   \exp(-\frac{||{\bf x}_{[1:|{\bf x}|-sS_{\mathrm{step}}]}-{\bf x'}_{[sS_{\mathrm{step}}:|{\bf x}|]}||^2}{\tau}) +
                        \sum_{s=1}^{S_{max}/S_{step}} \frac{1}{2s}
						   \exp(-\frac{||{\bf x}_{[sS_{\mathrm{step}}:|{\bf x}|]}-{\bf x'}_{[1:|{\bf x}|-sS_{\mathrm{step}}]}||^2}{\tau}) +
 * \f]
 *
 * where \f$\tau\f$ is the kernel width. The idea is to shift the dimensions of the input vectors against eachother.
 * \f$S_{\mathrm{step}}\f$ is the step size (parameter shift_step) of the shifts and 
 * \f$S_{\mathrm{max}}\f$ (parameter max_shift_ is the maximal shift.
 */
class CGaussianShiftKernel: public CGaussianKernel
{
	public:
		/** constructor
		 *
		 * @param size cache size
		 * @param width width
		 * @param max_shift maximum shift
		 * @param shift_step shift step
		 */
		CGaussianShiftKernel(INT size, double width, int max_shift,
			int shift_step);

		/** constructor
		 *
		 * @param l features of left-hand side
{'fraction_non_alphanumeric': 0.14952956989247312, 'fraction_numerical': 0.015456989247311828, 'mean_word_length': 3.531202435312024, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2209590', 'n_tokens_mistral': 1054, 'n_tokens_neox': 924, 'n_words': 306}