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

📄 store_grabbag.m

📁 最新的模式识别分类工具箱,希望对朋友们有用!
💻 M
字号:
function D = Store_Grabbag(train_features, train_targets, Knn, region)% Classify using the store-grabbag algorithm (an improvement on the nearest neighbor)% Inputs:% 	features	- Train features%	targets	- Train targets%	Knn		- Number of nearest neighbors%	region	- Decision region vector: [-x x -y y number_of_points]%% Outputs%	D			- Decision sufraceL		= length(train_features);N		= region(5);D		= zeros(N);%Placing first sample in STOREStore_features(:,1) = train_features(:,1);Store_targets       = train_targets(1);Grabbag_targets     = [];Grabbag_features    = [];for i = 2:L,   target = Knn_Rule(train_features(:,i), Store_features, Store_targets, Knn);   if target == train_targets(i)      Grabbag_features = [Grabbag_features , train_features(:,i)];        Grabbag_targets = [Grabbag_targets train_targets(i)];   else      Store_features = [Store_features, train_features(:,i)];      Store_targets  = [Store_targets train_targets(i)];   end end      New_Grabbag_features = Grabbag_features;while (Grabbag_features ~= New_Grabbag_features)   Grabbag_features = New_Grabbag_features;   New_Grabbag_targets = [];   for i = 1:length(Grabbag_features),      target = Knn_Rule(Grabbag_features(:,i), Store_features, Store_targets);      if target == train_targets(i)	New_Grabbag_features = [New_Grabbag_features, train_features(:,i)];  	New_Grabbag_targets  = [New_Grabbag_targets train_targets(i)];      else	Store_features = [Store_features, train_features(:,i)];	Store_targets  = [Store_targets , train_targets(i)];      end   endend          disp(['Calling Nearest Neighbor algorithm']);D = Nearest_Neighbor(Store_features, Store_targets, Knn, region);

⌨️ 快捷键说明

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