Learn R Programming

DCEM (version 1.0.0)

means_mv_impr: means_mv_impr: Part of DCEM package.

Description

Initialize the mean(s) for the Gaussian(s) by randomly selecting the samples from the dataset. It uses the proposed implementation from K-means++: The Advantages of Careful Seeding, David Arthur and Sergei Vassilvitskii. URL http://ilpubs.stanford.edu:8090/778/1/2006-13.pdf.

Usage

# Randomly seeding the mean(s).
means_mv_impr(data, num_means)

Arguments

data

(matrix): The dataset provided by the user (converted to matrix format).

num_means

(numeric): The number of means (meu).

Value

A matrix containing the selected samples from the dataset. The initial means will be updated during the iterations of the algorithm.

Examples

Run this code
# NOT RUN {
# Generate random samples from a multivariate distribution.
sample_data = MASS::mvrnorm(n=10, rep(10,5), Sigma = diag(5))

# Randomly selecting the mean(s) from the data.
means_mv_impr(sample_data, num_means=2)

# }

Run the code above in your browser using DataLab