internal virtual double kernel_function(int i, int j)
{
switch (kernel_type)
{
case svm_parameter.LINEAR:
return dot(x[i], x[j]);
case svm_parameter.POLY:
return Math.Pow(gamma*dot(x[i], x[j]) + coef0, degree);
case svm_parameter.RBF:
return Math.Exp((- gamma)*(x_square[i] + x_square[j] - 2*dot(x[i], x[j])));
case svm_parameter.SIGMOID:
return tanh(gamma*dot(x[i], x[j]) + coef0);
default:
return 0; // java
}
}