【数据聚类】基于多元宇宙优化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 仿真结果
4 参考文献
[1]王李彧, 孙斌. 基于改进的DBSCAN聚类算法的云任务调度策略研究[C]// 2016年全国通信软件学术会议. 2016.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
【数据聚类】基于多元宇宙优化DBSCAN实现数据聚类分析附matlab代码相关推荐
- 【数据分析】基于多元宇宙优化DBSCAN聚类matlab源码
一.MVO 1.基本概念 MVO算法的思想启发于物理学中多元宇宙理论,通过对白/黑洞(宇宙)和虫洞等概念及其相互作用机理的数学化描述实现待优化问题的求解. 白洞:是一个只发射不吸收的特殊天体,并且是诞 ...
- 【故障诊断】基于贝叶斯优化支持向量机的轴承故障诊断附matlab代码
1 内容介绍 贝叶斯网络(Bayesian Network或BN)是人工智能领域进行建模和不确定性推理的一个有效工具.贝叶斯网推理的基本任务是:给定一组证据变量观察值,通过搜索条件概率表计算一组查询变 ...
- 【信号去噪】基于鲸鱼算法优化VMD实现信号去噪附matlab代码
1 内容介绍 一种基于WOAVMD算法的信号去噪方法,具体为:根据鲸鱼优化算法分别建立目标包围,发泡网攻击以及猎物搜寻的数学模型,然后进行初始化参数,在取值范围内初始化鲸鱼的位置向量,根据位置向量对原 ...
- 【PNN分类】基于麻雀算法优化pnn神经网络实现数据分类附matlab代码
1 简介 概率神经网络(Probabilistic Neural Network,简称PNN)是利用贝叶斯定理和基于风险最小的贝叶斯决策规则对新样本进行分类的神经网络,具有训练时间短且不易收敛到局部极 ...
- 【ElM分类】基于哈里斯鹰优化ElM神经网络实现数据分类附matlab代码
1 简介 为了提高核极限学习机(ELM)的分类正确率,采用哈里斯鹰算法(HHO)对惩罚系数,宽度参数两个参数进行优化.首先,根据乳腺良恶性肿瘤数据库训练集并利用哈里斯鹰算法优化核极限学习机;然后,通过 ...
- 【BP分类】基于鸟群算法优化BP神经网络实现数据分类附matlab代码
1 简介 BSA 算法优化 BP 神经网络的基本思想是: 利 用 BSA 算法的全局搜索能力, 优化 BP 神经网络初始的权值和阈值, 也就是决策变量, 其中每一组决策变量均包含在鸟群个体所处的空间 ...
- 基于人工鱼群优化可倒摆法(QIP)控制器附matlab代码
✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.
- 【预测模型-ElM分类】基于松鼠算法优化ElM神经网络实现数据分类附matlab代码
✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.
- 【预测模型-BP分类】基于蝙蝠算法优化BP神经网络实现数据分类附matlab代码
✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.
- 优化切尔诺贝利灾难模型——附matlab代码
优化切尔诺贝利灾难模型--附matlab代码 切尔诺贝利核电站事故是人类历史上最严重的核事故之一,对环境和人类健康造成了极大的影响.针对这样的事故,科学家们开发了许多模型用于预测和优化应对措施.本文将 ...
最新文章
- python3 判断字符串是否包含指定字符
- C语言 链表的创建--打印--逆置--新增--删除--排序--释放
- FIFO and DMA
- Android NDK 内存泄露检测
- JS百度地图高德地图API的接入与使用
- js中货币格式化方法
- AbstractByteBuf源码分析
- element-ui简单使用
- python如何处理spark上的数据_Pyspark获取并处理RDD数据代码实例
- 移动端input“输入框”常见问题及解决方法
- web开发模式+三层架构与MVC
- Eclipse PHPEclipse 配置
- android uml建模工具 mac,UML建模工具Mac版
- vss服务器手动备份项目,VSS数据自动备份
- CSS 固定定位:固定在版心右侧
- 情感分析学习笔记(3)——情感传播(sentiment propagation)
- 2022-2028年中国直线电机行业市场现状分析及投资前景评估报告
- setPositiveButton和setNegativeButton的区别
- AttributeError: ‘str‘ object has no attribute ‘spilt‘ on line 9
- 求一个方阵的主对角线及次对角线的和(C语言)(二维数组)