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

歡迎光臨散文網(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ó)家法律
抚宁县| 固始县| 塔城市| 静安区| 沁水县| 望谟县| 铁岭市| 墨玉县| 措勤县| 武安市| 吴桥县| 麦盖提县| 如东县| 色达县| 班玛县| 乌拉特中旗| 城固县| 澜沧| 宁德市| 永定县| 肇东市| 拉孜县| 涪陵区| 苍梧县| 雷山县| 夹江县| 色达县| 泰和县| 永新县| 甘孜| 从江县| 民勤县| 孝感市| 南召县| 临颍县| 平顺县| 怀来县| 乃东县| 镇康县| 招远市| 崇义县|