Skip to content

Rand index (randindex)#

ruptures.metrics.randindex.randindex(bkps1, bkps2) #

Rand index for two partitions. The result is scaled to be within 0 and 1.

Parameters:

Name Type Description Default
bkps1 list

list of the last index of each regime.

required
bkps2 list

list of the last index of each regime.

required

Returns:

Type Description
float

Rand index

Source code in ruptures/metrics/randindex.py
def randindex(bkps1, bkps2):
    """Rand index for two partitions. The result is scaled to be within 0 and
    1.

    Args:
        bkps1 (list): list of the last index of each regime.
        bkps2 (list): list of the last index of each regime.

    Returns:
        float: Rand index
    """
    return 1 - hamming(bkps1, bkps2)