本文代码均已在 MATLAB R2019b 测试通过,如有错误,欢迎指正。
另外,这次实验都是调用Matlab现成的函数,没什么技术含量。
(一)聚类分析的原理
聚类是将数据分类到不同的类或者簇这样的一个过程,所以同一个簇中的对象有很大的相似性,而不同簇间的对象有很大的相异性。
[En]
Clustering is a process of classifying data into different classes or clusters, so the objects in the same cluster are very similar, while the objects in different clusters are very different.
聚类分析是一种探索性的分析,在分类的过程中,人们不必事先给出一个分类的标准,聚类分析能够从样本数据出发,自动进行分类。聚类分析所使用方法的不同,常常会得到不同的结论。不同研究者对于同一组数据进行聚类分析,所得到的聚类数未必一致。
[En]
Cluster analysis is a kind of exploratory analysis, in the process of classification, people do not have to give a classification standard in advance, cluster analysis can start from the sample data and classify automatically. Different methods used in cluster analysis often lead to different conclusions. Different researchers do cluster analysis for the same group of data, the number of clusters may not be the same.
从实际应用的角度看,聚类分析是数据挖掘的主要任务之一。而且聚类能够作为一个独立的工具获得数据的分布状况,观察每一簇数据的特征,集中对特定的聚簇集合作进一步地分析。聚类分析还可以作为其他算法(如分类和定性归纳算法)的预处理步骤。
[En]
From the perspective of practical application, clustering analysis is one of the main tasks of data mining. And clustering can be used as an independent tool to obtain the distribution of data, observe the characteristics of each cluster, and focus on the cooperation of specific clusters for further analysis. Clustering analysis can also be used as a preprocessing step for other algorithms, such as classification and qualitative induction algorithms.
(二)matlab中聚类的实现算法
方法一:直接聚类,利用clusterdata函数对样本数据进行一次聚类,其缺点为可供用户选择的面较窄,不能更改距离的计算方法,该方法的使用者无需了解聚类的原理和过程,但是聚类效果受限制。
方法二:层次聚类,该方法较为灵活,需要按步骤实现聚类过程,具体需要进行如下过程处理:
[En]
Method 2: hierarchical clustering, this method is flexible and needs to implement the clustering process step by step, which needs to be handled as follows:
(1)计算数据集合中样本两两之间的相似性,用pdist函数计算样本之间的距离;
(2)用linkage函数定义类间距离;
(3)用cluster函数创建聚类。
方法三:划分聚类,包括K均值聚类和K中心聚类,同样需要系列步骤完成该过程,要求使用者对聚类原理和过程有较清晰的认识。