You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.7 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 作业报告
## 1. 基本的kMeans方法
首先我编写了一个最基础的kMeans类聚类方法采用简单的离最近重心进行归类并且不进行任何映射。原始数据点如下所示
![](images/original_points.png)
<center>图1. 原始数据点</center>
采用基础的kMeans方法分成两类后的结果如下所示
![](images/basic_kMeans.png)
<center>图2. 采用基本的kMeans方法进行分类</center>
## 2. 对原始数据进行变换
对原始数据点进行分析后,觉得可以将原始点映射到一个离`(0, 0)`点距离的空间中去,同样对数据归为两类,最终运行结果如下所示:
![](images/map.png)
<center>图3. 对原始数据点进行变换后再使用kMeans归类</center>
可以看到,通过对原始点进行变换后,归类后的效果更好。
## 3. 其他聚类方法
除了上述简单的聚类方法后,我还通过查找资料学习了到了一种根据密度进行聚类的方法,其核心思想是认为同一类别的样本,它们之间应该是紧密相连的,也就是说,在该类别任意样本周围不远处一定有同类别的样本存在,通过将紧密相连的样本划为一类,这样就得到了一个聚类类别。其伪代码如下:
![](images/pseudocode.png)
密度聚类不需要提前给定分类数,但其对参数`eps`和`minPts`比较敏感,如果选取不当,可以不能将数据点归类开,或者归类质量较低。对于给定的数据,在对参数多次尝试后,最后发现当`eps=5``minPts=5`时聚类效果不错,运行结果如下所示:
![](images/density_cluster.png)
<center>图4. 采用密度聚类</center>