我是靠谱客的博主 外向彩虹,这篇文章主要介绍核函数 多项式核函数 高斯核函数(常用),现在分享给大家,希望可以做个参考。

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

import numpy as np
import matplotlib.pyplot as plt
def gaussian(x,l):
gama=1.0
return np.exp(-gama*(x-l)**2)
x=np.arange(-4,5,1)
print(x)
y=np.array((x>=-2)&(x<=2),dtype="int")
print(y)
l1,l2=-1,1
x_new=np.empty((len(x),2))
for i,data in enumerate(x):
x_new[i,0]=gaussian(data,l1)
x_new[i,1] = gaussian(data, l2)
print(x_new)
plt.scatter(x[y==0],[0]*len(x[y==0]),color="red")
plt.scatter(x[y==1],[0]*len(x[y==1]),color="yellow")
plt.show()
plt.scatter(x_new[y==0,0],x_new[y==0,1],color="red")
plt.scatter(x_new[y==1,0],x_new[y==1,1],color="yellow")
plt.show()

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

最后

以上就是外向彩虹最近收集整理的关于核函数 多项式核函数 高斯核函数(常用)的全部内容,更多相关核函数内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(131)

评论列表共有 0 条评论

立即
投稿
返回
顶部