pycrostates.cluster.utils.optimize_order#

pycrostates.cluster.utils.optimize_order(inst, template_inst)[source]#

Optimize the order of cluster centers between two cluster instances.

Optimize the order of cluster centers in an instance of a clustering algorithm to maximize auto-correlation, based on a template instance as determined by the Hungarian algorithm. The two cluster instances must have the same number of cluster centers and the same polarity setting.

Parameters:
instCluster

Fitted clustering algorithm to reorder.

template_instCluster

Fitted clustering algorithm to use as template for reordering.

Returns:
orderlist of int

The new order to apply to inst to maximize auto-correlation of cluster centers.