So I've read this article for a project im working on:

Ortiz-Cataln: Cardinality as a highly descriptive feature in myoelectric pattern recognition for decoding motor volition, Chalmers Uni, published in "Frontiers in Neuroscience", 2015

They use cardinality in pattern recognition and claim that it is "highly descriptive".

I can't understand how they have used it or why it would be of any use, if my understanding of cardinality as simply a measure of the size of dataset is correct. Can anyone explain to me what they mean and how they have used cardinality?

  • 1
    $\begingroup$ woah, mathematically, their notation is terrible. A set doesn't have duplicate values – it's a set, not a list, so p.2, $B=\{1,1,2,3,3\}\equiv\{1,2,3\}=A$, anyway, no need to introduce $\#B$. $\endgroup$ – Marcus Müller Nov 5 '16 at 10:19

There's a lot of red flags in that paper that shouldn't have passed review. In fact, I'm a bit surprised – Mr. Ortiz-Catalan is a well-published researcher in a research group called "signals and systems" at a very prestigious university, and yet there's sentences like:

Altering the dimension of the unit used for sampling (ADC resolution) to a high precision unit (for example, a double) would alienate the discrimination power of cardinality.

There's no ADC that give double precision floating point values. (Aside from "double precision" being a relative term, only defined within one programming language or CPU architecture). At any rate, the "D" in ADC stands for "digital", and that means "discrete in time and value, so

This is because every sample value would be unique, so cardinality will always be equal to the number of samples in the time window (maximum value of cardinality).

is class-A hogwash, because sampling leads to discrete samples, and thus, the maximum number of unique values you can get is the cardinality of the alphabet of your ADC.

The same applies to:

A simple operation like dividing the EMG sampled values by the gain of the amplifiers, in an attempt to use the original EMG amplitude in further computations, could increase the unit precision automatically by the processing software; that is, from the original acquisition values (for example, 14 bits) to a double, in the case of MATLAB (Massachusetts, United States).

For a fixed gain, you get as many unique values out of that division as you put in – division by a constant is a function (school math), for the same input value it should give the same output value; the data type doesn't matter here (it might, in a corner case, mean that the number of output values is smaller than the number of input values. Never more. And generally: Information can't be generated during signal processing – they cite Information Theory as basis for their research, so they must know the Data Processing Theorem, and gaining values would be equivalent to generating information).

I have to credit the author for the "I cite a software tool as coming from Massachusetts" joke – I liked that, it was cute :)

Having cleared up that ADCs only give discrete values, let's move forward.

Every ADC I encountered in EMG applications so far is used with a proper anti-aliasing filter up front. Needing to do that is mathematical/physical fact – if you don't band-limit the analog signal before sampling it, you get artifacts, namely aliasing in your signal, and also, especially for "peaky" signals such as EMG tends to be, instead of noticing every peak, you'd, in the best case, just get a non-1 probability of observation.

So here we go, feeding in band-limited signals into an ADC with a finite set of values.

Now, I mainly work in communication technology, so I'm much more familiar with the mathematical tools meant for analysis of harmonic signals, but we can still work with this pretty well:

Nyquist's sampling theorem says that, if the original signal is sufficiently band-limited, we can reconstruct the original signal from a periodical observation of instantaneous values. That periodicality is the sampling rate, and in the real-valued case, that needs to be just a bit higher than twice the highest frequency in the signal (i.e. the signal's bandwidth).

Nyquist doesn't require any synchronization between the signal and the sampling.

Thus, let's do the following thought experiment:

  1. Sample a signal with bandwidth $B$, at times $t_i = i T_s$, $T_s < \frac1{2B}$.
  2. Following Nyquist, we now have a complete representation of the signal
  3. We find that if we configured our sampling system optimally, the extreme values of the sampled signals are at least close to the extreme values that the ADC can produce – otherwise, we'd be wasting dynamic range and could very well better represent the signal by amplifying it a bit before, reducing the quantization errors. This should have tipped us of that cardinality is extremely sensitive to the physical voltage amplitude – and thus a very hard-to-control meausure, considering that depends on a multitude of factors like electrode placement, contact quality, temperature of the system...
  4. Now, the information how many different values where taken by the signal is identical to how many were NOT taken – since we know how many values our ADC can produce.
  5. The observational windows were 200ms @ 2000Hz sampling rate, i.e. 400 samples. Hence, there were exactly 400 different cardinalities that could be realized here: 1 unique value (constant) or up to 400 different values. We can, with a high degree of certainty, say that certain cardinalities are more likely than others – for example, the constant signal is very unlikely to happen, and 400 different values isn't much more likely, either, since the signal is discrete and supposed to be correlated.
  6. The paper finds that decreasing the sampling rate to $\frac12$ of the orignal 2 kHz only reduces the quality by 0.2 % – that is surprising, as half of the signal goes missing! We must pick one of three hypotheses:
    • A) the signal digitized was sufficiently bandlimited in the first place for the lower sampling rate, and in that case oversampling was done, which should reduce the meaningfulness of value set cardinality (as oversampled signals will just take more intermediate signals, thus shifting the density functions for that measure closer together higher up in of the range of possible cardinalities). The interesting part is here that additive noise will effectively lead to dithering – ie. an increase of cardinality, regardless of the original signal.
    • B) the signal was undersampled when it was sampled with 1 kHz, by a factor of $u = \frac{2B}{f_\text{sample}}$.
    • C) Most of the energy in the signal was in the lower half (or, in fact, the lower fourth, as 500 Hz sampling rate still seems to work nearly as good – which at some point should make one wonder what we're really looking at), but not quite all – and thus, the fast changes that (almost) always lead to unique values are rare and correlate highly with the classification.
      1. Intuitively, C) works quite nicely: anything that changed by more than 1 quantization step between two successive samples at the 1 kHz rate will almost always have one intermediate value (excluding strong noise for now) sampled at 2 kHz. But: Knowing typical EMG spectra, there's less enery at higher frequencies (i.e. "faster jumps"), and thus, it's very unlikely that strong peaks and intermediate values from these will be duplicate within an observation window (especially if that is only 400 samples long).
      2. Thus, the counting of unique values is but an aliasing detector – or, if you want so, a detector for energy in the upper half of the spectrum. A high-pass filter!

I personally have my problem with papers that offer $p$-values but don't even mention how they calculated those. Maybe you could nicely ask to get their algorithms/software. This should be no problem – the paper boldly boasts "open access" insignia, and that ideologically implies that they're proud to share not only their results but also their methodology. I do believe that the paper is on to something – it seems to have demonstrated a classifier that outperforms others. However, these others might have been badly parameterized, and might not perform that much worse, especially on properly preprocessed data.


This is partly an answer to the question and partly a reply to Marcus (good answer, by the way!)

I know this is a rather late response, but after seeing this and a related reddit thread, I thought I sould clear up a couple points that are ambiguous in the article. I am currently studying under Dr. Ortiz, and it looks like there are some assumptions made in the article that were not explicitly stated. This is not intended as a defense of the article (and I hope it does not come across as such), but merely an explanation of ambiguities.

The ADC we're using for most of our research (TI ADS1299) does indeed give out integer values for the conversion, and the numbers are converted to voltages on-board the microcontroller (TI Tiva C-Series) to single-precision floating point numbers.

A sufficiently high precision on the ADC (and appropriately high precision decimal notation on the microcontroller) would indeed give the same cardinality for all the time windows (i.e. the length of the window in samples), but since the precision is limited, the cardinality is significantly reduced.

The unit precision referred to in the article refers to the precision of the unit itself, not necessarily the precision of our representation of the original EMG signal. It also affects the processing time and the overall precision of any further calculations. The original statement in the article does admittedly seem a little out of place, though.

Citing the location of origin of the software tools used is pretty common at this school, and I believe it has to do with clearing up any ambiguity with possibly overlapping company names/trademarks due to discrepencies in the appropriate regulatory standards in each country (especially when you leave the U.S. and E.U.).

The lion's share of the EMG signal energy is between 125-250Hz, but relevant signal information can be found spread over roughly 10-1000Hz. Because of this, most of our research is centered around sampling at 2kHz to get the entire range (and ideally the best results), but a lot of the real-time stuff and stuff that happens on the microcontroller is typically set to 500Hz or 1kHz sampling frequency to decrease processing time.

The cardinality in the signal is related not just to the signal frequency, but also to the signal energy. Each EMG channel will receive different signals from different muscles, and it's the point of the pattern recognition algorithms to detect the synergies between the signal channels. This point is important, because it allows us some information into both the frequency and energy content of the signal without having to perform any transforms. Below is an example of EMG signal mean absolute value and signal cardinality for visual reference. While this particular feature might not be practical to implement on a microcontroller (used for prosthetic devices), it can be useful in applications where processing is done on a full-fledged PC anyways.

Mean absolute value compared to signal cardinality

As for the statistical significance listed, I'm not sure how it was calculated (Dr. Ortiz is out of the office this week), but I'll bring the point up with him when he comes back.

For the curious, the hardware (that we made) and the software in question are all open-source hosted on github: https://github.com/biopatrec/biopatrec

There are a bunch of sample recordings in the repo as well, so you can play around with signals and parameters to your heart's content to get a feel for each of the features and classifiers that are supported. We are also always looking for contributors.

We will take these points into consideration for future articles. Thanks for your interest!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.