Statistics¶
cluster_stats ¶
Cluster population statistics and frame assignments.
assign_clusters ¶
Attach cluster labels to frame records in a dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
Dataset whose frames will be updated in place. |
required |
labels
|
ndarray
|
Cluster label per frame, shape |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If label count does not match the number of frames. |
compute_cluster_stats ¶
Compute per-cluster populations and frame lists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
Dataset with cluster assignments on each frame record. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Mapping from |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any frame lacks a cluster assignment. |
sort_clusters_by_population ¶
Return cluster IDs sorted by population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cluster_stats
|
dict
|
Per-cluster statistics from :func: |
required |
ascending
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
list of int
|
Sorted cluster IDs. |
cluster_stats_to_rows ¶
Convert cluster statistics to flat rows for CSV export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cluster_stats
|
dict
|
Per-cluster statistics. |
required |
Returns:
| Type | Description |
|---|---|
list of dict
|
Rows with keys |