cluster_tsne_knn_louvain | R Documentation |
This function performs clustering on t-SNE results by first applying K-Nearest Neighbors (KNN) to construct a graph, and then using the Louvain method for community detection. The function dynamically adjusts KNN parameters based on the size of the dataset, ensuring scalability. Additionally, it computes the silhouette score to evaluate cluster quality and calculates cluster centroids for visualization.
cluster_tsne_knn_louvain(
info.norm,
tsne.norm,
settings,
resolution_increment = 0.1,
min_modularity = 0.5
)
info.norm |
A data frame containing the normalized data on which the t-SNE analysis was carried out. |
tsne.norm |
A list containing the t-SNE results, including a 2D t-SNE coordinate matrix in the |
settings |
A list of settings for the analysis, including:
|
resolution_increment |
The step size for incrementing the Louvain clustering resolution. Defaults to 0.1. |
min_modularity |
The minimum modularity score allowed for a valid clustering. Defaults to 0.5. |
This function begins by constructing a KNN graph from the t-SNE results, then applies the Louvain algorithm for community detection. The KNN parameter is dynamically adjusted based on the size of the dataset to ensure scalability. The function evaluates clustering quality using silhouette scores and calculates cluster centroids for visualization. NA cluster assignments are handled by assigning them to a separate cluster labeled as "100."
A list containing the following elements:
info.norm
: The input data frame with an additional pandora_cluster
column for cluster assignments.
cluster_data
: A data frame containing cluster centroids and cluster labels.
avg_silhouette_score
: The average silhouette score, a measure of clustering quality.
modularity
: The modularity score of the Louvain clustering.
num_clusters
: The number of clusters found.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.