用Mathematica对数据进行聚类分析

2026-02-15 13:38:08

1、给出一组数据:

a = RandomReal[{-10, 10}, 20];

聚类:

FindClusters[a]

Mathematica把这组数据分为两类。

用Mathematica对数据进行聚类分析

2、如果希望分为不多于4类,需要指定分组:

FindClusters[a, 4]

用Mathematica对数据进行聚类分析

3、随机给出一组平面上的点集:

a = RandomReal[{-10, 10}, {10000, 2}];

分成三类,并画图:

b = FindClusters[a, 3];

ListPlot[%, AspectRatio -> Automatic]

用Mathematica对数据进行聚类分析

4、分成8类。

用Mathematica对数据进行聚类分析

5、三维空间的点分成三类,并用凸包分隔。

用Mathematica对数据进行聚类分析

用Mathematica对数据进行聚类分析

猜你喜欢