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

📄 consist.m

📁 支持向量机工具箱
💻 M
字号:
function errstring = consist(model, type, inputs, outputs)%CONSIST Check that arguments are consistent.% %	Description%%	ERRSTRING = CONSIST(NET, TYPE, INPUTS) takes a network data structure%	NET together with a string TYPE containing the correct network type,%	a matrix INPUTS of input vectors and checks that the data structure%	is consistent with the other arguments.  An empty string is returned%	if there is no error, otherwise the string contains the relevant%	error message.  If the TYPE string is empty, then any type of network%	is allowed.%%	ERRSTRING = CONSIST(NET, TYPE) takes a network data structure NET%	together with a string TYPE containing the correct  network type, and%	checks that the two types match.%%	ERRSTRING = CONSIST(NET, TYPE, INPUTS, OUTPUTS) also checks that the%	network has the correct number of outputs, and that the number of%	patterns in the INPUTS and OUTPUTS is the same.  The fields in NET%	that are used are%	  type%	  nin%	  nout%%	See also%	MLPFWD%%	Copyright (c) Ian T Nabney (1996-9)errstring = '';                  % 假定在默认状态下都是一致的if ~isempty(type)                % 如果不为空  if ~isfield(model, 'type')       errstring = 'Data structure does not contain type field';    return  end  s = model.type;  if ~strcmp(s, type)    errstring = ['Model type ''', s, ''' does not match expected type ''',...	type, ''''];    return  endendif nargin > 2  if ~isfield(model, 'nin')    errstring = 'Data structure does not contain nin field';    return  end  data_nin = size(inputs, 2);  if model.nin ~= data_nin    errstring = ['输入维数 ', num2str(data_nin), ...	' 和结构数据输入的个数不一致 ', num2str(model.nin)];    return  endend%核对输出是否有正确的维数if nargin > 3  if ~isfield(model, 'nout')    errstring = 'Data structure does not conatin nout field';    return  end  data_nout = size(outputs, 2);  if model.nout ~= data_nout    errstring = ['输出的维数 ', num2str(data_nout), ...	' 和结构数据输出的个数不一致 ', num2str(model.nout)];    return  end% 核对输入和输出的数据点个数是一致的  num_in = size(inputs, 1);  num_out = size(outputs, 1);  if num_in ~= num_out    errstring = ['输入样本的个数 ', num2str(num_in), ...	' 和输出样本的个数不一致 ', num2str(num_out)];    return  endend

⌨️ 快捷键说明

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