sklearn.metrics.pairwise.rbf_kernel?
sklearn.metrics.pairwise.rbf_kernel(X, Y=None, gamma=None)
計算X和Y之間的rbf(高斯)內核:
K(x, y) = exp(-gamma ||x-y||^2)
對應每對X中的行x和Y中的y。
在用戶指南中閱讀更多內容。
參數 | 說明 |
---|---|
X | array of shape (n_samples_X, n_features) |
Y | array of shape (n_samples_Y, n_features) |
gamma | float, default None 如果為None,則默認為1.0 / n_features |
返回值 | 說明 |
---|---|
kernel_matrix | array of shape (n_samples_X, n_samples_Y) |