Muscle synergy classification with k-means
classify_kmeans(x, MSE_lim = 0.001, inspect = FALSE, show_plot = FALSE)
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
)
A list of musclesyneRgies
objects
Mean squared error threshold for determining the minimum number of clusters
Logical, ask for interactive re-ordering or go fully automated?
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.
# Load some data
data(SYNS)
# Classify synergies
SYNS_classified <- classify_kmeans(SYNS)
Run the code above in your browser using DataLab