犯错我要分享

Clustering algorithm: K-M

matlab 犯错

关注次数: 188

下载次数: 0

文件大小: 9.45 kB

代码分类: 其他

开发平台: matlab

下载需要积分: 2积分

版权声明:如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

代码描述

中文说明:聚类算法:k―medoids 方法。这儿选取一个对象叫做mediod来代替上面的中心 的作用,这样的一个medoid就标识了这个类。步骤: 1,任意选取K个对象作为medoids(O1,O2,…Oi…Ok)。 以下是循环的: 2,将余下的对象分到各个类中去(根据与medoid最相近的原则); 3,对于每个类(Oi)中,顺序选取一个Or,计算用Or代替Oi后的消耗―E(Or)。选择E最小的那个Or来代替Oi。这样K个medoids就改变了,下面就再转到2。 4,这样循环直到K个medoids固定下来。 这种算法对于脏数据和异常数据不敏感,但计算量显然要比K均值要大,一般只适合小数据量。 这里是MAtlab源代码。-err


English Description:

Clustering algorithm: k-medoids method. Here we select an object called mediod to replace the role of the center above. Such a medoid identifies the class. Steps: 1. Randomly select k objects as medoids (O1, O2 Oi… Ok)。 The following are cyclic: 2, divide the remaining objects into various classes (according to the principle closest to medoid); 3, for each class (OI), select an or in order, and calculate the consumption after replacing oi with or -- E (or). Choose the or with the smallest e to replace OI. In this way, the K medoids will be changed. Next, we will go to 2. 4. Cycle until K medoids are fixed. This algorithm is not sensitive to dirty data and abnormal data, but the amount of computation is obviously larger than K-means, which is generally suitable for small data. Here is the matlab source code. -err


代码预览