invrange.m

来自「人工神经网络:MATLAB源程序用于训练测试」· M 代码 · 共 45 行

M
45
字号
%#										
%# function [data] = invrange(rdata,mn,mx,table)			
%#										
%# AIM:		Returns a range-scaled data set to its original scale.	
%#										
%# PRINCIPLE:	An inverse scaling is performed on a data set. Typically, the vector 
%#		of responses from a training set is range-scaled before modeling with
%#		a neural network. The vector of responses predicted by the neural
%#		network must then be restored to the same scale as the original vector 
%#		of responses from the training set, to evaluate RMSEC or RMSEP.	
%# 										
%# INPUT:	rdata (m*n) : range-scaled data set (it can be a column-vector, 
%#			      a row-vector or a matrix)				
%#		mn : reference value for the minimum of the current scale	
%#		mx : reference value for the maximum of the current scale	
%#		table (1*2) : two-element row vector containing the minimum and maximum 
%#			      values of the original data set, before range-scaling
%#										
%# OUTPUT:	data (m*n) : new data set, after inverse scaling		
%#										
%# AUTHOR:	Frederic Despagne					
%#		Copyright(c) 1997 for ChemoAC				
%#		Dienst FABI, Vrije Universiteit Brussel			
%#		Laarbeeklaan 103, 1090 Jette				
%#										
%# VERSION: 1.1 (28/02/1998)						
%#									
%# TEST:    	Andrea Candolfi						
%#										

function [data] = invrange(rdata,mn,mx,table)

[m,n] = size(rdata);	% Size of the original data set
rn = mx-mn;		% Current range
xmn = table(1);		% Minimum value for the original data set
xmx = table(2);		% Maximum value for the original data set

for i = 1:n    
	for j = 1:m
       		data(j,i) = ((((rdata(j,i)-mn))*((xmx-xmn)))/rn)+xmn;	% Inverse scaling
    	end;
end;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

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