三元矩阵的分层聚类
我有一个具有值-1,0,1
的矩阵
array([[ 1, 1],
[ 0, -1],
[ 1, -1],
[ 1, 1]
[ -1, 1]])
,我想要的是从左到右的分层聚类。
- “最大” 3个集群包含数据点,在第一个维度中具有-1,0或1。
- 接下来的9个集群是对前3个群集的改进,以便它们包含一个
1在第一维处,在二维或
处11在第一维处,在二维或
处01在第一个维度,第二维或
处-10在第一个维度,在第二维或
处10在第一个维度,0在第二维或
处0在第一维时-1在第二维或
处-1在第一维处,在二维或
处1-1在第一维处,在二维或
处0-1在第一维处,第二维处-1
等等。
所需的输出应该是
output = [[[0,3],[],[2]],[[1],[],[]],[[4],[],[]]]
因为
数据点0([[ 1 ,1]),数据点2([ 1 ,-1])和数据点3([< 1 ,1])在第一个大集群中,数据点1([ 0 ,-1])在第二个大群集中,数据点4([ -1 ,1])在第三个大群集中,然后在第二个维度上进行的改进。
I have a matrix with values -1,0,1
of the form
array([[ 1, 1],
[ 0, -1],
[ 1, -1],
[ 1, 1]
[ -1, 1]])
and what I want is kind of a hierarchical clustering from left to right.
- The 'biggest' 3 clusters contain the data points, that have a -1,0 or 1 in the first dimension.
- The next 9 clusters are a refinement of the first 3 clusters such that they contain a
1 at first dimension, 1 at second dimension or
1 at first dimension, 0 at second dimension or
1 at first dimension, -1 at second dimension or
0 at first dimension, 1 at second dimension or
0 at first dimension, 0 at second dimension or
0 at first dimension, -1 at second dimension or
-1 at first dimension, 1 at second dimension or
-1 at first dimension, 0 at second dimension or
-1 at first dimension, -1 at second dimension
and so on.
The desired output should be
output = [[[0,3],[],[2]],[[1],[],[]],[[4],[],[]]]
because
data point 0 ([1,1]), data point 2 ([1,-1]) and data point 3 ([1,1]) are in the first big cluster, data point 1 ([0,-1]) is in the second big cluster, data point 4 ([-1,1]) is in the third big cluster and then the refinements concerning the second dimension.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是聚类的一个很好的例子,我认为这更多是一个分类案例,因为在这种情况下定义了类别的类别,并且以下命题等确定性代码足以分类所有条目:
This is not a good example on clustering, I believe it's more of a classification case since the classes in this case are defined, and a deterministic code such as the proposition below is enough to classifiy all the entries: