自联想神经网络

Posted pprotector

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自联想神经网络相关的知识,希望对你有一定的参考价值。

第一篇博文,先贴代码慢慢改……

%------------------------AANN by NNtoolbox----------------------------------
tran_fun_type ={‘logsig‘;‘purelin‘;‘logsig‘;‘purelin‘};
bn_l = 1;%
if bn_l<10
    lh = (2+2*bn_l); 
else
    lh = bn_l;
end 
net = feedforwardnet([lh,bn_l,lh]);
%net.trainParam.epochs=1000%

for i=1:size(tran_fun_type,1)
    net.layers{i}.transferFcn = tran_fun_type{i};
end

net = train(net,data_1,data_1);

input = mapminmax(‘apply‘,data_1,net.inputs{1}.processSettings{1});
L1 = logsig(net.IW{1,1} * input + net.B{1});
L2 = purelin( net.LW{2,1} * L1 +  net.B{2});
L3 = logsig(net.LW{3,2} * L2 +  net.B{3});
L4 = purelin(net.LW{4,3} * L3 +  net.B{4});
OUT = mapminmax(‘reverse‘,L4,net.outputs{4}.processSettings{1});

data_resc1_1 = sim(net,data_1);

data_resc1 =  mapminmax(‘reverse‘,data_resc1_1,traM)

dt = mapminmax(‘reverse‘,data_1,traM);

for i = 1:size(data_1,1)
    fig_hdl = figure(i);
    y = data_1(i,:)‘;
    x = data_resc1_1(i,:)‘;
    FIT_CUR = polyfit(x,y,1);
    r_ = corrcoef(x,y);
    y_ = polyval(FIT_CUR,x);
    plot(x,y,‘k+‘,x,y_,‘r‘);
    title(strcat(‘R:‘,num2str(r_(2,1)),‘  a:‘,num2str(FIT_CUR(1)),‘  b:‘, num2str(FIT_CUR(2)) ));
    saveas(fig_hdl,strcat(‘AANNfit_cur‘,num2str(i)),‘jpg‘);
end
%--------------------------NLPCA toolbox------------------------------------------
[pc net network] = nlpca(data_1, bn_l);
data_resc2_1 = nlpca_get_data(net,pc);

for i = 1:size(data_1,1)
    fig_hdl = figure(i);
    y = data_1(i,:)‘;
    x = data_resc2_1(i,:)‘;
    FIT_CUR = polyfit(x,y,1);
    r_ = corrcoef(x,y);
    y_ = polyval(FIT_CUR,x);
    plot(x,y,‘k+‘,x,y_,‘r‘);
    title(strcat(‘R:‘,num2str(r_(2,1)),‘  a:‘,num2str(FIT_CUR(1)),‘  b:‘, num2str(FIT_CUR(2)) ));
    saveas(fig_hdl,strcat(‘NLPCAfit_cur‘,num2str(i)),‘jpg‘);
end

%--------------------------PCA ------------------------------------------
[coeff,score,latent,tsquared,explained,mu] = pca(data_1‘)
tar=bn_l;
data_resc3_1 = score(:,1:tar)*coeff(:,1:tar)‘ + repmat(mu,size(data_1,2),1);

for i = 1:size(data_1,1)
    fig_hdl = figure(i);
    y = data_1(i,:)‘;
    x = data_resc3_1(:,i);
    FIT_CUR = polyfit(x,y,1);
    r_ = corrcoef(x,y);
    y_ = polyval(FIT_CUR,x);
    plot(x,y,‘k+‘,x,y_,‘r‘);
    title(strcat(‘R:‘,num2str(r_(2,1)),‘  a:‘,num2str(FIT_CUR(1)),‘  b:‘, num2str(FIT_CUR(2)) ));
    saveas(fig_hdl,strcat(‘PCAfit_cur‘,num2str(i)),‘jpg‘);
end

 

以上是关于自联想神经网络的主要内容,如果未能解决你的问题,请参考以下文章

机器学习——DBN深度信念网络详解(转)

使用自联接进行更新

查看在表上具有自联接

如何从自联接中删除两行

需要解释在同一列上进行自联接查询的工作[重复]

片段和活动之间的核心区别是啥?哪些代码可以写成片段?