ecoc.m

来自「各种SVM分类算法」· M 代码 · 共 47 行

M
47
字号
function net = ecoc(nclasses, nbits, code, use01targets)% ECOC - Create wrapper for error correcting output codes% %   NET = ECOC(NCLASSES, NBITS)%   Initialize a wrapper for error correcting output codes for a%   multiclass problem with NCLASSES classes. Each class is associated%   a bit string with NBITS bits.%   ECOC(NCLASSES, NBITS, CODE) sets the code matrix to be CODE. A valid%   code matrix is of size [NCLASSES, NBITS]. Each entry may either be%   +1, -1 or 0, where 0 means that examples of a certain class are not%   used in training the correspoding classifier.%   ECOC(NCLASSES, NBITS, CODE, USE01TARGETS)%   By default, it is assumed that the individual bit learners accept%   targets with values +1 and -1. By using USE01TARGETS==1, the bit%   learners are given targets with values 0 and 1 (for example, for%   multi layer perceptrons MLP with 'logistic' loss function).%%   See also ECOCTRAIN, ECOCLOAD, ECOCFWD, MLP%% % Copyright (c) by Anton Schwaighofer (2001)% $Revision: 1.3 $ $Date: 2002/01/07 20:53:17 $% mailto:anton.schwaighofer@gmx.net% % This program is released unter the GNU General Public License.% error(nargchk(2, 4, nargin));if nargin<4,  use01targets = 0;endif nargin<3,  code = zeros([nclasses nbits]);endif ~all(size(code)==[nclasses, nbits]),  error('Code matrix must be of size [number of classes, number of bits]');endnet.type = 'ecoc';net.nclasses = nclasses;net.nbits = nbits;net.code = code;net.learner = [];net.use01targets = use01targets;net.codepath = '';net.verbosity = 1;

⌨️ 快捷键说明

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