资源简介
回声状态网络(ESN)以及确定性跳跃循环状态网络(CRJ)的实现
代码片段和文件信息
% A minimalistic Echo State Networks demo with Mackey-Glass (delay 17) data
% in “plain“ Matlab.
% by Mantas Lukosevicius 2012
% http://minds.jacobs-university.de/mantas
% load the data
trainLen = 3000;
testLen = 1000;
initLen = 100;
data = load(‘MackeyGlass-t17.txt‘);
load(‘signv.mat‘);
% plot some of it
% figure(10);
% plot(data(1:1000));
% title(‘A sample of data‘);
% generate the ESN reservoir
inSize = 1; outSize = 1;
resSize = 500;
a = 0.3; % leaking rate
signal = y(1:5001:2); %signal of W_in
%rand( ‘seed‘ 42 );
Win = (zeros(resSize1+inSize)+0.5) .* signal; %r=0.5
W = eye(resSize) * 0.8;
W = circshift(W[12]); % generate circle
W = reshape(W1resSize*resSize);
step = 10;
for i=1:resSize
if mod(i step) == 1
W(i) = 0.7;
end
end
W = reshape(WresSizeresSize)
% Option 1 - direct scaling (quick&dirty reservoir-specific):
% W = W .* 0.13;
% Option 2 - normalizing and setting spectral radius (correct slower):
disp ‘Computing spectral radius...‘;
opt.disp = 0;
rhoW = abs(eigs(W1‘LM‘opt));
disp ‘done.‘
W = W .* ( 1.25 /rhoW);
% allocated memory for the design (collected states) matrix
X = zeros(1+inSize+resSizetrainLen-initLen);
% set the corresponding target matrix directly
Yt = data(initLen+2:trainLen+1)‘;
% run the reservoir with the data and collect X
x = zeros(resSize1);
for t = 1:trainLen
u = data(t);
x = (1-a)*x + a*tanh( Win*[1;u] + W*x );
if t > initLen
X(:t-initLen) = [1;u;x];
end
end
% train the output
reg = 1e-8; % regularization coefficient
X_T = X‘;
% Wout = Yt*X_T * inv(X*X_T + reg*eye(1+inSize+resSize));
Wout = Yt*X_T / (X*X_T + reg*eye(1+inSize+resSize));
% Wout = Yt*pinv(X);
% run the trained ESN in a generative mode. no need to initialize here
% because x is initialized with training data and we continue from there.
Y = zeros(outSizetestLen);
u = data(trainLen+1);
for t = 1:testLen
x = (1-a)*x + a*tanh( Win*[1;u] + W*x );
y = Wout*[1;u;x];
Y(:t) = y;
% generative mode:
u = y;
% this would be a predictive mode:
u = data(trainLen+t+1);
end
errorLen = 1000;
mse = sum((data(trainLen+2:trainLen+errorLen+1)‘-Y(11:errorLen)).^2)./errorLen;
disp( [‘MSE = ‘ num2str( mse )] );
% plot some signals
figure(1);
plot( data(trainLen+2:trainLen+testLen+1) ‘color‘ [00.750] );
hold on;
plot( Y‘ ‘b‘ );
hold off;
axis tight;
title(‘Target and generated signals y(n) starting at n=0‘);
legend(‘Target signal‘ ‘Free-running predicted signal‘);
figure(2);
plot( X(1:201:200)‘ );
title(‘Some reservoir activations x(n)‘);
figure(3);
bar( Wout‘ )
title(‘Output weights W^{out}‘);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2686 2018-05-19 15:27 minimalCRJ.m
文件 2420 2018-05-19 15:00 minimalESN.m
文件 2574 2015-12-10 00:33 signv.mat
文件 265429 2016-11-21 18:13 MackeyGlass-t17.txt
相关资源
- 逻辑回归实战代码
- 浅析机器学习的研究与应用
- 基于BP神经网络的企业核心竞争力评价
- 人工智能-知识图谱-实战.docx
- 人工智能实验报告2份 Prolog语言编程练
- 人工智能及其应用课后答案
- MEID号码批量转换pESN
- A*算法实现迷宫问题
- 智能扫地机器人全覆盖遍历路径规划
- 专家系统的实现代码和实验报告
- 高级人工智能第二版史忠植.txt
- 人工智能复习题
- 产生式系统与动物识别
- 动物识别系统
- CodeSnitch破解版,支持WINCE6.0
- 人工智能文档
- 人工智能原理及其应用(王万森)第
- 哈工大秋季学期人工智能3学分第三个
- resnet二分类/recall_precision评价
- Selective Kernel Networks 论文思维导图
- 人工智能之五子棋小游戏
- ResNet论文翻译
- caffe下faster-rcnn的ResNet-50配置文件
- 人工智能课后习题答案
- 《模式识别与智能计算》源代码
- 人工智能导论试题
- 人工智能报告-罗马尼亚度假问题及源
- A星算法求解八数码问题
- 人工智能算法
- 纯JS象棋 AI算法
评论
共有 条评论