def _svm_apply(SVM, q):
    """
    f_i = _svm_apply(SVM, q)

    @internal: This is mostly used for testing
    """
    X, Y, Alphas, b, C, kernel = SVM
    N = len(X)
    s = 0.0
    for i in range(N):
        s += Alphas[i] * Y[i] * kernel(q, X[i])
    return s - b
