Analysis#

PCA#

get_explained_variance_ratio(explained_variance)

get_cum_explained_variance_ratio(...)

get_optimal_n_pcs(cum_explained_variance_ratio)

pca_transform_contours(contours, ...)

Transform contour coordinates to principal directions in the PC space.

Hierarchical Clustering#

cluster_contours(pc[, n_clusters, n_pcs, ...])

K-means clustering of contour principal components.

assign_clusters_id(pc, contours, centroids)

Assign the contours with id of the closest centroid.

get_labeled_contours_df(contours, cluster_id_df)

Return contour coordinates, cluster id, and distance to centroid.

get_mean_cluster_contours(labeled_contours_df)

Return mean contour of each cluster.

hierarchical_cluster_contour(labeled_contours_df)

Compute data structure for rendering dendrogram.

get_cluster_order(branches)

Get the cluster id of contours in order of dendrogram.

get_distribution(properties_df)

Return proportion of each cluster.

get_shannon_entropy(distribution)

Calculate Shannon entropy from distribution (probability) of each shape mode.

reorder_clusters(cluster_id, object_index)

Reorder cluster id according to dendrogram order.

reorder_centroids(centroids, object_index)

Reorder centroids according to dendrogram order.