程序(图在下面):
%基于OLS 的RBF 网设计算法
%%------------------------------
clc;
clear all;
clc;
load ;%约简后的总体样本
ceshiyangben=[data(1:2:238,1),data(1:2:238,2),data(1:2:238,3),data(1:2:238,4),data(1:2:238,5),data(1:2:238,6),data(1:2:238,7),data(1:2:238,8)];
ceshiyangbenjieguo=[data(1:2:238,9)];
yuceyangben=[data(2:2:119,1),data(2:2:119,2),data(2:2:119,3),data(2:2:119,4),data(2:2:119,5),data(2:2:119,6),data(2:2:119,7),data(2:2:119,8)];
yuceyangbenjieguo=[data(2:2:119,9)];
SamNum = 119; % 训练样本数
TestSamNum = 59; % 测试样本数
SP = ; % 隐节点扩展常数
ErrorLimit = ; % 目标误差
% 根据目标函数获得样本输入输出
SamIn = ceshiyangben';
SamOut = ceshiyangbenjieguo';
TestSamIn = yuceyangben';
TestSamOut = yuceyangbenjieguo';
[InDim,MaxUnitNum] = size(SamIn); % 样本输入维数和最大允许隐节点数
% 计算隐节点输出阵
Distance = dist(SamIn',SamIn);
HiddenUnitOut = radbas(Distance/SP);
PosSelected = [];
VectorsSelected = [];
HiddenUnitOutSelected = [];
ErrHistory = []; % 用于记录每次增加隐节点后的训练误差
VectorsSelectFrom = HiddenUnitOut;
dd = sum((SamOut.*SamOut)')';
% 计算各隐节点输出矢量与目标输出矢量的夹角平方值
for k = 1 : MaxUnitNum
PP = sum(VectorsSelectFrom.*VectorsSelectFrom)';
Denominator = dd * PP';
[xxx,SelectedNum] = size(PosSelected);
if SelectedNum>0
[lin,xxx] = size(Denominator);
Denominator(:,PosSelected) = ones(lin,1);
end
Angle = ((SamO
基于OLS算法的预测 来自淘豆网m.daumloan.com转载请标明出处.