class boundary preserving algorithm for data condensation

  • habib1418
    了解作者
  • matlab
    开发工具
  • 2.2KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 5 积分
    下载积分
  • 0
    下载次数
  • 2022-06-29 22:59
    上传日期
class boundary preserving algorithm for data condensation
class_boundary.rar
  • class_boundary
  • main_classboundary.m
    2.6KB
  • msc.m
    3.7KB
内容介绍
function [clustCent,data2cluster,cluster2dataCell] = msc(dataPts,bandWidth,plotFlag); % MeanShift Clustering of data %*** Check input **** if nargin < 2 error('no bandwidth specified') end if nargin < 3 plotFlag = true; plotFlag = false; end %**** Initialize stuff *** [numDim,numPts] = size(dataPts); numClust = 0; bandSq = bandWidth^2; initPtInds = 1:numPts; maxPos = max(dataPts,[],2); minPos = min(dataPts,[],2); boundBox = maxPos-minPos; sizeSpace = norm(boundBox); stopThresh = 1e-3*bandWidth; clustCent = []; beenVisitedFlag = zeros(1,numPts,'uint8'); numInitPts = numPts; clusterVotes = zeros(1,numPts,'uint16'); while numInitPts tempInd = ceil( (numInitPts-1e-6)*rand); stInd = initPtInds(tempInd); myMean = dataPts(:,stInd); myMembers = []; thisClusterVotes = zeros(1,numPts,'uint16'); while 1 %loop untill convergence sqDistToAll = sum((repmat(myMean,1,numPts) - dataPts).^2); inInds = find(sqDistToAll < bandSq); thisClusterVotes(inInds) = thisClusterVotes(inInds)+1; myOldMean = myMean; myMean = mean(dataPts(:,inInds),2); myMembers = [myMembers inInds]; beenVisitedFlag(myMembers) = 1; %*** plot stuff **** if plotFlag figure(12345),clf,hold on if numDim == 2 plot(dataPts(1,:),dataPts(2,:),'*') plot(dataPts(1,myMembers),dataPts(2,myMembers),'ys') plot(myMean(1),myMean(2),'go') plot(myOldMean(1),myOldMean(2),'rd') pause end end if norm(myMean-myOldMean) < stopThresh %check for merge posibilities mergeWith = 0; for cN = 1:numClust distToOther = norm(myMean-clustCent(:,cN)); if distToOther < bandWidth/2 mergeWith = cN; break; end end if mergeWith > 0 % something to merge clustCent(:,mergeWith) = 0.5*(myMean+clustCent(:,mergeWith)); %clustMembsCell{mergeWith} = unique([clustMembsCell{mergeWith} myMembers]); clusterVotes(mergeWith,:) = clusterVotes(mergeWith,:) + thisClusterVotes; else %its a new cluster numClust = numClust+1; clustCent(:,numClust) = myMean; %clustMembsCell{numClust} = myMembers; clusterVotes(numClust,:) = thisClusterVotes; end break; end end initPtInds = find(beenVisitedFlag == 0); numInitPts = length(initPtInds); end [val,data2cluster] = max(clusterVotes,[],1); if nargout > 2 cluster2dataCell = cell(numClust,1); for cN = 1:numClust myMembers = find(data2cluster == cN); cluster2dataCell{cN} = myMembers; end end
评论
    相关推荐
    • Classification
      分类 机器学习: 分类是将事物从从属特征分类为两个或多个类的方法。分类类型: Logistic回归-二进制Logistic分类-名义Logistic分类-一对多于休息一对一对一热编码技术 SVM-二进制-多种分类-一对休息-一对一 ...
    • classification
      使用tensorflow实现对图片的分类。里面自带数据集的下载。数据集大概3000张。
    • Classification
      分类 这是 NCKU 2014 年秋季的数据挖掘最终项目。 测试 如何执行 - i Dataset / test1 . txt - t Dataset / test1 . txt - o output - f marital_status
    • ImageClassification
      图像分类 不同项目的图像分类,主要使用TensorFlow及其API Keras
    • mobile_classification
      mobile_classification 这个项目完全是使用机器学习技术和其他库在python 3.8中创建的。 这个mobile_classificaton模型将借助其功能对移动设备“ price_range”进行分类, 在此项目中,使用了不同的python库,例如#...
    • Classification
      KNN_CLASSIFICATION: 该项目使用K-最近邻居算法将数据分类为二进制标签。 数据说明包含在笔记本中 Support_Vector_Classification: 这是使用支持向量机对数据进行分类的分类项目。 数据说明包含在笔记本中 ...
    • Classification
      Classification 1 Classification.scala完成的是对样本数据训练以及利用生成的模型对遥感影像进行分类的功能 样本数据为trainDataPath = "hdfs://10.214.0.151:8020/user/syzh/gaofen/classification/label.txt" 待...
    • pattern classification
      模式分类第二版答案及课后答案matlab代码
    • General-Classification
      executing the script *executing Generalized_Classification_Function.R*; or, 2. generating a website with details about the study: - from (*ux) command line: Rscript -e "rmarkdown::render_site(input ...
    • NN_multiclass_classification_Pytorch.rar
      multiple classification python jupyter notebook MLP pytorch