Clustering Example
Torky24 opened this issue · 1 comments
I was hoping if there could be some example for "biosppy.clustering" and how it ties in for example with accelration data. I noticed that it lacked documentation on the website and I was hoping for some clarification if possible.
Thank you!
Hi @Torky24, thank you for the feedback!
The biosppy.clustering
module provides a library of functions, each using a different clustering algorithm. If you go through the documentation (see the docstrings) of these functions, you'll notice the input argument data
, which is "An m by n array of m data samples in an n-dimensional space". This means you need to feed your clustering algorithm of choice with a 2D numpy array, where biosppy.clustering.kmeans
, will force the algorithm to group data in 3 clusters instead of 2).
Regarding the combination of clustering + acceleration (ACC) features, both the time and frequency domain features apply to any given signal segment. In order to use these features as input (
- Define the duration of your samples (what are you trying to classify?).
- Which features are relevant for the contexts you're classifying? You have functions inside
biosppy.signals.acc
that extract time- and frequency-domain features. - Feed samples of ACC signal segments defined in 1. into the feature extractor you chose in 2.
- From the time- and frequency-domain features extracted for each ACC sample, you can extract more "condensed" information, namely 1-D features (e.g. compute skewness from the FFT or variance from Signal Magnitude; there are a lot of degrees of freedom).
- Build the data numpy array and feed it into the clustering algorithm. The
$M$ rows will correspond to your$M$ samples of ACC signals and your$N$ columns will be your$N$ 1D features.
Please let me know if you're looking for a specific use case or specific ACC features.