pysal.lib.weights.w_local_cluster

pysal.lib.weights.w_local_cluster(w)[源代码]

图中作为节点的每个单元的局部聚类系数。[WS]

参数:
w : W

空间权重对象

返回:
c : 数组

(w.n,1)局部聚类系数

笔记

局部聚类系数 \(c_i\) 量化观察对象之间的距离 \(i\) 要成为一个小集团:

\[C W J,K/(K I(K I-1)):J,K In N I\]

where \(N_i\) is the set of neighbors to \(i\), \(k_i = |N_i|\) and \(\{w_{j,k}\}\) is the set of non-zero elements of the weights between pairs in \(N_i\). [Watts1998]

实例

>>> from pysal.lib.weights import lat2W
>>> w = lat2W(3,3, rook=False)
>>> w_local_cluster(w) 
array([[1.        ],
       [0.6       ],
       [1.        ],
       [0.6       ],
       [0.42857143],
       [0.6       ],
       [1.        ],
       [0.6       ],
       [1.        ]])