聚类树
用版本 11 中新增的 ClusteringTree 函数构建并可视化任意数据的层次聚类.
基于相互接近程度的城市的聚类.
In[1]:=
ClusteringTree[{Entity[
"City", {"London", "GreaterLondon", "UnitedKingdom"}],
Entity["City", {"Paris", "IleDeFrance", "France"}],
Entity["City", {"Chicago", "Illinois", "UnitedStates"}],
Entity["City", {"Tokyo", "Tokyo", "Japan"}],
Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
Entity["City", {"Moscow", "Moscow", "Russia"}],
Entity["City", {"SanDiego", "California", "UnitedStates"}],
Entity["City", {"Baltimore", "Maryland", "UnitedStates"}]}]
Out[1]=
从一个颜色列表得到一个聚类层次.
In[2]:=
colors = RandomColor[18]
Out[2]=
In[3]:=
ClusteringTree[colors, ClusterDissimilarityFunction -> "Centroid"]
Out[3]=
选用一个不同的 GraphLayout.
In[4]:=
ClusteringTree[RandomColor[40],
ClusterDissimilarityFunction -> "Centroid",
GraphLayout -> "RadialDrawing"]
Out[4]=