Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I found that there may be bugs in Gaussian kernels in kernel SVM #2

Open
Weizhi-Zhao opened this issue Oct 17, 2023 · 1 comment
Open

Comments

@Weizhi-Zhao
Copy link

In this PPT page, when calculating the Gaussian kernel function, the square operation is performed after the two norms.
But the code, there is no square.

def _caculate_gauss_kernel(self, x, sv_x):
    n, dimension1 = sv_x.shape
    m, dimension2 = x.shape
    assert(dimension1 == dimension2)
    graph1 = np.repeat(np.expand_dims(x, axis=0), n, axis=0)
    graph2 = np.repeat(np.expand_dims(sv_x, axis=0), m, axis=0).transpose(1,0,2)


    kernel_value = np.exp(-self.gamma * np.linalg.norm(graph1 - graph2, axis=-1))

    return kernel_value

Is there any error? Or I am just wrongly understood your code.
屏幕截图 2023-10-17 225701

@Daniel-xsy
Copy link
Owner

Sorry for the late response since I just notice the issue.

Yes, I think I forget to take the square at that time. Maybe you can try if taking square leads to better results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants