View source: R/classify_kmeans.R
classify_kmeans | R Documentation |
Muscle synergy classification with k-means
classify_kmeans(x, MSE_lim = 0.001, inspect = FALSE, show_plot = FALSE)
x |
A list of |
MSE_lim |
Mean squared error threshold for determining the minimum number of clusters |
inspect |
Logical, ask for interactive re-ordering or go fully automated? |
show_plot |
Logical, to decide whether plots should be plotted in the active graphic device |
This function must be applied to a list with a sufficient amount of trials, otherwise the
classification will not work. Typically, at least 10 trials for the same condition are needed
for satisfactory classification. If show_plot
is TRUE (default) plots are also shown in the
active graphic device.
Plots can then be saved with the preferred export method, such as ggplot2::ggsave
.
The algorithm used is the default for stats::kmeans (Hartigan and Wong, 1979), which is known
for its robustness to local minima. Nonetheless, the stochastic nature of the algorithm
should prompt the user to attempt a few classifications and analyse their stability,
before drawing conclusions on e.g. the number of fundamental synergies and/or their function.
While the default parameters are optimised for human locomotion, it is suggested to test the
function with different mean squared error thresholds, which is a crucial quantity to
determine the number of clusters. Inspection and plotting are as well highly recommended
to gain more insight into the classification process.
List of musclesyneRgies
objects, each with elements:
syns
factorisation rank or minimum number of synergies
M
motor modules (time-invariant coefficients)
P
motor primitives (time-dependent coefficients)
V
original data
Vr
reconstructed data
iterations
number of iterations to convergence
R2
quality of reconstruction (coefficient of determination)
rank_type
was the rank fixed
or variable
?
classification
classification type (k-means
)
# Load some data data(SYNS) # Classify synergies SYNS_classified <- classify_kmeans(SYNS)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.