rms_permute
rms_permute(confusion_matrix, labels)
Perform reverse merge/split (RMS) permutation analysis on a confusion matrix.
Analyzes and permutes a confusion matrix to identify merge and split relationships between predicted and ground truth labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
confusion_matrix
|
ndarray
|
The confusion matrix to analyze, shape (n_classes, n_classes) |
required |
labels
|
ndarray
|
The labels corresponding to the confusion matrix rows/columns, shape (n_classes,) |
required |
Returns:
| Type | Description |
|---|---|
RMSResult
|
Named tuple with fields: - permuted_matrix: reordered confusion matrix - permuted_labels: reordered labels - rms_label_map: dict of merge/split relationships - rms_map_matrix: Nx4 matrix of relationships - rms_map_type: array of 'rmerge' or 'rsplit' |
Examples:
>>> import numpy as np
>>> conf_mat = np.array([[2, 1, 0], [0, 3, 1], [1, 0, 2]])
>>> labels = np.array([1, 2, 3])
>>> result = rms_permute(conf_mat, labels)
>>> result.permuted_matrix # or unpack as tuple