## 2 Materials and Methods
### Parallel Algorithms
#### 2.4.3 classification_parallel Algorithm (Parallel Classification)  
The classification_parallel algorithm (Algorithm 11) is a basic algorithm for classifying error types in a signal using parallel computing and the Optuna library for parameter optimization. It is designed to classify a y signal by comparing it with a set of different error types listed in the errors array. The classification is performed by finding the error type that provides the minimum MSE after optimizing the parameters for each error type. Parallelization is used to speed up the classification process by performing optimization for different error types simultaneously. ```
1:Input:\(y\)--one-dimensional array of signal points with error,
2:errors--list of error type names (default: [\"haar\", \"haar1\",...]),
3:leng--basic signal length (default: 1000),
4:epsilon--small threshold to check proximity to 0 (default: 0.01),
5:n--fraction of zero (modulo) points for rejection (default: 0.98),
6:iters--number of iterations for optimization (default: 100). 7:Output: List: [name of the best error type, MSE]
8:if\((\text{length}(y)\leq leng\times 0.05)\) OR (\(\sum_{i}(1\text{ if }|y_{i}|<\epsilon\text{ else }0)>\text{length}(y)\times n\)) then
9:return [\"Bad signal\", \"Nan\"]
10:endif
11:y \(\leftarrow\)pad_array\((y,leng)\)\(\triangleright\) Add the signal to the base length (See Algorithm 6). 12:best_losses \(\leftarrow\)Parallel(n_jobs \(=-1)(\text{delayed}(\text{optimize\_params})(y,error,iters)\) for each error in errors)\(\triangleright\) Parallel optimization for each error type
13:best_loss_idx \(\leftarrow\)argmin(best_losses)\(\triangleright\) Find the minimum MSE index
14:best_error \(\leftarrow\)errors[best_loss_idx]\(\triangleright\) Name of best error type
15:best_loss \(\leftarrow\)best_losses[best_loss_idx]\(\triangleright\) Best MSE value
16:result \(\leftarrow\) [best_error,best_loss]returnresult
```  
**Algorithm 11** classification_parallel (parallel classification)  
Main Steps of the Algorithm  
Input data: The algorithm takes as input a one-dimensional array y of signal points with errors, a list of strings errors containing the names of error types to classify (by default [\"haar\", \"haar1\", \"exp', \"-exp', 'Invexp', 'Invexp+', 'algb']), the base signal length leng (the default is 1000), a small threshold \(\epsilon\) to check proximity to zero (the default is 0.01),the fraction of zero (modulo) points \(n\) for signal rejection (the default is 0.98), and the number of iterations iters for Optuna optimization (the default is 100). Preliminary check of the signal for \"bad\" quality: The algorithm performs an initial quality check on the input signal \(y\) to rule out cases where the signal is too short or contains an excessive number of points close to zero. These checks are similar to those in the mse_classification algorithm (Algorithm 8). If the signal is recognized as \"bad\", the algorithm does not perform classification and returns the list [\"Bad signal\", \"Nan\"]. Addition of signal to base length: If the signal passes the pre-check, it is augmented with zeros to the base length leng using the function pad_array (Algorithm 6). This is performed to standardize the length of the input signals before classification. Parallel MSE optimization for each error type: For each error type in the errors list, the algorithm runs parallel optimization of the parameters (size and shift) using the optimize_params function (Algorithm 10). Parallel execution is provided by using the Parallel function from the joblib library with the parameter n_jobs = \(-1\), which specifies the use of all available CPU cores. The delayed function from joblib is used to \"delay\" the call to optimize_params for each error type, allowing Parallel to distribute the computation among the cores. The result of the parallel execution is a list of best_losses, where each element represents the best MSE value found for the corresponding error type.