## 6 Sensor Data Acquisition and Collection
### Sensor Data Collection by HMM
This hardness rating corresponds to a homogeneous linearly elastic material model with a [PERSON]'s modulus (\(E\)) of 0.9649 MPa and [PERSON]'s ratio (\(v\)) of 0.49, which is subsequently used in defining the material model in FEA [68]. The physical tests are supported with a printed wearable QTSSTM sensor strip inside the socket. The results of dynamic testing by the Stewart platform show that the proposed control strategy is capable of achieving the required magnitude and wave form of the dynamic load cycle. However, a phase shift of the measured data can also be observed, mainly due to the computation delay. This restricts the current dynamic testing to relatively slow gait cycles. The implementation of data analysis functions is done with the _hmmlearn_[69] and _scikit-learn_[70] package in Python. The identification and calibration of the sensor function have been done by applying some standard periodic load cycles with known pressure conditions, recording the measurement outputs of such experiments, and thereby training an AE (Autoencoder) as the sensor function for the nonlinear transformations, see Figure 8. Within the AE, both the encoder and decoder have three layers respectively. The topological structures of these two parts are also made mirror-symmetrical with 50-150-200 neurons in size. During the training process, we also added some white noise in order to improve the robustness of this sensor function. To get a smooth regression curve of sensor modeling, we use Leaky ReLu (Leaky Rectified Linear Unit) as activation functions for the encoder and decoder. We used the MSE (Mean-Square Error) as the loss function. The training of HMM for Bayesian Inference of intra-socket load conditions in different operational scenarios is based on specific data sets of measured socket operational data. The training procedure follows the description of Algorithm 2, with the comfort operation data and seven discrete latent states. Figure 9a shows the corresponding operational data, with different color points for highlighting the results from temporal clustering according to the criterion of temporal cluster cohesion defined by Equation (8). Figure 9b shows the inferred Gaussian characteristics of execution progress by comfort data (as defined with Equation (7)) in temporal clusters. Through the variable \(\alpha\), it is possible for the confidence interval that constitutes a basis for anomaly detection as defined by Equation (9). Figure 8: Results of the sensor function (\(Pressure\mapsto Voltage\)) trained with AE (Autoencoder) and MLP (Multilayer Perceptron). For the sensor function trained with AE, the MSE (Mean-Square Error) figures of pressure decreasing and increasing phase are around 0.024 and 0.017, respectively. These could be compared with the MSE figures of the sensor function trained with MLP for the same data, which are 0.035 and 0.021 respectively. While the overall performances of these two methods are quite similar to each other, the results of AE are smoother, such as readings between 4 and 9 KPa of the pressure increasing phase. (**a**) Pressure decreasing phase. (**b**) Pressure increasing phase. With trained HMM models characterizing socket operations, the anomaly detection aims to reveal the operational anomalies in terms of undesired intra-socket load conditions (e.g., too high pressure level) or operational failures of a sensor itself (e.g., broken electrical wire) according to the probabilistic divergence of operation data. Due to the support of temporal clustering, possible temporal drifts on timeline (e.g., load with the right pressure level but not at the right phase in a gait cycle) can also be detected with the same measure. Such an anomaly detection capability is normally not possible with conventional classification methods such as Support Vector Machine (SVM). Figure 10 shows the results of the HMM-based inference of execution progress.