• 大小: 77.82MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-19
  • 语言: Matlab
  • 标签: BLS  

资源简介

人工智能里的 宽度学习,该代码为matlab版本,有空可以比较深度学习

资源截图

代码片段和文件信息

%%%%%%%%%%%%%%%%%%%%%%%%This is the demo for the bls models including the
%%%%%%%%%%%%%%%%%%%%%%%%proposed incremental learning algorithms. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%load the dataset MNIST dataset%%%%%%%%%%%%%%%%%%%%
clear; 
warning off all;
format compact;
load mnist;

%%%%%%%%%%%%%%%the samples from the data are normalized and the lable data
%%%%%%%%%%%%%%%train_y and test_y are reset as N*C matrices%%%%%%%%%%%%%%
train_x = double(train_x/255);
train_y = double(train_y);
% test_x = double(train_x/255);
% test_y = double(train_y);
test_x = double(test_x/255);
test_y = double(test_y);
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]‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp(‘Press any key to run the one shot BLS demo‘);
pause

%%%%%%%%%%%%%%%%%%%%This is the model of broad learning sytem with%%%%%%
%%%%%%%%%%%%%%%%%%%%one shot structrue%%%%%%%%%%%%%%%%%%%%%%%%
C = 2^-30; s = .8;%the l2 regularization parameter and the shrinkage scale of the enhancement nodes
N11=10;%feature nodes  per window
N2=10;% number of windows of feature nodes
N33=11000;% number of enhancement nodes
epochs=10;% number of epochs 
train_err=zeros(1epochs);test_err=zeros(1epochs);
train_time=zeros(1epochs);test_time=zeros(1epochs);
% rand(‘state‘67797325)   % 12000 %%%%% The random seed recommended by the
% reference HELM [10].
N1=N11; N3=N33;  
for j=1:epochs    
    [TrainingAccuracyTestingAccuracyTraining_timeTesting_time] = bls_train(train_xtrain_ytest_xtest_ysCN1N2N3);       
    train_err(j)=TrainingAccuracy * 100;
    test_err(j)=TestingAccuracy * 100;
    train_time(j)=Training_time;
    test_time(j)=Testing_time;
end
save ( [‘mnist_result_oneshot_‘ num2str(N3)] ‘train_err‘ ‘test_err‘ ‘train_time‘ ‘test_time‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp(‘Press any key to run the one shot BLS demo with BP algorithm‘);
pause

%%%%%%%%%%%%%%%%%%%%This is the model of broad learning system for one%%%%%%
%%%%%%%%%%%%%%%%%%%%shot structrue with fine tuning under BP algorithm%%%%%%%%%%%%%%%%%%%%%%%%
C = 2^-30; s = .8;%the l2 regularization parameter and the shrinkage scale of the enhancement nodes
N11=10;%feature nodes  per window
N2=10;% number of windows of feature nodes
N33=5000;% number of enhancement nodes
epochs=1;% number of epochs 
train_err=zeros(1epochs);test_err=zeros(1epochs);
train_time=zeros(1epochs);test_time=zeros(1epochs);
% rand(‘state‘67797325)   % 12000 %%%%% The random seed recommended by the
% reference HELM [10].
N1=N11; N3=N33;  
for j=1:epochs   
    [TrainingAcc

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-11-27 22:52  Demo_Broadlearning_MNIST\
     文件        9687  2017-11-27 22:51  Demo_Broadlearning_MNIST\BLS_demo_MNIST.m
     文件        9752  2017-11-27 22:52  Demo_Broadlearning_MNIST\BLS_demo_MNIST_for_lower_memory.m
     文件        3028  2017-07-16 19:35  Demo_Broadlearning_MNIST\bls_train.m
     文件        7776  2017-07-19 23:17  Demo_Broadlearning_MNIST\bls_train_bp.m
     文件        5834  2017-07-16 19:43  Demo_Broadlearning_MNIST\bls_train_enhance.m
     文件        6745  2017-07-16 20:28  Demo_Broadlearning_MNIST\bls_train_enhancefeature.m
     文件        5639  2017-07-16 20:31  Demo_Broadlearning_MNIST\bls_train_input.m
     文件        6398  2017-07-16 20:32  Demo_Broadlearning_MNIST\bls_train_inputenhance.m
     文件    14735220  2017-07-11 20:58  Demo_Broadlearning_MNIST\mnist.mat
     文件         438  2017-07-19 23:02  Demo_Broadlearning_MNIST\pre_zca.m
     文件          72  2017-07-11 20:58  Demo_Broadlearning_MNIST\result.m
     文件         495  2017-07-11 20:58  Demo_Broadlearning_MNIST\sparse_bls.m
     目录           0  2017-11-27 22:32  Demo_Broadlearning_norb\
     文件        2261  2017-07-19 23:00  Demo_Broadlearning_norb\BLS_demo_norb.m
     文件        2335  2017-07-19 23:21  Demo_Broadlearning_norb\BLS_demo_norb_for_lower_memory.m
     文件        3028  2017-07-16 19:35  Demo_Broadlearning_norb\bls_train.m
     文件    66936859  2017-03-03 17:24  Demo_Broadlearning_norb\norb.mat
     文件         438  2017-07-19 23:02  Demo_Broadlearning_norb\pre_zca.m
     文件          72  2017-07-11 20:58  Demo_Broadlearning_norb\result.m
     文件         495  2017-07-11 20:58  Demo_Broadlearning_norb\sparse_bls.m

评论

共有 条评论