资源简介
介绍几种常用核函数MATLAB的算法,附说明

代码片段和文件信息
function [K] = kernel(kerxy)
% Calculate kernel function.
%
% x: 输入样本d×n1的矩阵n1为样本个数d为样本维数
% y: 输入样本d×n2的矩阵n2为样本个数d为样本维数
%
% ker 核参数(结构体变量)
% the following fields:
% type - linear : k(xy) = x‘*y
% poly : k(xy) = (x‘*y+c)^d
% gauss : k(xy) = exp(-0.5*(norm(x-y)/s)^2)
% tanh : k(xy) = tanh(g*x‘*y+c)
% degree - Degree d of polynomial kernel (positive scalar).
% offset - Offset c of polynomial and tanh kernel (scalar negative for tanh).
% width - Width s of Gauss kernel (positive scalar).
% gamma - Slope g of the tanh kernel (positive scalar).
%
% ker = struct(‘type‘‘linear‘);
% ker = struct(‘type‘‘ploy‘‘degree‘d‘offset‘c);
% ker = struct(‘type‘‘gauss‘‘width‘s);
% ker = struct(‘type‘‘tanh‘‘gamma‘g‘offset‘c);
%
% K: 输出核参数n1×n2的矩阵
%-------------------------------------------------------------%
switch ker.type
case ‘linear‘
K = x‘*y;
case ‘ploy‘
d = ker.degree;
c = ker.offset;
K = (x‘*y+c).^d;
case ‘gauss‘
s = ker.width;
rows = size(x2);
cols = size(y2);
tmp = zeros(rowscols);
for i = 1:rows
for j = 1:cols
tmp(ij) = norm(x(:i)-y(:j));
end
end
K = exp(-0.5*(tmp/s).^2);
case ‘tanh‘
g = ker.gamma;
c = ker.offset;
K = tanh(g*x‘*y+c);
otherwise
K = 0;
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1510 2007-07-02 13:49 kernel.m
----------- --------- ---------- ----- ----
1510 1
相关资源
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 光纤传输中的分布傅立叶算法matlab实
- k近邻算法matlab实现
- matlab编写的susan算法程序
- matlab-图像处理算法
- matlab链码提取算法
- matlab 数字图像对比度拉伸算法
- 数字图像处理radon matlab变换算法代码
- 主动轮廓模型算法matlab程序
- MATLAB 实现各类常见算法
- 数字信号处理 理论算法与实现 胡广书
- 基于BP神经网络的盲均衡算法 C程序(
- 基于harris算法的角点检测matlab原代码
- 图像匹配matlab源程序sift算法
- matlab编写的量子遗传算法
- 用蚁群算法求解TSP问题的matlab程序
- 粒子群算法matlab工具箱
- Matlab图像分割边缘提取算法
- prony 算法
- 蚁群算法论文+源代码
- 基于粒子群算法的非合作博弈的matl
- 协同进化遗传算法求解函数优化问题
- pri传统分选算法
- 基于RSSI的VIRE定位算法
- 相关向量机的快速算法
- Gardner_for _MPSK(PSK的符号同步算法)
- 粒子群算法优化pid源码 matlab仿真.ra
- 系数绝对值最大 图像融合MATLAB算法
- 灰度共生矩阵特征值不错的算法
评论
共有 条评论