compute_centroids: Compute Centroids of Clusters

View source: R/compute_centroids.R

compute_centroidsR Documentation

Compute Centroids of Clusters

Description

The compute_centroids function calculates the center and centroid of each cluster given a feature matrix, grid, and cluster assignments.

Usage

compute_centroids(feature_mat, grid, assignment, medoid = FALSE)

Arguments

feature_mat

A matrix of features, where columns represent data points and rows represent features.

grid

A matrix representing the spatial grid of data points.

assignment

A vector containing the cluster assignment for each data point.

medoid

A logical value indicating whether to calculate medoids instead of means for cluster centers and centroids. Default is FALSE.

Value

A list containing two elements:

center

A matrix containing the centers of each cluster.

centroid

A matrix containing the centroids of each cluster.

Examples

## Not run: 
  # Assuming `feature_mat`, `grid`, and `assignment` are available
  centroids <- compute_centroids(feature_mat, grid, assignment)
  # To compute medoids instead of means
  medoids <- compute_centroids(feature_mat, grid, assignment, medoid=TRUE)

## End(Not run)


bbuchsbaum/neurocluster documentation built on April 1, 2024, 8:43 p.m.