www.gusucode.com > som-bp混合神经网络的matlab程序源码 > matlab_emulator/BP_ANN_wjj.m
clear; clc; %Initialize training samples % TN = zeros(1, length(normalroi1)); % TF = ones(1, length(fattyroi1)); % T = [TN TF]; % % net = newff(minmax(I), [5 1], {'logsig', 'logsig'}); % net.trainParam.show = 100; % net.trainParam.lr = 0.2; % % net.trainParam.mr = 0.9; % net.trainParam.epochs = 2000; % net.trainParam.goal = 1e-5; % % [net,tr]=train(net,I,T); % SimResult = sim(net,I); I1 = load('E:\图像\神经网络\apen1.txt'); I2 = load('E:\图像\神经网络\kc1.txt'); I3 = load('E:\图像\神经网络\mir1.txt'); I = [I1 I2 I3]'; J1 = load('E:\图像\神经网络\apen2.txt'); J2 = load('E:\图像\神经网络\kc2.txt'); J3 = load('E:\图像\神经网络\mir2.txt'); J = [J1 J2 J3]'; for j=1:10 for i=1:80 % Input sample vectors2 s = size(I); MinMaxVal = minmax(I); % Test sample I = [I1 I2 I3]'; SimSample = I(:, i); % Target vectors TN = zeros(1, 40); % 0代表正常 TF = ones(1, 40); % 1代表脂肪 T = [TN TF]; % Construct a feed-forward artificial neural network net = newff(MinMaxVal, [10 1], {'logsig', 'logsig'}); net.trainParam.show = 100; net.trainParam.lr = 0.2; net.trainParam.epochs = 1000; net.trainParam.goal = 1e-5; [net,tr]=train(net,I,T); end for nn=1:50 SimSample = J(:, nn); SimResult(j,nn) = sim(net,SimSample); end end save bpresult.mat SimResult;