【数据聚类】基于多元宇宙优化DBSCAN实现数据聚类分析附matlab代码

本文涉及的产品
应用型负载均衡 ALB,每月750个小时 15LCU
传统型负载均衡 CLB,每月750个小时 15LCU
网络型负载均衡 NLB,每月750个小时 15LCU
简介: 【数据聚类】基于多元宇宙优化DBSCAN实现数据聚类分析附matlab代码

 1 简介

针对DBSCAN聚类算法对参数敏感,参数选取依靠经验的问题,文章提出了一种基于多元宇宙优化的DBSCAN聚类(MVO-DBSCAN)算法.

2 部分代码

%_______________________________________________________________________________________%

%  Multi-Verse Optimizer (MVO) source codes demo version 1.0                            %

%                                                                                       %

%  Developed in MATLAB R2011b(7.13)                                                     %

%                                                                                       %

%  Author and programmer: Seyedali Mirjalili                                            %

%                                                                                       %

%         e-Mail: ali.mirjalili@gmail.com                                               %

%                 seyedali.mirjalili@griffithuni.edu.au                                 %

%                                                                                       %

%       Homepage: http://www.alimirjalili.com                                           %

%                                                                                       %

%   Main paper:                                                                         %

%                                                                                       %

%   S. Mirjalili, S. M. Mirjalili, A. Hatamlou                                          %

%   Multi-Verse Optimizer: a nature-inspired algorithm for global optimization          %

%   Neural Computing and Applications, in press,2015,                                   %

%   DOI: http://dx.doi.org/10.1007/s00521-015-1870-7                                    %

%                                                                                       %

%_______________________________________________________________________________________%

% You can simply define your cost in a seperate file and load its handle to fobj

% The initial parameters that you need are:

%__________________________________________

% fobj = @YourCostFunction

% dim = number of your variables

% Max_iteration = maximum number of generations

% SearchAgents_no = number of search agents

% lb=[lb1,lb2,...,lbn] where lbn is the lower bound of variable n

% ub=[ub1,ub2,...,ubn] where ubn is the upper bound of variable n

% If all the variables have equal lower bound you can just

% define lb and ub as two single number numbers

% To run MVO: [Best_score,Best_pos,cg_curve]=MVO(Universes_no,Max_iteration,lb,ub,dim,fobj)

%__________________________________________

function [Best_universe_Inflation_rate,Best_universe,Convergence_curve]=MVO(N,Max_time,lb,ub,dim,MinPts,train_X,train_labels)

%Two variables for saving the position and inflation rate (fitness) of the best universe

Best_universe=zeros(1,dim);

Best_universe_Inflation_rate=inf;

%Initialize the positions of universes

Universes=initialization(N,dim,ub,lb);

%Minimum and maximum of Wormhole Existence Probability (min and max in

% Eq.(3.3) in the paper

WEP_Max=1;

WEP_Min=0.2;

Convergence_curve=zeros(1,Max_time);

%Iteration(time) counter

Time=1;

%Main loop

while Time<Max_time+1

   

   %Eq. (3.3) in the paper

   WEP=WEP_Min+Time*((WEP_Max-WEP_Min)/Max_time);

   

   %Travelling Distance Rate (Formula): Eq. (3.4) in the paper

   TDR=1-((Time)^(1/6)/(Max_time)^(1/6));

   

   %Inflation rates (I) (fitness values)

   Inflation_rates=zeros(1,size(Universes,1));

   

   for i=1:size(Universes,1)

       

       %Boundary checking (to bring back the universes inside search

       % space if they go beyoud the boundaries

       Flag4ub=Universes(i,:)>ub;

       Flag4lb=Universes(i,:)<lb;

       Universes(i,:)=(Universes(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;

       

       %Calculate the inflation rate (fitness) of universes

       Inflation_rates(1,i)=fitness(Universes(i,1),MinPts,train_X,train_labels);

       

       %Elitism

       if Inflation_rates(1,i)<Best_universe_Inflation_rate

           Best_universe_Inflation_rate=Inflation_rates(1,i);

           Best_universe=Universes(i,:);

       end

       

   end

   

   [sorted_Inflation_rates,sorted_indexes]=sort(Inflation_rates);

   

   for newindex=1:N

       Sorted_universes(newindex,:)=Universes(sorted_indexes(newindex),:); % 将Universes按照Inflation_rates的下标进行排序

   end

   

   %Normaized inflation rates (NI in Eq. (3.1) in the paper)

   normalized_sorted_Inflation_rates=normr(sorted_Inflation_rates);

   

   Universes(1,:)= Sorted_universes(1,:);

   

   %Update the Position of universes

   for i=2:size(Universes,1)%Starting from 2 since the firt one is the elite

       Black_hole_index=i;

       for j=1:size(Universes,2)

           r1=rand();

           if r1<normalized_sorted_Inflation_rates(i)

               White_hole_index=RouletteWheelSelection(-sorted_Inflation_rates);% for maximization problem -sorted_Inflation_rates should be written as sorted_Inflation_rates

               if White_hole_index==-1

                   White_hole_index=1;

               end

               %Eq. (3.1) in the paper

               Universes(Black_hole_index,j)=Sorted_universes(White_hole_index,j);

           end

           

           if (size(lb,2)==1)

               %Eq. (3.2) in the paper if the boundaries are all the same

               r2=rand();

               if r2<WEP

                   r3=rand();

                   if r3<0.5

                       Universes(i,j)=Best_universe(1,j)+TDR*((ub-lb)*rand+lb);

                   end

                   if r3>0.5

                       Universes(i,j)=Best_universe(1,j)-TDR*((ub-lb)*rand+lb);

                   end

               end

           end

           

           if (size(lb,2)~=1)

               %Eq. (3.2) in the paper if the upper and lower bounds are

               %different for each variables

               r2=rand();

               if r2<WEP

                   r3=rand();

                   if r3<0.5

                       Universes(i,j)=Best_universe(1,j)+TDR*((ub(j)-lb(j))*rand+lb(j));

                   end

                   if r3>0.5

                       Universes(i,j)=Best_universe(1,j)-TDR*((ub(j)-lb(j))*rand+lb(j));

                   end

               end

           end

           

       end

   end

   

   %Update the convergence curve

   Convergence_curve(Time)=Best_universe_Inflation_rate;

   Time=Time+1;

end

3 仿真结果

image.gif编辑

4 参考文献

[1]王李彧, 孙斌. 基于改进的DBSCAN聚类算法的云任务调度策略研究[C]// 2016年全国通信软件学术会议. 2016.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。


相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
相关文章
|
2月前
|
算法 定位技术 计算机视觉
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
113 0
|
2月前
|
机器学习/深度学习 算法 机器人
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
144 8
|
2月前
|
机器学习/深度学习 编解码 算法
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
142 8
|
2月前
|
机器学习/深度学习 算法 机器人
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
212 0
|
2月前
|
算法 机器人 计算机视觉
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
|
2月前
|
新能源 Java Go
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
109 0
|
2月前
|
机器学习/深度学习 数据采集 测试技术
基于CEEMDAN-VMD-BiLSTM的多变量输入单步时序预测研究(Matlab代码实现)
基于CEEMDAN-VMD-BiLSTM的多变量输入单步时序预测研究(Matlab代码实现)
|
2月前
|
机器学习/深度学习 算法 自动驾驶
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
158 8
|
2月前
|
编解码 运维 算法
【分布式能源选址与定容】光伏、储能双层优化配置接入配电网研究(Matlab代码实现)
【分布式能源选址与定容】光伏、储能双层优化配置接入配电网研究(Matlab代码实现)
155 12
|
2月前
|
人工智能 数据可视化 网络性能优化
【顶级SCI复现】虚拟电厂的多时间尺度调度:在考虑储能系统容量衰减的同时,整合发电与多用户负荷的灵活性研究(Matlab代码实现)
【顶级SCI复现】虚拟电厂的多时间尺度调度:在考虑储能系统容量衰减的同时,整合发电与多用户负荷的灵活性研究(Matlab代码实现)
106 9

热门文章

最新文章