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

📄 rce.m

📁 最新的模式识别分类工具箱,希望对朋友们有用!
💻 M
字号:
function D = RCE(train_features, train_targets, lambda_m, region)% Classify using the reduced coulomb energy algorithm% Inputs:% 	features	- Train features%	targets	- Train targets%	lambda_m	- Maximum radius %	region	- Decision region vector: [-x x -y y number_of_points]%% Outputs%	D			- Decision sufraceepsilon 	= 1e-4;[Dim,Nf] = size(train_features);N			= region(5);x        = linspace (region(1),region(2),N);y        = linspace (region(3),region(4),N);%Train the classifierW		 = train_features;lambda = zeros(1,Nf);for i = 1:Nf,   dist         = sqrt(sum((train_features - train_features(:,i) * ones(1,Nf)).^2));   [m, indices] = sort(dist);   x_hat        = find(train_targets(indices) ~= train_targets(i));   lambda(i)    = min(dist(x_hat(1))-epsilon,lambda_m);end%Build the decision surface using the classifierD = zeros(N);for i = 1:N,   for j = 1:N,      dist	 = sqrt(sum((train_features - [x(i) y(j)]' * ones(1,Nf)).^2));      indices 	 = find(dist < lambda);      %The decision is a little different from DH&S, since there an ambiguous result can      %Occure. Here we do not allow this.      if isempty(indices),         D(j,i) = rand(1) > .5;      else         D(j,i) = sum(train_targets(indices))/length(indices) > .5;      end   end      if (i/50 == floor(i/50)),      disp(['Finished ' num2str(i) ' lines out of ' num2str(N) ' lines.']);   endend

⌨️ 快捷键说明

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