亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nnmodel.asv

?? 人工神經網絡:MATLAB源程序用于訓練測試
?? ASV
?? 第 1 頁 / 共 3 頁
字號:
%#											
%# function [w1f,w2f,tablein,tableout] = nnmodel(topo,xtrain,ytrain,xmon,ymon,xtest,
%#	   					ytest,epochs,trials,setseed)	
%#										
%# AIM:	Backpropagation neural network with one hidden layer for multivariate
%#		calibration. (Designed to model only one response y at a time)	
%#										
%# PRINCIPLE:	The neural network is trained with the Levenberg-Marquardt algorithm.
%#		The activation functions can be either linear ('L') or hyperbolic
%#		tangent ('H'). The network has one hidden layer. The network topology 
%#		is determined by the matrix 'topo', which has two rows : one for
%#		specifying the hidden layer and one for the output layer.	
%#		Example: topo = ['HHHH';'L---'] defines a network with 4 nodes in the 
%#		hidden layer (hyperbolic tangent transfer functions) and one node in
%#		the output layer (linear transfer function). A weight can be pruned by
%#		setting it to zero. The bias is automatically included as the last
%#		column of the weight matrices. The model is built with the training
%#		set, but a monitoring set is necessary to avoid overtraining.
%#									
%#		At the end of training, a menu is available to summarize results 
%#		(training, monitoring and test if available). Statistical estimations
%#		are obtained using the solution with monitoring error closest to the 
%#		median (over all replicate training runs performed).
%#										
%#		A diagnostic is performed to assess the sensitivity (influence) of each 
%#		input variable and hidden node in the model. Maps of projections of the
%# 		training samples on hidden nodes allow to visualize clusters and 
%#		outliers. Deviations from linearity are calculated for each hidden node	
%#		in order to estimate the degree of nonlinearity of a data set.	
%#		Input variables with lowest sensitivities should be removed and the 
%#		neural network re-trained. 					 
%#									
%# REFERENCE:	"Tutorial Review: Neural Networks in Multivariate Calibration"	
%#		         F.Despagne, D.L.Massart, Analyst 123 (1998) 157R-178R		
%# 										
%# INPUT:	topo (2 x nh) : Matrix containing structure of the NN (nh hidden nodes)
%#			        (H: hyperbolic tangent, L: linear, -: no node)	
%#		    xtrain (ntr x p) : Matrix of training inputs (ntr objects, p variables)
%#		    ytrain (ntr x 1) : Vector of training responses			
%#		    xmon   (nm x p) : Matrix of monitoring inputs (nm objects, p variables)
%#		    ymon   (nm x 1) : Vector of monitoring responses		
%#		    xtest  (nte x p) : Matrix of test inputs (if not available, enter [])
%#		    ytest  (nte x 1) : Vector of test responses (if not available, enter [])
%#		    epochs : Maximum number of epochs (iterations) for the training	
%#		    trials : Number of trials. If trials>1, several trials are performed
%#			   with the same topology but different initial random weights.
%#			   In this case, average results are reported.		
%#		    setseed : Seed for generating initial random weights.	
%#			  (Optional. Only valid if trials=1. Default: random seed)							
%#									
%# OUTPUT:	w1f (nh x (p+1)) : matrix of weights between input and hidden layer
%#              		   corresponding to the trial with monitoring error closest to the median.
%#				   		
%#		    w2f (1 x (nh+1)) : matrix of weights between hidden and output layer 
%#              		   corresponding to the trial with monitoring error closest to the median.
%#				   			
%#		    tablein (mxtr x 2):input range-scaling parameters.	
%#		    tableout (1 x 2):  output range-scaling parameters.	
%# 										
%# SUBROUTINES: range.m : range-scaling of training, monitoring and test data
%#		        levmarq.m : training of the network with Levenberg-Marquardt	
%#		        lmeval.m : estimation of responses with the final neural network model
%#		        invrange.m : returns range-scaled data to original scale	
%#		        rms.m : calculates root mean squared error		
%#		        corrplot.m : draws correlation plot			
%#		        drawnn.m : draws the neural network structure		
%#		        linfit.m : builds univariate linear regression model		
%#		        kolnorm.m : Kolmogorov-Smirnov test to check if replicate y-predicted 
%#			              values are normally distributed.		
%#										
%# AUTHOR:	Frederic Despagne					
%#		Copyright(c) 1997 for ChemoAC					
%#		Dienst FABI, Vrije Universiteit Brussel			
%#		Laarbeeklaan 103, 1090 Jette			
%#									
%# VERSION: 1.1 (28/01/1999)				
%#									
%# TEST:									
%#										

function [w1f,w2f,tablein,tableout] = nnmodel(topo,xtrain,ytrain,xmon,ymon,xtest,ytest,epochs,trials,setseed)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INITIALIZATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Test to check if all necessary input variables are available
if nargin < 9		
	error('Some input arguments are missing.')
end

% Test to check that only one trial is performed with the defined random number generator seed
if nargin == 10
	if trials ~= 1
		error('The "setseed" input variable is only valid if "trials" is set to 1.')
	end
end

% Test to check if a test set is available
if isempty(xtest)
	testflag = 0;		
else
	testflag = 1;
end  

[nxtr,mxtr] = size(xtrain);	   % Size of the training input data
[ndef,mdef] = size(topo);	   % Topology of the network
nxm = size(xmon,1);		       % Number of monitoring samples
nxte = size(xtest,1);		   % Number of test samples
init = 1/(1*mxtr);  		   % Determination of weights initialization range
periodisp = ceil(epochs/10);   % Determination of the periodicity of display
indisp = zeros(1,trials);	% Vector containing optimum number of epochs, initialization
partyh = zeros(mdef,nxtr);	% Matrix of partial responses with one hidden node, training set
w1in = [];
w2in = [];
w1fin = [];			% The matrix where replicate sets of weights input-hidden will be stored
w2fin = [];			% The matrix where replicate sets of weights hidden-output will be stored
conctrx = [];			% Matrix of partial responses with one input variable, training set, first iteration 
concytrhat = [];		% Matrix of replicate predicted y-values with partial models, training set
setfig = [312 288 560 420];	% Vector of position indices for figure display
periodisp = [];


%%%%%%%%%%%%%%%%%%%%%%%%%% SCALING OF INPUT AND OUTPUT DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tic
for i = 1:mxtr

	% Range-scaling of training and monitoring input data between -1 and 1
	[xtra(:,i),tablein(i,:),xmonit(:,i)] = range(xtrain(:,i),-1,1,xmon(:,i));

	% Range-scaling of test input data between -1 and 1	
	if testflag		
		[xtra(:,i),tablein(i,:),xtes(:,i)] = range(xtrain(:,i),-1,1,xtest(:,i));
	end
end

% Range-scaling of training and monitoring output data between 0.2 and 0.8
[ytra,tableout,ymonit] = range(ytrain,0.2,0.8,ymon);

xtr = xtra'; ytr = ytra';	% Transposition of training input and output data	
xm = xmonit'; ym = ymonit';	% Transposition of monitoring input and output data


if testflag

	% Range-scaling of test output data between 0.2 and 0.8
	[ytra,tableout,ytes] = range(ytrain,0.2,0.8,ytest);

	xte = xtes'; yte = ytes';	% Transposition of test input and output data
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NETWORK INITIALIZATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for nit = 1:trials			% Loop on the number of trials
	close
	clc
	disp(' ')

	% Set the random number generator seed
	if nargin == 10
		randseed = setseed;
	else
		t0 = clock;			% The clock parameters vector
		randseed = 210610+100*nit;	% sum(100*t0(:,1:6)) A number that changes every second, as a seed to generate random weights
	end
	rseed(nit) = randseed;
	rand('seed',randseed);			% Random generator seed set on the clock

	w10 = rand(mdef,mxtr+1);		% Generation of the first matrix of random weights
	w20 = rand(1,mdef+1);			% Generation of the second matrix of random weights
	[w1,w1tab] = range(w10,-init,+init);	% Weights scaled to the initialization range
	[w2,w2tab] = range(w20,-init,+init);	% Weights scaled to the initialization range


%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TRAINING AND PREDICTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	% Training of the network. The monitoring set is used to stop the training
	[w1f,w2f,indisp(nit)] = levmarq(topo,w1,w2,xtr,ytr,xm,ym,epochs,periodisp);

	w1in = [w1in;w1];	% The replicate initial w1 matrices are accumulated
	w2in = [w2in;w2];	% The replicate initial w2 matrices are accumulated
	w1fin = [w1fin;w1f];	% The replicate final w1 matrices are accumulated
	w2fin = [w2fin;w2f];	% The replicate final w2 matrices are accumulated

	% Estimation of training responses
	[ytr1,ytr2,intr1,intr2] = lmeval(topo,w1f,w2f,xtr);

	% Inverse-scaling of estimated training responses
	ytrhat(nit,:) = invrange(ytr2,0.2,0.8,tableout);

	% Determination of root mean squared error of calibration
	rmstra(nit) = rms(ytrain,ytrhat(nit,:)');

	% Estimation of monitoring responses
	[ymon1,ymon2,inmon1,inmon2] = lmeval(topo,w1f,w2f,xm);

	% Inverse-scaling of estimated monitoring responses
	ymonhat(nit,:) = invrange(ymon2,0.2,0.8,tableout);

	% Determination of root mean squared error of prediction (monitoring set)
	rmsmon(nit) = rms(ymon,ymonhat(nit,:)');

	if testflag

		% Estimation of the test responses
		[ytes1,ytes2,intes1,intes2] = lmeval(topo,w1f,w2f,xte);

		% Inverse-scaling of estimated test responses
		yteshat(nit,:) = invrange(ytes2,0.2,0.8,tableout);

		% Determination of root mean squared error of prediction (test set)
		rmstest(nit) = rms(ytest,yteshat(nit,:)');
	end

end
toc
%%%%%%%%%%%%%%%%%%%%%%%%%%% DETERMINATION OF THE REFERENCE TRIAL (MEDIAN RMSEM) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

medrmsmon = median(rmsmon);			% Determination of the RMSEM median
diffmedian = abs(rmsmon-medrmsmon);		% All RMSEM values are compared to the median
[indiffref,sortind] = sort(diffmedian);		% The RMSEM values are sorted according to their distance to the median
indref = sortind(1);				% The index of the reference trial (closest to the median) is found		
retainw1 = 1+(indref-1)*mdef;			% Indices of lines corresponding to the reference trial in w1fin
w1inref = w1in(retainw1:retainw1+mdef-1,:);	% The initial w1 weight matrix for the reference trial
w2inref = w2in(indref,:);			% The initial w2 weight matrix for the reference trial
w1ref = w1fin(retainw1:retainw1+mdef-1,:);	% The final w1 weight matrix for the reference trial
w2ref = w2fin(indref,:);			% The final w2 weight matrix for the reference trial
clear w1fin w2fin w1in w2in

% Estimation of training responses
[ytr1,ytr2,intr1,intr2] = lmeval(topo,w1ref,w2ref,xtr);

% Inverse-scaling of estimated training responses
ytrref = invrange(ytr2,0.2,0.8,tableout);

% Determination of root mean squared error of calibration
rmstraref = rms(ytrain,ytrref');

% Estimation of monitoring responses
[ymon1,ymon2,inmon1,inmon2] = lmeval(topo,w1ref,w2ref,xm);

% Inverse-scaling of estimated monitoring responses
ymonref = invrange(ymon2,0.2,0.8,tableout);

% Determination of root mean squared error of prediction (monitoring set)
rmsmonref = rms(ymon,ymonref');

if testflag

	% Estimation of the test responses
	[ytes1,ytes2,intes1,intes2] = lmeval(topo,w1ref,w2ref,xte);

	% Inverse-scaling of estimated test responses
	ytesref = invrange(ytes2,0.2,0.8,tableout);

	% Determination of root mean squared error of prediction (test set)
	rmstestref = rms(ytest,ytesref');
end

residtrain = ytrain-ytrref';		% training set residuals for the reference trial
residmon = ymon-ymonref';		% Monitoring set residuals for the reference trial
mrmstra = mean(rmstra); 		% Determination of average RMSEC on retained trials	
stdtra = std(rmstra);			% Standard deviation of RMSEC on retained trials
mrmsmon = mean(rmsmon);			% Determination of average RMSEM on retained trials
stdmon = std(rmsmon);			% Standard deviation of RMSEM on retained trials

if testflag
	residtest = ytest-ytesref';	% Test set residuals for the reference trial	
	mrmstest = mean(rmstest);	% Determination of average RMSEP on retained trials
	stdtest = std(rmstest);		% Standard deviation of RMSEP on retained trials
end


%%%%%%% ESTIMATION OF INPUT VARIABLES SENSITIVITIES BY PARTIAL MODELING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for i = 1:mxtr
	xtrunc = 0*xtr;		% All training input variables but one
	xtrunc(i,:) = xtr(i,:);	% are set to 0

	% Training of the network. The monitoring set is used to stop the training
	[w1n,w2n] = levmarq(topo,w1inref,w2inref,xtr,ytr,xm,ym,epochs,[]);

	% Estimation of training responses using only one input in the model
	[ytrunc1,ytrunc2] = lmeval(topo,w1n,w2n,xtrunc);
	
	% Inverse-scaling of training responses estimated using one input only
	ytrunchat = invrange(ytrunc2,0.2,0.8,tableout);
	concyhtr(i,:) = ytrunchat;
		
	
	xtruncm = 0*xm;		% All monitoring input variables but one
	xtruncm(i,:) =xm(i,:);	% are set to 0

	% Estimation of monitoring responses using only one input in the model
	[ytruncm1,ytruncm2] = lmeval(topo,w1n,w2n,xtruncm);

	% Inverse-scaling of monitoring responses estimated using one input only
	ytruncmhat = invrange(ytruncm2,0.2,0.8,tableout);
	concymhat(i,:) = ytruncmhat;

	% Determination of variance of the predicted training responses without noise
	varytrunc0(1,i) = cov(ytrunchat);

	if testflag
		xtrunct = 0*xte;	% All test input variables but one
		xtrunct(i,:) = xte(i,:);% are set to 0	

		% Estimation of test responses using only one input in the model
		[ytrunct1,ytrunct2] = lmeval(topo,w1n,w2n,xtrunct);
		
		% Inverse-scaling of test responses estimated using one input only
		ytruncthat = invrange(ytrunct2,0.2,0.8,tableout);
		concyteshat(i,:) = ytruncthat;
	end
end

% The sensitivity of each input variable is the scaled variance of the training
% responses estimated using this variable only
varytrunc = 100*(varytrunc0./sum(varytrunc0));			


%%%%%%% ESTIMATION OF HIDDEN NODES SENSITIVITIES BY PARTIAL MODELING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 			
for i = 1:mdef
	w2trunc = 0*w2ref;				% All hidden nodes but one

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产首页在线观看| 亚洲六月丁香色婷婷综合久久| 99国产欧美另类久久久精品| 国产在线不卡视频| 男女性色大片免费观看一区二区 | 国产一区二区精品久久99| 视频一区二区三区中文字幕| 婷婷中文字幕综合| 三级久久三级久久| 美女久久久精品| 国产精品一线二线三线| 国产一区久久久| 国产高清成人在线| 99久久久久久| 9191成人精品久久| 欧美一级高清大全免费观看| 欧美精品一区二区精品网| 欧美一级在线视频| 国产欧美一区二区三区网站| 亚洲人成在线播放网站岛国| 亚洲一区二区视频| 日本vs亚洲vs韩国一区三区二区| 精品一区二区在线播放| 成人妖精视频yjsp地址| 色成人在线视频| 91麻豆精品国产91久久久更新时间 | 日韩免费成人网| 久久女同互慰一区二区三区| 中文字幕日韩av资源站| 亚洲福利视频一区二区| 久久99国产精品久久| 成人深夜福利app| 欧美日本视频在线| 久久久久久久久免费| 亚洲精品成人悠悠色影视| 蜜臀av性久久久久av蜜臀妖精| 国产一区二区三区美女| 在线看不卡av| 久久一区二区视频| 一区二区三国产精华液| 久久精品国产亚洲5555| 欧美午夜免费电影| 久久丝袜美腿综合| 午夜亚洲福利老司机| 国产成人在线看| 欧美久久久久免费| 综合久久久久综合| 国产一区二区日韩精品| 欧美日韩电影一区| 国产精品国产三级国产有无不卡| 奇米精品一区二区三区在线观看 | 久久久99久久| 日本强好片久久久久久aaa| 色综合中文字幕国产| 欧美精品三级日韩久久| 一区二区在线观看免费| 国产成人a级片| 欧美videos中文字幕| 亚洲一区二区不卡免费| 丁香婷婷综合色啪| 337p粉嫩大胆色噜噜噜噜亚洲| 午夜电影一区二区三区| 91浏览器打开| 亚洲欧洲韩国日本视频| 国产成人综合自拍| 欧美精品一区二区三区一线天视频 | 在线亚洲一区二区| 国产精品区一区二区三| 国内精品国产成人| 日韩欧美一区在线观看| 日韩电影免费在线| 欧美喷潮久久久xxxxx| 一个色综合av| 91成人免费网站| 亚洲午夜久久久久久久久电影网| 99国内精品久久| 亚洲柠檬福利资源导航| 日本韩国精品在线| 亚洲国产乱码最新视频| 欧美性生活大片视频| 无吗不卡中文字幕| 日韩一级片在线播放| 免费成人在线观看视频| 欧美tk—视频vk| 国产乱子伦一区二区三区国色天香| 精品国产免费一区二区三区四区 | 国产精品一区二区在线观看不卡 | 日本中文在线一区| 日韩午夜在线观看视频| 国内精品久久久久影院薰衣草| 久久久久久久综合日本| 不卡高清视频专区| 亚洲一区二区三区四区五区黄| 欧美日韩欧美一区二区| 另类小说图片综合网| 国产欧美精品一区二区三区四区 | 色哟哟精品一区| 亚洲成人一区在线| 日韩免费高清av| www.色精品| 日韩中文字幕91| 国产亚洲综合在线| 91福利国产精品| 麻豆精品在线视频| 日韩美女精品在线| 3d动漫精品啪啪一区二区竹菊| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲欧美乱综合| 欧美一二三四区在线| 国产福利精品一区| 亚洲成人av一区| 国产精品天天摸av网| 欧美日韩成人综合| 风间由美一区二区三区在线观看| 亚洲综合免费观看高清完整版| 欧美刺激脚交jootjob| av网站免费线看精品| 麻豆成人在线观看| 亚洲女同一区二区| 久久久久国产精品人| 欧美三日本三级三级在线播放| 国产精品888| 日韩激情视频网站| 亚洲美女屁股眼交3| 亚洲精品在线观看视频| 欧美日韩在线三级| 成人激情图片网| 蜜臀av在线播放一区二区三区| 亚洲欧美日韩在线播放| 久久婷婷综合激情| 91麻豆精品国产91久久久久久久久| 不卡在线观看av| 国产凹凸在线观看一区二区| 免费在线观看一区| 亚洲大片精品永久免费| 亚洲人成小说网站色在线 | 99re这里只有精品视频首页| 国产在线精品不卡| 韩国v欧美v亚洲v日本v| 午夜精品久久久久久| 一级做a爱片久久| 亚洲天堂2016| 日韩一区欧美小说| 国产精品美女久久久久久久久久久 | 麻豆高清免费国产一区| 午夜精品久久久久久| 亚洲一级片在线观看| 亚洲最新视频在线观看| 亚洲欧美乱综合| 亚洲特级片在线| 亚洲欧美日韩成人高清在线一区| 国产精品视频一二三| 国产精品婷婷午夜在线观看| 国产精品免费视频网站| 国产精品灌醉下药二区| 亚洲欧洲三级电影| 亚洲欧洲日韩综合一区二区| 亚洲欧洲中文日韩久久av乱码| 亚洲三级在线播放| 亚洲美女一区二区三区| 亚洲福利视频一区| 亚州成人在线电影| 日本伊人午夜精品| 精品亚洲成av人在线观看| 国产制服丝袜一区| 成人黄色在线视频| 日本黄色一区二区| 在线成人午夜影院| 精品国产乱码久久久久久牛牛| 精品国产精品一区二区夜夜嗨| 久久精品欧美一区二区三区不卡| 国产农村妇女精品| 亚洲人成影院在线观看| 亚洲国产精品影院| 国产制服丝袜一区| 91网站最新网址| 欧美日本免费一区二区三区| 日韩视频中午一区| 国产欧美精品一区二区色综合| 亚洲欧美另类小说视频| 日韩高清一区二区| 国产不卡视频在线观看| 欧美日韩在线一区二区| 精品免费日韩av| 一区二区三区精品视频在线| 麻豆精品精品国产自在97香蕉| www.视频一区| 欧美电视剧免费全集观看| 国产精品免费人成网站| 日韩av一区二区三区| 成人午夜私人影院| 91精品啪在线观看国产60岁| 国产精品久久久久久户外露出| 五月综合激情网| 岛国精品在线观看| 欧美日本高清视频在线观看| 亚洲国产精品成人综合色在线婷婷 | 日韩一级完整毛片| 亚洲精品成人少妇| 岛国一区二区在线观看|