资源简介

可以做图像分割,数据挖掘,目前,针对K-Means算法研究及应用,尤其是在文本聚类挖掘层面的应用研究越来越多。 K-means算法是很典型的基于距离的聚类算法,采用距离作为相似性的评价指标,即认为两个对象的距离越近,其相似度就越大。该算法认为簇是由距离靠近的对象组成的,因此把得到紧凑且独立的簇作为最终目标。

资源截图

代码片段和文件信息

function ret = Crossover(pcrosschromscale_group)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%function chrom = Crossover(pcchromscale_group)函数完成交叉操作
%pc: input交叉概率
%chrom:input染色体
%scale_group: input种群规模
%new_chrom: output交叉后的染色体
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for i = 1 : scale_group
    %交叉概率决定是否进行交叉
    pick = rand;
    while pick == 0
        pick = rand;
    end
    if pick > pcross
        continue;
    end
    %随机选择交叉个体
    index = ceil(rand(12)*scale_group);
    while index(1) == index(2) || index(1) * index(2) == 0
         index = ceil(rand(12)*scale_group);
    end
    %随机选择交叉位置
    position = ceil(rand*3);
    while position == 0
        position = ceil(rand*3);
    end
    temp = chrom(index(1)position);
    chrom(index(1)position) = chrom(index(2)position);
    chrom(index(2)position) = temp;
end
ret = chrom;
end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        995  2015-06-29 15:03  Crossover.m

     文件       4751  2015-06-29 20:15  GA_clustering.m

     文件        874  2015-06-29 15:03  Mutation.m

     文件        757  2015-06-30 12:40  selection.m

----------- ---------  ---------- -----  ----

                 7377                    4


评论

共有 条评论