cratepy.clustering.clusteringphase.ACRMP¶
- class ACRMP[source]¶
Bases:
CRMP
Adaptive Cluster-Reduced Material Phase interface.
- perform_adaptive_clustering(self, target_clusters, target_clusters_data)[source]¶
abstract: Perform ACRMP adaptive clustering step.
- get_adaptive_output(self)[source]¶
abstract: Get adaptivity metrics for clustering adaptivity output.
- get_adaptivity_type_parameters()[source]¶
abstract: Get ACRMP mandatory and optional adaptivity type parameters.
- _set_adaptivity_type_parameters(self, adaptivity_type)[source]¶
abstract: Set clustering adaptivity parameters.
- _dynamic_split_factor(ref_split_factor, adapt_trigger_ratio, magnitude, dynamic_amp=0)[source]¶
Compute dynamic adaptive clustering split factor.
Constructor.
List of Public Methods
Get adaptivity metrics for clustering adaptivity output.
Get ACRMP mandatory and optional adaptivity type parameters.
Get cluster-reduced material phase adaptivity type.
Get current number of clusters.
Get valid clustering algorithms to compute the CRMP.
Perform ACRMP adaptive clustering step.
Perform CRMP base clustering.
Methods
- abstract __init__()¶
Constructor.
- abstract _check_adaptivity_lock()[source]¶
Check ACRMP adaptivity locking conditions.
Check conditions that may deactivate the adaptive procedures in the ACRMP. Once the ACRMP adaptivity is locked, it is treated as a SCRMP for the remainder of the problem numerical solution.
- static _dynamic_split_factor(ref_split_factor, adapt_trigger_ratio, magnitude, dynamic_amp=0)[source]¶
Compute dynamic adaptive clustering split factor.
A detailed description of the dynamic adaptive clustering split factor can be found in Ferreira et. al (2022) [1].
- Parameters:
ref_split_factor (float) – Reference (centered) adaptive clustering split factor. The adaptive clustering split factor must be contained between 0 and 1 (included). The lower bound (0) enforces a single split, while the upper bound (1) performs the maximum number splits of each cluster (leading to single-voxel clusters).
adapt_trigger_ratio (float) – Threshold associated with the adaptivity trigger condition.
magnitude (float) – Difference between cluster ratio and adaptive trigger ratio. Given that the cluster ratio ranges between 0 and 1 and only clusters with a ratio greater or equal than the adaptive trigger ratio are targeted, the magnitude ranges between 0 and 1 - trigger ratio.
dynamic_amp (float, default=0) – Dynamic split factor amplitude centered around the reference adaptive clustering split factor.
- Returns:
adapt_split_factor – Adaptive clustering split factor. The adaptive clustering split factor must be contained between 0 and 1 (included). The lower bound (0) enforces a single split, i.e., 2 new clusters, while the upper bound (1) is associated with a maximum defined number of new voxels.
- Return type:
- abstract _set_adaptivity_type_parameters(adaptivity_type)[source]¶
Set clustering adaptivity parameters.
- Parameters:
adaptivity_type (dict) – Clustering adaptivity parameters.
- static _update_cluster_labels(labels, min_label=0)¶
Update cluster labels starting with the provided minimum label.
- Parameters:
labels (numpy.ndarray (1d)) – Cluster labels (numpy.ndarray[int] of shape (n_items,)).
min_label (int, default=0) – Minimum cluster label.
- Returns:
new_labels (numpy.ndarray (1d)) – Updated cluster labels (numpy.ndarray[int] of shape (n_items,)).
max_label (int) – Maximum cluster label.
- abstract static get_adaptivity_type_parameters()[source]¶
Get ACRMP mandatory and optional adaptivity type parameters.
Besides returning the ACRMP mandatory and optional adaptivity type parameters, this method establishes the default values for the optional parameters.
- Returns:
adapt_type_man_parameters (list[str]) – Mandatory adaptivity type parameters (str).
adapt_type_opt_parameters (dict) – Optional adaptivity type parameters (key, str) and associated default value (item).
- abstract get_clustering_type()¶
Get cluster-reduced material phase adaptivity type.
- Returns:
clustering_type – Type of cluster-reduced material phase.
- Return type:
- abstract get_n_clusters()¶
Get current number of clusters.
- Returns:
n_clusters – Number of material phase clusters.
- Return type:
- abstract static get_valid_clust_algs()¶
Get valid clustering algorithms to compute the CRMP.
- abstract perform_adaptive_clustering(target_clusters, target_clusters_data)[source]¶
Perform ACRMP adaptive clustering step.
- Parameters:
- Returns:
adaptive_clustering_map – List of new cluster labels (item, list[int] resulting from the adaptivity of each target cluster (key, str).
- Return type:
- abstract perform_base_clustering()¶
Perform CRMP base clustering.