最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【PNN分類】基于麻雀算法優(yōu)化pnn神經(jīng)網(wǎng)絡實現(xiàn)數(shù)據(jù)分類附matlab代碼

2022-04-07 08:00 作者:Matlab工程師  | 我要投稿

1 簡介

概率神經(jīng)網(wǎng)絡(Probabilistic Neural Network,簡稱PNN)是利用貝葉斯定理和基于風險最小的貝葉斯決策規(guī)則對新樣本進行分類的神經(jīng)網(wǎng)絡,具有訓練時間短且不易收斂到局部極值的優(yōu)點,但是傳統(tǒng)PNN采用相同平滑系數(shù)容易導致識別率低和誤分類的問題,其次平滑系數(shù)對分類結果影響巨大并且難以確定,模式層神經(jīng)元數(shù)目由訓練樣本數(shù)目確定,當訓練樣本集規(guī)模巨大時,導致網(wǎng)絡結構復雜。本文麻雀算法選擇PNN網(wǎng)絡的平滑系數(shù)向量并優(yōu)化PNN的網(wǎng)絡結構.

2 部分代碼

function [fMin , bestX, Convergence_curve] = SSA(X, N, M, c, d, dim, fobj)P_percent = 0.2; ? ?% 發(fā)現(xiàn)者的種群規(guī)模占總種群規(guī)模的百分比pNum = round(N*P_percent); ? ?% 發(fā)現(xiàn)者數(shù)量20%SD = pNum/2; ? ? ?% 警戒者數(shù)量10%ST = 0.8; ? ? ? ? ? % 安全閾值lb = c.*ones(1, dim); ? ? % 下限ub = d.*ones(1,dim); ? ?% 上限% 初始化for i = 1:N% ? ? X(i, :) = lb + (ub - lb) .* rand(1, dim); ? ?fitness(i) = fobj(X(i, :));endpFit = fitness;pX = X; ? ? ? ? ? ? ? ? ? ? ? ? ? ?% 與pFit相對應的個體最佳位置[fMin, bestI] = min(fitness); ? ? ?% fMin表示全局最優(yōu)解bestX = X(bestI, :); ? ? ? ? ? ? % bestX表示全局最優(yōu)位置%% 迭代尋優(yōu)for t = 1 : M ? ? ? ? ?[~, sortIndex] = sort(pFit); ? ? ? ? ? ?% 排序 ? ?[fmax, B] = max(pFit); ? ?worst = X(B, :); ? ?%% 發(fā)現(xiàn)者位置更新 ? ?r2 = rand(1); ? ?if r2 < ST ? ? ? ?for i = 1:pNum ? ? ?% Equation (3) ? ? ? ? ? ?r1 = rand(1); ? ? ? ? ? ?X(sortIndex(i), :) = pX(sortIndex(i), :)*exp(-(i)/(r1*M)); ? ? ? ? ? ?X(sortIndex(i), :) = Bounds(X(sortIndex(i), :), lb, ub); ? ? ? ? ? ?fitness(sortIndex(i)) = fobj(X(sortIndex(i), :)); ? ? ? ?end ? ?else ? ? ? ?for i = 1:pNum ? ? ? ? ? ?X(sortIndex(i), :) = pX(sortIndex(i), :)+randn(1)*ones(1, dim); ? ? ? ? ? ?X(sortIndex(i), :) = Bounds(X(sortIndex(i), :), lb, ub); ? ? ? ? ? ?fitness(sortIndex(i)) = fobj(X(sortIndex(i), :)); ? ? ? ?end ? ?end ? ?[~, bestII] = min(fitness); ? ?bestXX = X(bestII, :); ? ?%% 跟隨者位置更新 ? ?for i = (pNum+1):N ? ? ? ? ? ? ? ? ? ? % Equation (4) ? ? ? ?A = floor(rand(1, dim)*2)*2-1; ? ? ? ?if i > N/2 ? ? ? ? ? ?X(sortIndex(i), :) = randn(1)*exp((worst-pX(sortIndex(i), :))/(i)^2); ? ? ? ?else ? ? ? ? ? ?X(sortIndex(i), :) = bestXX+(abs((pX(sortIndex(i), :)-bestXX)))*(A'*(A*A')^(-1))*ones(1, dim); ? ? ? ?end ? ? ? ?X(sortIndex(i), :) = Bounds(X(sortIndex(i), :), lb, ub); ? ? ? ?fitness(sortIndex(i)) = fobj(X(sortIndex(i), :)); ? ?end ? ?%% 警戒者位置更新 ? ?c = randperm(numel(sortIndex)); ? ?b = sortIndex(c(1:SD)); ? ?for j = 1:length(b) ? ? ?% Equation (5) ? ? ? ?if pFit(sortIndex(b(j))) > fMin ? ? ? ? ? ?X(sortIndex(b(j)), :) = bestX+(randn(1, dim)).*(abs((pX(sortIndex(b(j)), :) -bestX))); ? ? ? ?else ? ? ? ? ? ?X(sortIndex(b(j)), :) = pX(sortIndex(b(j)), :)+(2*rand(1)-1)*(abs(pX(sortIndex(b(j)), :)-worst))/(pFit(sortIndex(b(j)))-fmax+1e-50); ? ? ? ?end ? ? ? ?X(sortIndex(b(j)), :) = Bounds(X(sortIndex(b(j)), :), lb, ub); ? ? ? ?fitness(sortIndex(b(j))) = fobj(X(sortIndex(b(j)), :)); ? ?end ? ?for i = 1:N ? ? ? ?% 更新個體最優(yōu) ? ? ? ?if fitness(i) < pFit(i) ? ? ? ? ? ?pFit(i) = fitness(i); ? ? ? ? ? ?pX(i, :) = X(i, :); ? ? ? ?end ? ? ? ?% 更新全局最優(yōu) ? ? ? ?if pFit(i) < fMin ? ? ? ? ? ?fMin = pFit(i); ? ? ? ? ? ?bestX = pX(i, :); ? ? ? ?end ? ?end ? ?Convergence_curve(t) = fMin; ? ?disp(['SSA: At iteration ', num2str(t), ' ,the best fitness is ', num2str(fMin)]);end%% 邊界處理function s = Bounds(s, Lb, Ub)% 下界temp = s;I = temp < Lb;temp(I) = Lb(I);% 上界J = temp > Ub;temp(J) = Ub(J);% 更新s = temp;

3 仿真結果

4 參考文獻

[1]李海洋, 范文義. 基于概率神經(jīng)網(wǎng)絡的遙感圖像分類MATLAB實現(xiàn)[J]. 東北林業(yè)大學學報, 2008, 36(06).

博主簡介:擅長智能優(yōu)化算法、神經(jīng)網(wǎng)絡預測、信號處理、元胞自動機、圖像處理、路徑規(guī)劃、無人機等多種領域的Matlab仿真,相關matlab代碼問題可私信交流。

部分理論引用網(wǎng)絡文獻,若有侵權聯(lián)系博主刪除。



【PNN分類】基于麻雀算法優(yōu)化pnn神經(jīng)網(wǎng)絡實現(xiàn)數(shù)據(jù)分類附matlab代碼的評論 (共 條)

分享到微博請遵守國家法律
榆林市| 美姑县| 西安市| 灵宝市| 兴安盟| 泌阳县| 伽师县| 扎囊县| 汝南县| 滕州市| 北安市| 宜州市| 大悟县| 汶川县| 荆州市| 石泉县| 昌平区| 佳木斯市| 天台县| 东源县| 安阳县| 孟津县| 正宁县| 舞钢市| 札达县| 正镶白旗| 天祝| 香港| 桂阳县| 偏关县| 嵩明县| 临汾市| 卓尼县| 江川县| 大关县| 临高县| 承德市| 寿光市| 伊川县| 波密县| 南丹县|