收集一下核函数-Kernel Function

本文收集了多种核函数,包括线性核、多项式核、高斯核等,并详细介绍了它们的特点、参数调整及应用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

本文转载自: 收集一下核函数-Kernel Function | 丕子 

原文地址:http://www.shamoxia.com/html/y2010/2292.html

转载请声明出处,O(∩_∩)O谢谢~

Kernel Functions

Below is a list of some kernel functions available from the existing literature. As was the case with previous articles, every LaTeX notation for the formulas below are readily available from their alternate text html tag. I can not guarantee all of them are perfectly correct, thus use them at your own risk. Most of them have links to articles where they have been originally used or proposed.

1. Linear Kernel

The Linear kernel is the simplest kernel function. It is given by the inner product <x,y> plus an optional constant c. Kernel algorithms using a linear kernel are often equivalent to their non-kernel counterparts, i.e. KPCA with linear kernel is the same as standard PCA.

  

2. Polynomial Kernel

The Polynomial kernel is a non-stationary kernel. Polynomial kernels are well suited for problems where all the training data is normalized.

   
Adjustable parameters are the slope alpha, the constant term c and the polynomial degree d.

3. Gaussian Kernel

The Gaussian kernel is an example of radial basis function kernel.

   

Alternatively, it could also be implemented using

   

The adjustable parameter sigma plays a major role in the performance of the kernel, and should be carefully tuned to the problem at hand. If overestimated, the exponential will behave almost linearly and the higher-dimensional projection will start to lose its non-linear power. In the other hand, if underestimated, the function will lack regularization and the decision boundary will be highly sensitive to noise in training data.

4. Exponential Kernel

The exponential kernel is closely related to the Gaussian kernel, with only the square of the norm left out. It is also a radial basis function kernel.

   

5. Laplacian Kernel

The Laplace Kernel is completely equivalent to the exponential kernel, except for being less sensitive for changes in the sigma parameter. Being equivalent, it is also a radial basis function kernel.

   

It is important to note that the observations made about the sigma parameter for the Gaussian kernel also apply to the Exponential and Laplacian kernels.

6. ANOVA Kernel

The ANOVA kernel is also a radial basis function kernel, just as the Gaussian and Laplacian kernels. It is said to perform well in multidimensional regression problems (Hofmann, 2008).

   

7. Hyperbolic Tangent (Sigmoid) Kernel

The Hyperbolic Tangent Kernel is also known as the Sigmoid Kernel and as the Multilayer Perceptron (MLP) kernel. The Sigmoid Kernel comes from the Neural Networks field, where the bipolar sigmoid function is often used as an activation function for artificial neurons.

   

It is interesting to note that a SVM model using a sigmoid kernel function is equivalent to a two-layer, perceptron neural network. This kernel was quite popular for support vector machines due to its origin from neural network theory. Also, despite being only conditionally positive definite, it has been found to perform well in practice.

There are two adjustable parameters in the sigmoid kernel, the slope alpha and the intercept constant c. A common value for alpha is 1/N, where N is the data dimension. A more detailed study on sigmoid kernels can be found in the works by Hsuan-Tien and Chih-Jen.

8. Rational Quadratic Kernel

The Rational Quadratic kernel is less computationally intensive than the Gaussian kernel and can be used as an alternative when using the Gaussian becomes too expensive.

   

9. Multiquadric Kernel

The Multiquadric kernel can be used in the same situations as the Rational Quadratic kernel. As is the case with the Sigmoid kernel, it is also an example of an non-positive definite kernel.

   

10. Inverse Multiquadric Kernel

The Inverse Multi Quadric kernel. As with the Gaussian kernel, it results in a kernel matrix with full rank (Micchelli, 1986) and thus forms a infinite dimension feature space.

   

11. Circular Kernel

The circular kernel comes from a statistics perspective. It is an example of an isotropic stationary kernel and is positive definite in R2.

   
    

12. Spherical Kernel

The spherical kernel is similar to the circular kernel, but is positive definite in R3.

   

   

13. Wave Kernel

The Wave kernel is also symmetric positive semi-definite (Huang, 2008).

  

14. Power Kernel

The Power kernel is also known as the (unrectified) triangular kernel. It is an example of scale-invariant kernel (Sahbi and Fleuret, 2004) and is also only conditionally positive definite.

   

15. Log Kernel

The Log kernel seems to be particularly interesting for images, but is only conditionally positive definite.

  

16. Spline Kernel

The Spline kernel is given as a piece-wise cubic polynomial, as derived in the works by Gunn (1998).

  

However, what it actually mean is:

  

   With  

17. B-Spline (Radial Basis Function) Kernel

The B-Spline kernel is defined on the interval [−1, 1]. It is given by the recursive formula:

  

  

In the work by Bart Hamers it is given by:  

Alternatively, Bn can be computed using the explicit expression (Fomel, 2000):

  

Where x+ is defined as the truncated power function:

  

18. Bessel Kernel

The Bessel kernel is well known in the theory of function spaces of fractional smoothness. It is given by:

  

where J is the Bessel function of first kind. However, in the Kernlab for R documentation, the Bessel kernel is said to be:

  

19. Cauchy Kernel

The Cauchy kernel comes from the Cauchy distribution (Basak, 2008). It is a long-tailed kernel and can be used to give long-range influence and sensitivity over the high dimension space.

   

20. Chi-Square Kernel

The Chi-Square kernel comes from the Chi-Square distribution.

  

21. Histogram Intersection Kernel

The Histogram Intersection Kernel is also known as the Min Kernel and has been proven useful in image classification.

  

22. Generalized Histogram Intersection

The Generalized Histogram Intersection kernel is built based on the Histogram Intersection Kernel for image classification but applies in a much larger variety of contexts (Boughorbel, 2005). It is given by:

  

23. Generalized T-Student Kernel

The Generalized T-Student Kernel has been proven to be a Mercel Kernel, thus having a positive semi-definite Kernel matrix (Boughorbel, 2004). It is given by:

  

24. Bayesian Kernel

The Bayesian kernel could be given as:

  

where

  

However, it really depends on the problem being modeled. For more information, please see the work by Alashwal, Deris and Othman, in which they used a SVM with Bayesian kernels in the prediction of protein-protein interactions.

25. Wavelet Kernel

The Wavelet kernel (Zhang et al, 2004) comes from Wavelet theory and is given as:

  

Where a and c are the wavelet dilation and translation coefficients, respectively (the form presented above is a simplification, please see the original paper for details). A translation-invariant version of this kernel can be given as:

  

Where in both h(x) denotes a mother wavelet function. In the paper by Li Zhang, Weida Zhou, and Licheng Jiao, the authors suggests a possible h(x) as:

  

Which they also prove as an admissible kernel function.

 

 

好的,下面是创建高斯核函数支持向量机分类器的步骤: 1. 收集数据:收集已经标记好的数据集。 2. 准备数据:将数据集进行归一化处理,使得每个特征的取值范围都在0-1之间。 3. 分析数据:使用数据可视化工具,观察数据的分布情况,选择合适的核函数和参数。 4. 训练模型:使用训练数据集训练高斯核函数支持向量机分类器,得到模型。 5. 测试模型:使用测试数据集测试模型的准确率。 6. 使用模型:使用训练好的模型对新的数据进行分类。 下面给出一个Python实现的示例: ```python from sklearn import svm from sklearn.datasets import make_blobs import matplotlib.pyplot as plt import numpy as np # 生成数据集 X, y = make_blobs(n_samples=50, centers=2, random_state=0, cluster_std=0.6) # 可视化数据集 plt.scatter(X[:, 0], X[:, 1], c=y, s=50, cmap='autumn') plt.show() # 训练分类器 clf = svm.SVC(kernel='rbf', C=1) clf.fit(X, y) # 可视化分类器 plt.scatter(X[:, 0], X[:, 1], c=y, s=50, cmap='autumn') plt_svc(clf) plt.scatter(clf.support_vectors_[:, 0], clf.support_vectors_[:, 1], s=200, facecolors='none') plt.show() # 定义绘制分类器函数 def plt_svc(model, ax=None, plot_support=True): if ax is None: ax = plt.gca() xlim = ax.get_xlim() ylim = ax.get_ylim() # 创建网格矩阵 x = np.linspace(xlim[0], xlim[1], 30) y = np.linspace(ylim[0], ylim[1], 30) Y, X = np.meshgrid(y, x) xy = np.vstack([X.ravel(), Y.ravel()]).T P = model.decision_function(xy).reshape(X.shape) # 绘制决策边界和边界间的颜色填充 ax.contour(X, Y, P, colors='k', levels=[-1, 0, 1], alpha=0.5, linestyles=['--', '-', '--']) if plot_support: ax.scatter(model.support_vectors_[:, 0], model.support_vectors_[:, 1], s=300, linewidth=1, facecolors='none') ax.set_xlim(xlim) ax.set_ylim(ylim) ``` 其中,make_blobs函数用于生成一个随机数据集,svm.SVC函数用于训练高斯核函数支持向量机分类器,plt_svc函数用于绘制分类器的决策边界和支持向量。在这个示例中,我们选择了高斯核函数,参数C=1,得到了一个准确率较高的分类器。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值