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

📄 gendatk.m

📁 模式识别工具箱,本人毕业论文时用到的,希望对大家有用!
💻 M
字号:
%GENDATK K-Nearest neighbour data generation% % 	B = gendatk(A,m,k,s)% % Generation of m points using the k-nearest neighbors of objects in % the dataset A. First m points of A are chosen in a random order. % To each each of these points and for each direction (feature) a % Gaussian distributed offset is added with zero mean and with % standard deviation: s * the mean signed difference between the % point of A under consideration and its n nearest neighbours in A. % The result of this procedure is that the generated points follow % the local density properties of the point from which they % originate.% % See also datasets, gendatp, gendatt% Copyright: R.P.W. Duin, duin@ph.tn.tudelft.nl% Faculty of Applied Physics, Delft University of Technology% P.O. Box 5046, 2600 GA Delft, The Netherlandsfunction B = gendatk(A,m,k,s)if nargin < 4, s = 1; endif nargin < 3, k = 1; end[ma,n] = size(A);labA=getlab(A);B = zeros(m,n);[D,I] = sort(distm(A)); I = I(2:k+1,:);alf = randn(k,m) * s;nu = ceil(m/ma);J = randperm(ma);J = J(ones(1,nu),:)';J = J(1:m);for f = 1:n B(:,f) = A(J,f) + sum(( ( A(J,f)*ones(1,k) - ...     reshape(+A(I(:,J),f),k,m)' ) .* alf' )' /k, 1)';endB = dataset(B,labA(J,:));return

⌨️ 快捷键说明

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