sigmoid method

List<double> sigmoid(
  1. List<double> X
)

Sigmoid kernel.

K(X, Y) = tanh(gamma <X, Y> + coef0)

Implementation

List<double> sigmoid(List<double> X) {
  List<double> kernels =
      List.generate(supportVectors.length, ((index) => index.toDouble()));
  for (int i = 0; i < supportVectors.length; i++) {
    double kernel = 0.0;
    for (int j = 0; j < supportVectors[i].length; j++) {
      kernel += supportVectors[i][j] * X[j];
    }
    kernels[i] = tanh((this.gamma * kernel) + this.coef0);
  }
  return kernels;
}