⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ff2.m

📁 there are some newly released Neural Network Example Programs for Character Recognition, which based
💻 M
字号:
%QUESTION NO:3  

% b)Design and Train a feedforward network for the following problem:
%  Encoding: Consider an 8-input and 8-output problem, where the output
%  should be equal to the input for any of the 8 combinations of seven
%  0s and one 1.

clear
for i=0:255
    x=dec2bin(i,8);
    for j=1:8
        y(j)=str2num(x(j));
    end
    inp(i+1,:)=y;
    if(sum(y)==7)
        out(i+1,:)=y;
    else
        out(i+1,:)=zeros(1,8);
    end
        
end
inp=inp';
out=out';
network=newff([0 1;0 1;0 1;0 1;0 1;0 1;0 1; 0 1],[6 8],{'logsig','logsig'});
network=init(network);
y=sim(network,inp);
network.trainParam.epochs = 500;
network=train(network,inp,out);
y=sim(network,inp);
Layer1_Weights=network.iw{1};
Layer1_Bias=network.b{1};
Layer2_Weights=network.lw{2};
Layer2_Bias=network.b{2};
Layer1_Weights
Layer1_Bias
Layer2_Weights
Layer2_Bias
Actual_output=y;
Actual_output

    



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -