国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

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

【SVM分類】基于風(fēng)驅(qū)動(dòng)算法優(yōu)化支持向量機(jī)實(shí)現(xiàn)數(shù)據(jù)分類附matlab代碼

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

1 簡(jiǎn)介

支持向量機(jī)是利用已知數(shù)據(jù)類別的樣本為訓(xùn)練樣本,尋找同類數(shù)據(jù)的空間聚集特征,從而對(duì)測(cè)試樣本進(jìn)行分類驗(yàn)證,通過(guò)驗(yàn)證可將分類錯(cuò)誤的數(shù)據(jù)進(jìn)行更正。本文以體檢數(shù)據(jù)為數(shù)據(jù)背景,首先通過(guò)利用因子分析將高維數(shù)據(jù)進(jìn)行降維,由此將所有指標(biāo)整合成幾個(gè)綜合性指標(biāo);為降低指標(biāo)之間的衡量標(biāo)準(zhǔn)所引起的誤差,本文利用 MATLAB軟件將數(shù)據(jù)進(jìn)行歸一化處理,結(jié)合聚類分析將數(shù)據(jù)分類;最后本文利用最小二乘支持向量機(jī)分類算法進(jìn)行分類驗(yàn)證,從而計(jì)算出數(shù)據(jù)分類的準(zhǔn)確率,并驗(yàn)證了數(shù)據(jù)分類的準(zhǔn)確性和合理性。

2 部分代碼

%--------------------------------------------------------------tic; ?clear; ?close all; ?clc; ?format long g;delete('WDOoutput.txt'); ?delete('WDOpressure.txt'); ?delete('WDOposition.txt');fid=fopen('WDOoutput.txt','a');%--------------------------------------------------------------% User defined WDO parameters:param.popsize = 20; ? ?% population size.param.npar = 5; ? ? ?% Dimension of the problem.param.maxit = 500; ? ?% Maximum number of iterations.param.RT = 3; ? ? ?% RT coefficient.param.g = 0.2; ? ? ?% gravitational constant.param.alp = 0.4; ? ?% constants in the update eq.param.c = 0.4; ? ? ?% coriolis effect.maxV = 0.3; ? ? ?% maximum allowed speed.dimMin = ?-5; ? ? ?% Lower dimension boundary.dimMax= 5; ? ? ?% Upper dimension boundary.%---------------------------------------------------------------% Initialize WDO population, position and velocity:% Randomize population in the range of [-1, 1]:pos = 2*(rand(param.popsize,param.npar)-0.5);% Randomize velocity:vel = maxV * 2 * (rand(param.popsize,param.npar)-0.5); ? %---------------------------------------------------------------% Evaluate initial population: (Sphere Function)for K=1:param.popsize, ?x = (dimMax - dimMin) * ((pos(K,:)+1)./2) + dimMin; ? ? ?pres(K,:) = sum (x.^2);end%----------------------------------------------------------------% Finding best air parcel in the initial population :[globalpres,indx] = min(pres);globalpos = pos(indx,:);minpres(1) = min(pres); ? ? ?% minimum pressure%-----------------------------------------------------------------% Rank the air parcels:[sorted_pres rank_ind] = sort(pres);% Sort the air parcels:pos = pos(rank_ind,:);keepglob(1) = globalpres;%-----------------------------------------------------------------% Start iterations :iter = 1; ? % iteration counterfor ij = 2:param.maxit, ? ? ?% Update the velocity: ? ? ?for i=1:param.popsize ? ?% choose random dimensions: ? ?a = randperm(param.npar); ? ? ? ? ? ? ? ? ?% choose velocity based on random dimension: ? ? ? ?velot(i,:) = vel(i,a); ? ? ? ? ? ? ? ? ?vel(i,:) = (1-param.alp)*vel(i,:)-(param.g*pos(i,:))+ ... ? ? ? ? ? ?abs(1-1/i)*((globalpos-pos(i,:)).*param.RT)+ ... ? ? ? ? ? ?(param.c*velot(i,:)/i); ? ? ?end ? ? ? ? ?% Check velocity: ? ? ? ? ?vel = min(vel, maxV); ? ? ? ? ?vel = max(vel, -maxV); ? ?% Update air parcel positions: ? ? ? ?pos = pos + vel; ? ? ? ? ?pos = min(pos, 1.0); ? ? ? ? ?pos = max(pos, -1.0); ? ?% Evaluate population: (Pressure) ? ?for K=1:param.popsize, ? ? ?x = (dimMax - dimMin) * ((pos(K,:)+1)./2) + dimMin; ? ? ? ? ?pres(K,:) = sum (x.^2); ? ?end ? ? ?%---------------------------------------------------- ? ? ?% Finding best particle in population ? ? ?[minpres,indx] = min(pres); ? ? ?minpos = pos(indx,:); ? ? ? ? ? ? % min location for this iteration ? ? ?%---------------------------------------------------- ? ? ?% Rank the air parcels: ? ? ?[sorted_pres rank_ind] = sort(pres); ? ? ?% Sort the air parcels position, velocity and pressure: ? ? ?pos = pos(rank_ind,:); ? ? ?vel = vel(rank_ind,:); ? ? ?pres = sorted_pres; ? ? ? ?% Updating the global best: ? ? ?better = minpres < globalpres; ? ? ?if better ? ? ? ? ? ?globalpres = minpres ? ? ? ? ? ? % initialize global minimum ? ? ? ? ? ?globalpos = minpos; ? ? end ?% Keep a record of the progress: ? ? ?keepglob(ij) = globalpres; ? ? ?save WDOposition.txt pos -ascii -tabs;end ?%Save values to the final file. ? ? ?pressure = transpose(keepglob); ? ? ?save WDOpressure.txt pressure -ascii -tabs; ? ? ?%END%-----------------------------------------------------

3 運(yùn)行結(jié)果

4 參考文獻(xiàn)

[1]張燁, 黃偉. 基于天牛群算法優(yōu)化SVM的磨煤機(jī)故障診斷.?

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

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




【SVM分類】基于風(fēng)驅(qū)動(dòng)算法優(yōu)化支持向量機(jī)實(shí)現(xiàn)數(shù)據(jù)分類附matlab代碼的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
诏安县| 凤庆县| 陕西省| 思茅市| 姚安县| 青浦区| 淮滨县| 宁乡县| 理塘县| 通道| 岳阳县| 筠连县| 张家界市| 庄浪县| 碌曲县| 山丹县| 波密县| 炉霍县| 磐安县| 平定县| 盐山县| 湟中县| 弥勒县| 醴陵市| 太谷县| 汉阴县| 荔浦县| 成都市| 漳浦县| 马龙县| 专栏| 和平县| 乌兰浩特市| 邢台县| 临高县| 佳木斯市| 永德县| 前郭尔| 诸城市| 江华| 墨江|