⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 majority1.m

📁 MATLAB编写的一种模式识别里的重要的模糊聚类方法K-means算法的matlab程序.
💻 M
字号:
function [value,vote] = majority1(t1,w);% MAJORITY1: returns weighted majority vote for a *row vector*% [value,vote] = majority1(t1,w)%	t1    - the data, *must be a row vector*%	w     - the weight vector, if omitted equal weights%	value - the result (e.g. majority([1 1 2 3]) = 1)%	vote  - the vote supporting the result (for above example, vote = 2)% Copyright (c) 1995-1996 Frank Dellaert% All rights Reserved[d,n] = size(t1);if (nargin==1), w=ones(1,n); endif(d~=1), error('row vectors only !'); enda = min(t1);b = max(t1);index = 0;value = 0;vote=0;for i=a:b,  myvote = sum((t1==i).*w);  if (myvote>vote), vote=myvote; value=i; endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -