## 4 Results
### Cost Analysis  
To analyze the cost of an SVM, it is necessary to evaluate various factors related to performance, time, and computational resources necessary to train and use the model. This section describes the process in detail. This analysis evaluates the computational cost, real-time feasibility, and resources required for the posture classification algorithm based on sEMG and SVM signals. The described system is meant to operate in real-time with strict time constraints, using a multiple SVM approach (one vs. one) and optimizing the hyperparameters using Bayesian optimization. First, let us consider the features of the system:  
* Inputs: eight channels of sEMG signals, 200 Hz, 50 ms window (50 points per channel). * Classes: nine postures. * Multi-class model: 36 binary classifiers (one vs. one). * Features: eight features per channel. * Tasks:
* Feature extraction: 50 data per channel. * Classification: SVM algorithm, RBF kernel optimized through 10-fold cross-validation and Bayesian optimization. The feature extraction task involves calculations in the time and frequency domain for each channel. There are 64 features per window (8 sEMG channels \(\times\) 8 features). For the six time-domain features, the calculation is linear with the number of samples, O(\(n\)). For the two frequency-domain features, the calculation requires a fast Fourier transform (FFT), with complexity O(\(n\cdot\log n\)). So, for a window of 50 samples,  
* Time-domain features: 8 channels \(\times\) 6 features \(\times\) O(50) = 2400 operations. * Frequency-domain features: 8 channels \(\times\) 2 features \(\times\) O(50\(\cdot\log\) 50) \(\approx\) 2700 operations. * Combined cost: Approximately O(5000) operations per window of 50 samples. In the classification step, each of the 36 classifiers processes an input vector of 64 features (8 \(\times\) 8 vector). * At training, the complexity is O(\(n^{3}\)), where n is the number of training vectors. This does not apply in real-time but is relevant during development. * In the inference step, complexity is O(\(m\cdot d\)), where \(m\) is the number of support vectors (estimated at 50), and \(d\) is the dimensionality of the vector (\(d\) = 64). This way, the cost per SVM is estimated as O(50\(\cdot\)64) = O(3200). * Finally, there is the majority voting of the 36 binary classificators to determine the final class, which gives a total cost for a classification of 36\(\cdot\)3200 = 115,200. These tasks must be completed in less than 50 ms. The Bayesian Optimization is an offline process. Each iteration evaluates a set of hyperparameters using 10-fold cross-validation. The SVM training complexity with RBF is O(\(n^{3}\)), where n is the size of the data set. With 30 iterations, the total cost includes 300 model evaluations, which is computationally intensive during development, but it does not have an influence on the real-time operation. Regarding the use of memory, each sample of the sEMG signal occupies four bytes (32-bit floating point). Then, for the 8 sEMG signals, the amount of memory required is 8 channels \(\times\) 50 samples \(\times\) 4 bytes = 1.6 kB per window. For the extracted features, the requirements are 64 features \(\times\) 4 bytes = 256 bytes per window. Therefore, the total amount of memory necessary per window is approximately 1856 kB, which is a manageable quantity even on resource-constrained hardware. Additionally, each SVM stores the support vectors (\(m=50\)): 50 vectors \(\times\) 64 features \(\times\) 4 bytes = 12.8 kB per SVM. For 36 SVMs, this means a memory use of 460.8 kB. These numbers sustain the feasibility of a real-time implementation. The estimated time for signal acquisition is 250 ms and for the feature extraction is about 20 ms (estimated with hardware optimization). The estimated time for the inference is about 30 ms for 36 SVMs. All this leads to a 50 ms limit for real-time, which involves 300 ms including signal acquisition.