1 简介
宽度学习系统( BLS) 的基本思想是利用稀疏自动编码器产生最优输入权值矩阵,对输入样本进行线性变换后,形成特征节点,再对特征节点经过激励函数非线性变换后获得增强节点。通过合并特征节点输出和增强节点输出形成宽度学习系统的输出矩阵。宽度学习系统的模型可表示为:
2 部分代码
clear;
warning off all;
format compact;
load shujv.mat;
train_y=(train_y-1)*2+1;
test_y=(test_y-1)*2+1;
assert(isfloat(train_x), 'train_x must be a float');
assert(all(train_x(:)>=0) && all(train_x(:)<=1), 'all data in train_x must be in [0:1]');
assert(isfloat(test_x), 'test_x must be a float');
assert(all(test_x(:)>=0) && all(test_x(:)<=1), 'all data in test_x must be in [0:1]');
%%%%%%%%%%%%%%%%%%%%This is the model of broad learning system for%%%%%% 这是用于 m2+m3 增强节点和 m1 特征节点的增量的宽度学习系统模型
%%%%%%%%%%%%%%%%%%%%increment of m2+m3 enhancement nodes and m1 feature nodes %%%%%%%%%%%%%%%%%%%%%%%%
C = 2^-30;
s = 0.7 ; %the l2 regularization parameter and the shrinkage scale of the enhancement nodes l2正则化参数和增强节点的缩小比例
N1=20; %feature nodes per window 每个窗口的特征映射节点数
N2=30; % number of windows of feature nodes 特征节点的窗口数
N3=550; % number of enhancement nodes 增强节点数
epochs=1;% number of epochs epochs的周期数
m1=20;%number of feature nodes per increment step 每个增量步长中特征节点数
m2=80;%number of enhancement nodes related to the incremental feature nodes per increment step 每个增量步长中,与增量特征节点相关的增强节点的数量
m3=200;%number of enhancement nodes in each incremental learning 每次增量学习中增强节点的数量
l=1;% steps of incremental learning 增量学习的步长
train_err_t=zeros(epochs,l);test_err_t=zeros(epochs,l);train_time_t=zeros(epochs,l);test_time_t=zeros(epochs,l);
Testing_time_t=zeros(epochs,1);Training_time_t=zeros(epochs,1);
% rand('state',67797325) % 12000 %%%%% The random seed recommended by the
% reference HELM [10]. 参考HELM [10]生成的随机数
%% 粒子群
N = 30; % 初始种群个数
d = 7; % 空间维数
ger = 500; % 最大迭代次数
limit = [0.1, 0.7;1,30;1,30;1,600;1,100;1,200;10,300]; % 设置位置参数限制(矩阵的形式可以多维),s,N1,N2,N3,m1,m2,m3
vlimit = [-0.1,0.1;-1,1;-1,1;-10, 10;-5, 5;-5, 5;-5, 5]; % 设置速度限制
c_1 = 0.8; % 惯性权重
c_2 = 0.5; % 自我学习因子
c_3 = 0.5; % 群体学习因子
for i = 1:d
x(:,i) =round( limit(i, 1) + (limit(i, 2) - limit(i, 1)) * rand(N, 1));%初始种群的位置
end
figure
plot(record)
xlabel('代数')
ylabel('预测精度适应度值')
disp(['最佳参数:s=',num2str(ym(1)),',N1=',num2str(ym(2)),',N2=',num2str(ym(2)),',N3=',num2str(ym(4)),',m1=',num2str(ym(5)),',m2=',num2str(ym(6)),',m3=',num2str(ym(7))])
save ( [ 'cwt_result_enhancefeature'], 'train_err_t', 'test_err_t', 'train_time_t', 'test_time_t','Testing_time_t','Training_time_t');
img =gcf; %获取当前画图的句柄
print(img, '-dpng', '-r600', './运行结果.png') %即可得到对应格式和期望dpi的图像
3 仿真结果
4 参考文献
[1]袁利平, & 陈川南. (2018). 人工智能视域下的宽度学习及在教育中的应用. 远程教育杂志, 36(4), 8.