testdich.m
来自「用支持向量机进行分类」· M 代码 · 共 41 行
M
41 行
function [X,I,alpha,theta] = testdich( dim, datanum )% TESTDICH randomly creates test examples for dichotomy problem.% [X,I] = testgidich( dim, datanum )%% TESTDICH creats test data randomly for the algorithms which try % to split two finite point sets by a hyperplane (e.g. Perceptron-like% algorithms). The created data are linearly separable. % % Input:% dim [1x1] dimension of generated data.% datanum [1x1] number of generated data (size of the test set).%% Output:% X [dim x datanum] contains generated test points.% I [1 x datanum] contains labnels of test points (1 or 2).% alpha [dim x 1] a normal vector of the hyperplane which correctly % splits test data.% theta [1x1] a threshold of the hyperplane.%% See also% TESTANDR, PERCEPTR, KOZINEC, EKOZINEC, LINSVM%% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz% Written Vojtech Franc (diploma thesis)% Modifications% 26-feb-2001 V.FrancX = 2*rand(dim, datanum )-1;I= zeros(1,datanum);alpha = 2*rand(dim,1)-1;theta = rand(1);I=linclass(X,alpha,0);X = X + theta/sum(alpha);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?