Quality control using convolutional neural networks applied to samples
  of very small size
Although there is extensive literature on the application of artificial
neural networks (NNs) in quality control (QC), to monitor the conformity of a
process to quality specifications, at least five QC measurements are required,
increasing the related cost. To explore the application of neural networks to
samples of QC measurements of very small size, four one-dimensional (1-D)
convolutional neural networks (CNNs) were designed, trained, and tested with
datasets of $ n $-tuples of simulated standardized normally distributed QC
measurements, for $ 1 \leq n \leq 4$. The designed neural networks were
compared to statistical QC functions with equal probabilities for false
rejection, applied to samples of the same size. When the $ n $-tuples included
at least two QC measurements distributed as $ \mathcal{N}(\mu, \sigma^2) $,
where $ 0.2 < |\mu| \leq 6.0 $, and $ 1.0 < \sigma \leq 7.0 $, the designed
neural networks outperformed the respective statistical QC functions.
Therefore, 1-D CNNs applied to samples of 2-4 quality control measurements can
be used to increase the probability of detection of the nonconformity of a
process to the quality specifications, with lower cost.
Rallou A. Chatzimichail, Aristides T. Hatjimihail
Quality Control Using Convolutional Neural Networks Applied to Samples of Very Small Size

## 1 Abstract

Although there is extensive literature on the application of artificial neural networks (NNs) in quality control (QC), to monitor the conformity of a process to quality specifications, at least five QC measurements are required, increasing the related cost. To explore the application of neural networks to samples of QC measurements of very small size, four one-dimensional (1-D) convolutional neural networks (CNNs) were designed, trained, and tested with datasets of \(n\)-tuples of simulated standardized normally distributed QC measurements, for \(1\leq n\leq 4\).

The designed neural networks were compared to statistical QC functions with equal probabilities for false rejection, applied to samples of the same size. When the \(n\)-tuples included at least two QC measurements distributed as \(\mathcal{N}(\mu,\sigma^{2})\), where \(0.2<|\mu|\leq 6.0\), and \(1.0<\sigma\leq 7.0\), the designed neural networks outperformed the respective statistical QC functions. Therefore, 1-D CNNs applied to samples of 2-4 quality control measurements can be used to increase the probability of detection of the nonconformity of a process to the quality specifications, with lower cost.

## 2 Introduction

### QC

Alternative quality control procedures can be applied to a process to test the null hypothesis, that the process conforms to the quality specifications and consequently is in control, against the alternative, that the process is out of control. When a true null hypothesis is rejected, a statistical type I error is committed. We have then a false rejection of a run of the process. The probability of a type I error is called probability for false rejection. When a false null hypothesis is accepted, a statistical type II error is committed. We fail then to detect a significant change of the probability density function of a quality characteristic of the process. The probability for rejection of a false null hypothesis equals the probability of detection of the nonconformity of the process to the quality specifications. A QC procedure can be formulated as a Boolean expression of QC functions, applied to a sample of QC measurements. If it is true, then the null hypothesis is considered as false, the process as out of control, and the run is rejected (A. T. Hattimihail 1992).

A statistical QC procedure is evaluated as a Boolean proposition of one or more statistical QC functions. Each QC function is a decision rule, evaluated by calculating a statistic of the measured quality characteristic of a sample of QC measurements. Then, if the statistic is out of the interval between the decision limits, the decision rule is considered as true. If it is true, then the null hypothesis is considered as false, the process as out of control, and the run is rejected. Control charts are plots of the statistics, in
time order.

### NNs

NNs are adaptive computational algorithms, for statistical data modeling and classification of arbitrary precision, inspired by the brain structure and information processing. They are equivalent to nonlinear mathematical functions \(\mathbf{W}=\mathrm{F}(\mathbf{Q})\), where \(\mathbf{W}\) and \(\mathbf{Q}\) are vectors, matrices, or tensors of finite dimensions.

NNs consist of interconnected input, processing, and output nodes. Information flows from input to output, through weighed directed interconnections (see Figure 1). During forward propagation, each processing node receives as input the sum of the weighed outputs of other nodes plus a bias. Its output is calculated by an activation function and is propagated to other nodes. During back propagation, the weights and biases of each node are adapted to minimize an output dependent loss function. In training, forward and back propagation are applied repeatedly, using appropriate datasets.

Since 1943 (McCulloch and Pitts 1943), there have been designed many NNs architectures, growing in complexity (Leijnen and van Veen 2020), evolving into multilayer deep neural networks (DNNs).

Common types of NNs are:

1. Feedforward NNs, directed acyclic networks with fully connected input, hidden and output layers.
2. Convolutional NNs (CNNs), directed acyclic networks with connected input, hidden and output layers.
3. Recurrent NNs, directed networks, with connected input, hidden and output layers, including cyclic subnetworks.

Figure 1: An NNs with an input layer of four nodes, two hidden layers of eight and six nodes, and an output layer of two nodes.
NNs are bioinspired computational algorithms, as they are the genetic algorithms (GA). Since 1989, NNs have been proposed as alternative to statistical quality control procedures (Zorriassatine and Tannock 1998) while GA have been used for the design of QC since 1993 (A. T. Hatjimihail 1993). The first application of NNs to QC was published by Pugh (Pugh 1989), who applied NNs to samples of 5 QC measurements, with performance comparable to that of simple statistical quality control rules. Hwang and Hubele (Hwang and Hubele 1993) applied NNs to samples of 8 QC measurements for control charts pattern recognition among 8 unnatural control chart patterns. Other early applications of NNs to QC were published by Smith (Smith 1994), Stutzle (Stutzle 1995), Cheng (Cheng 1995) and Chang and Aw (Chang and Aw 1996). The application of NNs to statistical process control was reviewed comprehensively by Psarakis (Psarakis 2011). Hachicha and Ghorbel (Hachicha and Ghorbel 2012) reviewed extensively their application to control charts pattern recognition.

The input of the NNs applied to statistical process control was either _n_-tuples of QC measurements or derived statistics. To the best of our knowledge there have not been any publication in quality control about NNs applied to _n_-tuples of QC measurements for _n_\(<\) 5.

QC costs are substantial (Howanitz, Tetrault, and Steindel 1997). As the cost of QC sampling increases with the size of the sample, especially when it involves expensive QC materials or it is destructive, we explored the application of NNs to samples of QC measurements of very small size.

For that purpose, four 1-D CNNs were designed and applied to _n_-tuples of QC measurements, for \(1\leq n\leq 4\), as described in detail in the _Methods_ section. CNNs are compact DNNs with low computational complexity, easier to implement in relatively low-cost systems, as they include convolutional and pooling layers. Through small kernels, each neuron of a convolutional layer receives input from only a restricted area of the previous layer, called the neuron's _receptive field_. Moreover, pooling layers combine the outputs of neuron clusters at one layer into a single neuron in the next layer, reducing further the dimensions of data. Since CNNs merge both feature extraction and classification tasks into a single structure, they have been used extensively for feature extraction in image processing (Khan et al. 2020). One-dimensional (1-D) CNNs have been used in signal processing and classification, as in anomaly detection in quality control (Kiranyaz et al. 2021).

3. Methods

3.1. Simulated QC Sample Tuples

It is assumed that \(u\) are standardized normally distributed measurements of control samples when the measurement process is in control and \(v\) when it is out of control. Then:

\[U\neg N(0,1)\] \[V\sim\mathcal{N}(\mu,\sigma^{2})\]

where:

\[|\mu|>0\;\forall\;\sigma>1\]

Series of QC measurements _n_-tuples (QCMT) were simulated, with up to \(k\) measurements out of control, in all possible combinations, where:

\[1\leq n\leq 4\]
\(1\leq k\leq n\)

The combinations of the elements of the QCMT are presented in Table 1.

### Simulated datasets

Training and testing datasets were created with simulated QC measurements, normally distributed and standardized.

#### 3.2.1 Training Datasets

For \(a\in\{1,2,3,4,6,8,12,16\}\), and \(1\leq n\leq 4\), each training dataset \(\mathbf{T}_{a}(n)\) consists of:

1. \(a\)\(2^{n-1}10^{5}\)\(n\)-tuples of random simulated QC measurements distributed as \(\mathcal{N}(0,1)\),
2. \(2^{n-1}10^{5}\)\(n\)-tuples of random simulated QC measurements, \(k\) distributed as \(\mathcal{N}(0,\sigma^{2})\) and \(n-k\)_as_\(\mathcal{N}(0,1)\), for \(1\leq k\leq n\) and \(1<\sigma\leq 11\).
3. \(2^{n-1}10^{5}\)\(n\)-tuples of random simulated QC measurements, \(k\) distributed as \(\mathcal{N}(\mu,1)\) and \(n-k\)_as_\(\mathcal{N}(0,1)\), for \(1\leq k\leq n\) and \(0<|\mu|\leq 10\).

#### 3.2.2 Testing Datasets

The following testing datasets were created:

1. \(\mathbf{D}(n,0,1)\), for \(1\leq n\leq 4\), with \(10^{8}\)\(n\)-tuples of random simulated QC measurements distributed as \(\mathcal{N}(0,1)\).
2. \(\mathbf{D}(n,k,0,\sigma)\) for \(\sigma=1.1,1.2,...,7.0\), and \(1\leq n\leq 4\) and \(1\leq k\leq n\), with \(\binom{n}{k}10^{5}\)\(n\)-tuples of random simulated QC measurements, \(k\) distributed as \(\mathcal{N}(0,\sigma^{2})\) and \(n-k\)_as_\(\mathcal{N}(0,1)\).
3. \(\mathbf{D}(n,k,\mu,1)\) for \(|\mu|=0.1,0.2,...,6.0\), and \(1\leq n\leq 4\) and \(1\leq k\leq n\), with \(\binom{n}{k}10^{5}\)\(n\)-tuples of random simulated QC measurements, \(k\) distributed as \(\mathcal{N}(\mu,1)\) and \(n-k\)_as_\(\mathcal{N}(0,1)\)

Tables 2 and 3 present the elements of the simulated training and testing datasets, with the respective numbers of the QCMT.
\begin{table}
\begin{tabular}{|c|c|c|c|c|} \hline  & & \(n\) & \(U\) & \(V\) \\ \hline \multirow{3}{*}{\(\text{T}_{a}(1)\)} & \(\{[u_{1}],\textit{False}\}_{i=1}^{n}\) & \(a\ 10^{5}\) & \(\mathcal{N}(0,1)\) & \\ \cline{2-4}  & \(\{[v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \hline \multirow{3}{*}{\(\text{T}_{a}(2)\)} & \(\{[u_{1},u_{2}],\textit{False}\}_{i=1}^{n}\) & \(3a\ 10^{5}\) & \(\mathcal{N}(0,1)\) & \\ \cline{2-4}  & \(\{[u_{1},v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \cline{2-4}  & \(\{[v_{1},u_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[v_{1},u_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \cline{2-4}  & \(\{[v_{1},v_{2}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \hline \multirow{3}{*}{\(\text{T}_{a}(3)\)} & \(\{[u_{1},u_{2},u_{3}],\textit{False}\}_{i=1}^{n}\) & \(7a\ 10^{5}\) & \(\mathcal{N}(0,1)\) & \\ \cline{2-4}  & \(\{[u_{1},u_{2},v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[u_{1},v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \cline{2-4}  & \(\{[u_{1},v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[v_{1},u_{2}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \cline{2-4}  & \(\{[u_{1},u_{2}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[u_{1},u_{2}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \cline{2-4}  & \(\{[u_{1},v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[u_{1},v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \cline{2-4}  & \(\{[u_{1},v_{2}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[v_{1},v_{2},u_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[v_{1},v_{2},u_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[v_{1},v_{2},u_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \hline \multirow{3}{*}{\(\text{T}_{a}(3)\)} & \(\{[v_{1},u_{2},u_{3}],\textit{False}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[u_{1},u_{2},u_{3},v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[u_{1},u_{2},v_{1}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \cline{2-4}  & \(\{[u_{1},u_{2},v_{1},u_{3}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[u_{1},v_{1},u_{2},u_{3}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \hline \multirow{3}{*}{\(\text{T}_{a}(4)\)} & \(\{[u_{1},v_{1},v_{2},u_{2}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(0,\sigma^{2}),1<\sigma\leq 11\) \\ \cline{2-4}  & \(\{[u_{1},v_{1},v_{2},u_{2}],\textit{True}\}_{i=1}^{n}\) & \(10^{5}\) & \(\mathcal{N}(0,1)\) & \(\mathcal{N}(\mu,1),0<|\mu|\leq 10\) \\ \cline{2-4}  & \(\{[u_{1},v_{1},u_{2},v_{2}],\textit{True}\}
### 3.3.QC functions

As QC function we define a Boolean valued function applied to a n-tuple \(\mathbf{x}\) of QC measurements of a run of a process. If it is _true_, the process is considered out of control, and the run is rejected.

#### 3.3.1. Neural Network QC functions

As \(N_{\alpha}(\mathbf{x})\) is denoted a neural network QC function. For this project, there were designed four 1-D CNNs with 69 layers, \(486-11634\) nodes and 1x1 kernels. Figure 2 presents their template. In Table 4 there is a summary presentation of their layers and nodes.

\begin{table}
\begin{tabular}{|l|l|l|l|l|l|l|l|} \hline CNNs & \multicolumn{2}{|c|}{\(N_{\alpha}(x_{1})\)} & \multicolumn{2}{|c|}{\(N_{\alpha}(x_{1},x_{2},x_{3})\)} & \multicolumn{2}{|c|}{\(N_{\alpha}(x_{1},x_{2},x_{3})\)} & \multicolumn{2}{|c|}{\(N_{\alpha}(x_{1},x_{2},x_{3},x_{4})\)} \\ \hline  & Layers & Nodes & Layers & Nodes & Nodes & Layers & Nodes \\ \hline Input & 1 & 1 & 1 & 2 & 1 & 3 & 1 & 4 \\ \hline Hidden & 67 & 483 & 67 & 2102 & 67 & 5577 & 67 & 11628 \\ \hline Output & 1 & 2 & 1 & 2 & 1 & 2 & 1 & 2 \\ \hline \end{tabular}
\end{table}
Table 4. CNNs Layers and nodes

\begin{table}
\begin{tabular}{|l|l|l|l|l|} \hline  & & \(n\) & \(U\) & \(V\) \\ \hline \(\mathbf{D}(1,0,1)\) & \(\{[u_{1},False]_{in}^{n}\}\) & \(8\cdot 10^{5}\) & \(N(0,1)\) & \\ \hline \(\mathbf{D}(1,1,\mu,\sigma)\) & \(\{[v_{1},True]_{in}^{n}\}\) & \(10^{5}\) & \(N(\mu,\sigma^{2}),|\mu|>0\) V \(\sigma>1\) \\ \hline \(\mathbf{D}(2,0,1)\) & \(\{[u_{1},u_{2},False]_{in}^{n}\}\) & \(8\cdot 10^{5}\) & \(N(0,1)\) & \\ \hline \(\mathbf{D}(2,1,\mu,\sigma)\) & \(\{[u_{1},v_{1},True]_{in}^{n}\}\) & \(10^{5}\) & \(N(0,1)\) & \\ \hline  & \(\{[v_{1},u_{1},True]_{in}^{n}\}\) & \(10^{5}\) & \(N(0,1)\) & \(N(\mu,\sigma^{2}),|\mu|>0\) V \(\sigma>1\) \\ \hline \(\mathbf{D}(2,2,\mu,\sigma)\) & \(\{[v_{1},v_{2}]_{in}^{n}\}\) & \(10^{5}\) & \(N(\mu,\sigma^{2}),|\mu|>0\) V \(\sigma>1\) \\ \hline \(\mathbf{D}(3,0,1)\) & \(\{[u_{1},u_{2},u_{3}]_{False}\}\) & \(8\cdot 10^{5}\) & \(N(0,1)\) & \\ \hline  & \(\{[u_{1},u_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},v_{1},v_{2}]_{True}\}\) & \(10^{5}\) & \\ \hline \(\mathbf{D}(3,2,\mu,\sigma)\) & \(\{[v_{1},u_{1},v_{2}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},u_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},u_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline \(\mathbf{D}(3,3,\mu,\sigma)\) & \(\{[v_{1},v_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{2},u_{3},u_{4}]_{False}\}\) & \(8\cdot 10^{5}\) & \(N(0,1)\) & \\ \hline  & \(\{[u_{1},u_{2},u_{3},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline \(\mathbf{D}(4,1,\mu,\sigma)\) & \(\{[u_{1},u_{2},v_{1},u_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{2},u_{3},u_{4}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{2},v_{1},v_{2}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{2},v_{1},v_{2}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},v_{1},v_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline \(\mathbf{D}(4,2,\mu,\sigma)\) & \(\{[u_{1},v_{1},v_{2},u_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{1},v_{1},v_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},v_{1},v_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},v_{1},v_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[u_{1},u_{1},v_{2},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{1}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v_{1},v_{2},v_{1},v_{3}]_{True}\}\) & \(10^{5}\) & \\ \hline  & \(\{[v
Figure 2: The template of the CNN \(N_{a}(x)\)
For \(a\in\{1,2,3,4,6,8,12,16\}\), \(n=\#\mathbf{x}\) (that is \(n\) equal to the cardinality of \(\mathbf{x}\)), and \(1\leq n\leq 4\), each 1-D CNN \(N_{\alpha}(\mathbf{x})\) consists of:

1. The input layer, with \(n\) nodes.
2. Ten parallel arrays of five convolutional layers each. Every convolutional layer has \(n\) output channels, and kernels of size 1x1.
3. A catenating layer, which catenates the ten parallel arrays.
4. A pooling layer, performing 1-D pooling with kernels of size 2x1.
5. Ten convolutional net layers having \(n\) output channels, and kernels of size 1x1.
6. A pooling net layer, performing 1-D pooling with kernels of size 2x1.
7. Four linear net layers with output vectors of decreasing size.
8. A _softmax_ net layer, _normalizing the exponential of the output vector of the fourth linear layer.
9. The output layer, which is a decoder with two nodes, classifying the input as _true_ (out of control) or _false_ (out of control).

For \(a\in\{1,2,3,4,6,8,12,16\}\), each CNN \(N_{\alpha}(\mathbf{x})\) was trained using the respective training set \(\mathbf{T}_{\alpha}(n)\), and then tested on the datasets \(\mathbf{D}(n,0,1)\) and \(\mathbf{D}(n,k,\mu,\sigma)\), for each combination of \(k\) and \(n\), for \(1\leq n\leq 4\) and \(1\leq k\leq n\). The misclassification rate of the application of \(N_{\alpha}(\mathbf{x})\) to the dataset \(\mathbf{D}(n,0,1)\) equals its probability for false rejection, denoted as \(B_{N,a}(n,\mu,\sigma)\). The correct classification rate of the application of \(N_{\alpha}(\mathbf{x})\) to the dataset \(\mathbf{D}(n,k,\mu,\sigma)\), for \(|\mu|>0\) and \(\sigma>1\), equals its probability for rejection, denoted as \(B_{N,a}(n,k,\mu,\sigma)\) (see _Notation and Formalism_).

The thirty two trained CNNs are available at [https://www.hcsl.com/Supplements/hcsltr21s1.zip](https://www.hcsl.com/Supplements/hcsltr21s1.zip), in Apache MXNet, ONNX, and Wolfram Language frameworks formats, as described in _Supplement 1_.

#### 3.3.2 Statistical QC Functions

Let \(m\) the expected mean and \(s\) the standard deviation of the QC measurements \(x_{i}\) of a measurement process when the process is in control. As \(S_{a}(\mathbf{x};l,m,s)\) is denoted a statistical QC function, applied to a n tuple \(\mathbf{x}\) of QC measurements \(x_{i}\), which is true if \(|x_{i}-m|>l\), for any of them. Furthermore, let:

\[S_{\alpha}(\mathbf{x};\;l)=S_{a}(\mathbf{x};l,0,1)\]

For \(a\in\{1,2,3,4,6,8,12,16\}\), the probability for rejection of the application of \(S_{\mathrm{a}}(\mathbf{x};l)\) to the dataset \(D(n,0,1)\) is denoted as \(P_{S,a}(n,0,1)\). The decision limit \(l\) of \(S_{\mathrm{a}}(\mathbf{x};l)\) is defined (see _Formalism and Notation_) so that:

\[P_{S,a}(n,0,1)\;=\;P_{N,a}(n,0,1)\]

For \(a\in\{1,2,3,4,6,8,12,16\}\), \(1\leq n\leq 4\) and \(1\leq k\leq n\), the probability for rejection of the application of \(S_{\mathrm{a}}(\mathbf{x};l)\) to the dataset \(D(n,k,\mu,\sigma)\) is denoted as \(P_{S,a}(n,k,\mu,\sigma)\).

The calculated values of \(I\) are presented in Table 5.
### Computer System and Software

The datasets were created and the CNNs were designed, trained, and tested using Wolfram Mathematica Ver. 13.0, Wolfram Research, Inc., Champaign, IL, USA, on a computer system with an Intel Core i9-11900K CPU, 128 GB RAM, a NVIDIA GeForce RTX 3080 Ti GPU, under Microsoft Windows 11 Professional operating system.

## 4 Results

The plots of the probabilities for rejection \(R_{N,a}(n,k,\mu,\sigma)\) and \(B_{s,a}(n,k,\mu,\sigma)\) of the application of the QC functions to the respective datasets, their differences \(\Delta\mathcal{P}_{a}(n,k,\mu,\sigma)\), and their relative differences \(\Delta\mathcal{P}_{R,a}(n,k,\mu,\sigma)\) are presented in _Appendix_. The probabilities for rejection \(R_{N,a}(n,k,\mu,\sigma)\) and \(B_{s,a}(n,k,\mu,\sigma)\), their differences \(\Delta\mathcal{P}_{a}(n,k,\mu,\sigma)\) with the respective statistical significance (\(p\)-values), and their relative differences \(\Delta\mathcal{P}_{R,a}(n,k,\mu,\sigma)\) are presented in detail in _Supplement 2_.

As examples, Figure 2 presents the probabilities for rejection \(R_{N,a}(2,2,\mu,\sigma)\) of the application of the CNN functions to the respective datasets, while Figure 3 presents the probabilities for rejection \(R_{N,6}(3,3,\mu,\sigma)\) and \(B_{s,6}(3,3,\mu,\sigma)\) of the application of the QC functions to the respective datasets.

\begin{table}
\begin{tabular}{|c|c|c|c|c|} \hline CNN & \(n\) & \(\alpha\) & \(R_{N,a}(n,0,1)\) & \(I\) \\ \hline \multirow{8}{*}{\(N_{a}(x_{1})\)} & \multirow{8}{*}{\(1\)} & \(1\) & \(0.127240\) & \(1.525077\) \\ \cline{3-5}  & & & \(2\) & \(0.034726\) & \(2.111536\) \\ \cline{3-5}  & & & \(3\) & \(0.027421\) & \(2.205468\) \\ \cline{3-5}  & & & \(4\) & \(0.023750\) & \(2.261149\) \\ \cline{3-5}  & & & \(6\) & \(0.012258\) & \(2.504643\) \\ \cline{3-5}  & & & \(8\) & \(0.008197\) & \(2.643835\) \\ \cline{3-5}  & & & \(12\) & \(0.005178\) & \(2.795778\) \\ \cline{3-5}  & & & \(16\) & \(0.004186\) & \(2.863775\) \\ \hline \multirow{8}{*}{\(N_{a}(x_{1},x_{2})\)} & \multirow{8}{*}{\(2\)} & \(1\) & \(0.114545\) & \(1.888090\) \\ \cline{3-5}  & & & \(2\) & \(0.046078\) & \(2.268308\) \\ \cline{3-5}  & & & \(3\) & \(0.031890\) & \(2.407227\) \\ \cline{3-5}  & & & \(4\) & \(0.008733\) & \(2.849716\) \\ \cline{3-5}  & & & \(6\) & \(0.016204\) & \(2.646416\) \\ \cline{3-5}  & & & \(8\) & \(0.009049\) & \(2.838333\) \\ \cline{3-5}  & & & \(12\) & \(0.003311\) & \(3.145682\) \\ \cline{3-5}  & & & \(16\) & \(0.002574\) & \(3.218706\) \\ \hline \multirow{8}{*}{\(N_{a}(x_{1},x_{2},\ x_{3})\)} & \multirow{8}{*}{\(3\)} & \(1\) & \(0.120814\) & \(2.033406\) \\ \cline{3-5}  & & & \(2\) & \(0.041528\) & \(2.456272\) \\ \cline{3-5}  & & & \(3\) & \(0.024233\) & \(2.646056\) \\ \cline{3-5}  & & & \(4\) & \(0.007836\) & \(3.009274\) \\ \cline{3-5}  & & & \(6\) & \(0.009234\) & \(2.958895\) \\ \cline{3-5}  & & & \(8\) & \(0.005146\) & \(3.135029\) \\ \cline{3-5}  & & & \(12\) & \(0.005211\) & \(3.131339\) \\ \cline{3-5}  & & & \(16\) & \(0.002915\) & \(3.298332\) \\ \hline \multirow{8}{*}{\(N_{a}(x_{1},x_{2},\ x_{3},x_{4})\)} & \multirow{8}{*}{\(4\)} & \(1\) & \(0.101483\) & \(2.220312\) \\ \cline{3-5}  & & & \(2\) & \(0.040159\) & \(2.56916\) \\ \cline{3-5}  & & & \(3\) & \(0.029011\) & \(2.681327\) \\ \cline{3-5}  & & & \(4\) & \(0.004909\) & \(3.231921\) \\ \cline{1-1} \cline{3-5}  & & & \(6\) & \(0.010381\) & \(3.010814\) \\ \cline{1-1} \cline{3-5}  & & & \(8\) & \(0.005599\) & \(3.194108\) \\ \cline{1-1} \cline{3-5}  & & & \(12\) & \(0.003848\) & \(3.301041\) \\ \hline \end{tabular}
\end{table}
Table 5: The probabilities for false rejection \(R_{N,a}(n,0,1)\) and the calculated values of the decision limits \(I\)
Figure 2: The probabilities for rejection of the CNN \(N_{a}(x_{1},x_{2})\), for \(a\in\{1,2,3,4,6,8,12,16\}\), when applied to two QC measurements, distributed as \(\mathcal{N}(0,\sigma^{2})\) (upper plot) or as \(\mathcal{N}(\mu,1)\) (lower plot)
Figure 3: The probabilities for rejection of the CNN \(N_{6}(x_{1},x_{2},x_{3})\) when applied to three QC measurements, distributed as \(\mathcal{N}(0,\sigma^{2})\) (upper plot) or as \(\mathcal{N}(\mu,1)\) (lower plot)

Likewise, Figures 4 and 5 present the differences \(\Delta\mathbb{P}_{8}(n,k,\mu,\sigma)\) and the relative differences \(\Delta\mathbb{P}_{R,8}(n,k,\mu,\sigma)\) of the probabilities for rejection \(R_{N,8}(n,k,\mu,\sigma)\) and \(R_{S,8}(n,k,\mu,\sigma)\) of the application of the QC functions to the respective datasets.
Figure 4: The differences between the probabilities for rejection of \(N_{8}(\mathbf{x})\) and the respective statistical QC functions vs \(\sigma\)

Figure 5: The relative differences between the probabilities for rejection of \(N_{8}(\mathbf{x})\) and the respective statistical QC functions vs \(\mu\)
The results show that for \(a\in\{1,2,3,4,6,8,12,16\}\), and \(1<n\leq 4\), \(1<k\leq n\), \(0.2<|\mu|\leq 6.0\), and \(1.0\leq\sigma\leq 7.0\) (see _Supplement 2_ and Figures 1-80 and 147-178 _of Appendix_):

\[\Delta P_{a}(n,k,\mu,\sigma)\,>0\]

For \(a\in\{1,2,3,4,6,8,12,16\}\), \(1<n\leq 4\), \(1<k\leq n\), \(0.2<|\mu|\leq 6.0\), and \(1.2<\sigma\leq 7.0\), the differences are statistically significant (\(p<0.01\)), except for some differences where \(\Delta P_{a}(n,k,\mu,\sigma)<0.002\) (see _Supplement 2_).

For \(a\in\{1,2,3,4,6,8,12,16\}\), and \(1<n\leq 4\), most of the differences \(\Delta P_{a}(n,1,\mu,\sigma)\) are negative, with \(-0.03<\Delta P_{a}(n,1,\mu,\sigma)<0\) (see _Supplement 2_).

For \(a\in\{1,2,3,4,6,8,12,16\}\), and \(1<n\leq 4\), and \(1<k\leq n\) and \(|\mu|<0.2\) there are some negative differences \(\Delta P_{a}(n,k,\mu,\sigma)\), however \(|\Delta P_{a}(n,k,\mu,\sigma)|<0.0008\) (see Table 6).

Furthermore (see _Supplement 2_):

1. For \(a\in\{1,2,3,4,6,8,12,16\},1<n\leq 4\), \(15\leq k\leq n,0\leq|\mu_{h}|<|\mu_{j}|\leq 6.0\) and \(1.0\leq\sigma\leq 7.0\) (see Figures 1-146 of _Appendix_): \[P_{N,a}\big{(}n,k,\mu_{h},\sigma\big{)}<P_{N,a}\big{(}n,k,\mu_{j},\sigma\big{)}\]
* For \(a\in\{1,2,3,4,6,8,12,16\},1<n\leq 4,\ 15\leq k\leq n,0\leq|\mu|\leq 6.0,\ 1.0\leq \sigma_{h}<\sigma_{j}\leq 7.0\) (see Figures 1-146 of _Appendix_): \[P_{N,a}(n,k,\mu,\sigma_{h})<P_{N,a}\big{(}n,k,\mu,\sigma_{j}\big{)}\]
* For \(a\in\{1,2,3,4,6,8,12,16\},1<n\leq 4,\ 1\leq k_{h}<k_{j}\leq n,0\leq|\mu|\leq 6.0,\) and \(1.0\leq\sigma\leq 7.0\) (see Figures 81-104 of _Appendix_): \[P_{N,a}(n,k_{h},\mu,\sigma)<P_{N,a}\big{(}n,k_{j},\mu,\sigma\big{)}\]
* For \(a_{h}\in\{1,2,3,4,6,8,12\},\ a_{h}\in\{2,3,4,6,8,12,16\},\ a_{h}<a_{j},\ 1\leq n \leq 4,\ 15\leq k\leq n,\ 0<|\mu|\leq 6.0,\) and \(1.0<\sigma\leq 7.0\) (see Figures 105-114 of _Appendix_): \[P_{N,\ a_{h}}(n,k,\mu,\sigma)>P_{N,\ a_{j}}(n,k,\mu,\sigma)\]
* For \(a\in\{1,2,3,4,6,8,12,16\},1\leq n_{h}<\eta_{j}\leq 4,\ 0<|\mu|\leq 6.0,\) and \(1.0<\sigma\leq 7.0\) (see Figures 115-122 of _Appendix_): \[P_{N,a}(n_{h},n_{h},\mu,\sigma)<P_{N,a}\big{(}n_{j},n_{j},\mu,\sigma\big{)}\]
* For \(a\in\{1,2,3,4,6,8,12,16\},1\leq n_{h}<\eta_{j}\leq 4,\ 15\leq k\leq n_{h},\ 0<|\mu|\leq 6.0,\) and \(1.0<\sigma\leq 7.0\) (see Figures 123-146 of _Appendix_): \[P_{N,a}\big{(}\eta_{j},k,\mu,\sigma\big{)}<P_{N,a}(n_{h},k,\mu,\sigma\big{)}\]

## 5 Illustrative example

The performance of the designed CNNs was compared to the performance of the respective statistical functions with equal probabilities for false rejection, for the detection of the critical systematic error of a clinical chemistry assay.

Briefly, the coefficient of variation and the bias of the uricase and peroxidase method uric acid assay of the AU5800 (Beckman, Coulter, Brea, Ca) analyser, were estimated as equal to 1.44% and 1.46% respectively (Xia et al. 2018). The optimal total allowable analytical error for the uric acid, based on the biological variation is equal to 5.98% (Fraser et al. 1997). Therefore, the standardized critical random and systematic errors of the assay, as defined by Linnet (Linnet 1989), are equal to 3.33 and 2.67 respectively

Tables 7 and 8 show the probabilities for critical error detection of the QC functions \(N_{a}(x)\) and the respective statistical QC functions \(S_{a}(x;I)\), their differences and relative differences, as well as their probabilities for false rejection, for \(2{\leq}n{\leq}4\), \(2{\leq}k{\leq}n\), and \(a\in\{1,2,3,4,6,8,12,16\}\). All the differences are positive and statistically significant (\(p<10^{-6}\)).

The selection of the NN QC function to be applied depends upon the risk of critical error, and the cost of the control measurements and the false rejections.. Although the costs can be calculated, the risk can only be approximated. Hence, an applicable QC function, with a relatively high probability for critical random error detection (\(>0.75\)), a high probability for critical systematic error detection (\(>0.9\)), and a low probability for false rejection (\(<0.01\)), could be the \(N_{6}(x_{1},x_{2},x_{3})\) (see Figure 4), as:
\begin{table}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline \(n\) & \(k\) & \(a\) & \(R_{k,a}(n,0,1)\) & \(I\) & \(R_{k,a}(n,k,\mu_{c},1)\) & \(R_{k,a}(n,k,\mu_{c},1)\) & \(\Delta P_{a}(n,k,\mu_{c},1)\) & \(\Delta R_{k,a}(n,k,\mu_{c},1)\) \\ \hline

[MISSING_PAGE_POST]
\begin{table}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hline \(n\) & \(k\) & \(a\) & \(B_{\Lambda,\alpha}(n,0,1)\) & \(I\) & \(B_{\Lambda,\alpha}(n,k,0,\sigma_{c})\) & \(B_{\Lambda,\alpha}(n,k,0,\sigma_{c})\) & \(\Delta B_{n}(n,k,0,\sigma_{c})\) & \(\Delta B_{\Lambda,\alpha}(n,k,0,\sigma_{c})\) \\ \hline

[MISSING_PAGE_POST]
1. \(P_{N,6}\)(3,0,1) = \(P_{S,6}\)(3,0,1) = 0.009234
2. \(P_{N,6}\)(3,3,0,3.3) = 0.780677
3. \(P_{S,6}\)(3,3,0,3.3) = 0.754969
4. \(\Delta P_{6}\)(3,3,0,3.3) = 0.025708
5. \(\Delta P_{R,6}\)(3,3,0,3.3) = 0.034052
6. \(P_{N,6}\)(3,3,2.67,1) = 0.922430
7. \(P_{S,6}\)(3,3,2.67,1) = 0.768898
8. \(\Delta P_{6}\)(3,3,2.67,1) = 0.153532
9. \(\Delta P_{R,6}\)(3,3,2.67,1) = 0.199677

Therefore, the NN QC function \(N_{6}\)(\(x_{1},x_{2},x_{3}\)) outperforms significantly the statistical \(S\)(\(x_{1},x_{2},x_{3}\); 2.958895), although they have equal probabilities for false rejection.

## 5 Discussion

The complexity of statistical QC has increased significantly since the 1920s, when it was introduced into industry by Shewhart (Shewhart, 1930), especially after the development of low cost digital computers on integrated circuits with substantial processing power. Since 1989, the wide availability of more processing power led to the development of NNs and later of DNNs, including CNNs, and their application to statistical QC. Deep learning transforms low level representations to a higher order abstract one, extracting features from raw data in multiple stages. CNNs are relatively simple and compact DNNs, with exemplary learning ability and performance (Khan et al., 2020). Particularly, 1-D CNNs simple enough to be implemented in low cost computer systems have been successfully used to process 1-D signals (Kiranyaz et al., 2021; Kiranyaz, Ince, and Gabbouj, 2016), including control charts (Xu et al., 2019).

Although the relationship among a QC procedure, the reliability of a system, the risk of nonconformity to quality specifications and the QC related cost is complex (Aristides T. Hatjmihail, 2009), it is obvious that cost increases with the number of the QC measurements required for the safe detection of nonconformity. The application of statistical QC functions to very small samples of QC measurements has been extensively studied (Duncan, 1986) (Montgomery, 2019). However, NNs QC functions have only been applied to _n_-tuples of QC measurements with \(n>5\). Consequently, it is meaningful to explore their application to _n_-tuples of QC measurements for \(1\leq n\leq 4\).

For this project, there were designed 4 1-D CNNs with 1x1 kernels, applicable to 1 to 4 QC measurements respectively. As the directly cost related probability for false rejection is a key index of the performance of a QC function, each of the 4 1-D CNNs was trained with eight training datasets, with different ratios of _n_-tuples of random simulated QC measurements distributed as \(\mathcal{N}\)(0,1) (see Tables 1-4). As a result, thirty two trained 1-D CNNs were obtained, which were applied to testing datasets containing all the possible combinations of measurements. The range of their probabilities for false rejection was from 0.002574 to 0.127400 (see Table 5). Another approach for
obtaining varying probabilities for false rejection could be weighing the output of the CNN, with differing penalization of the probability for false rejection.

The comparison of the trained 1-D CNNs with the respective statistical QC functions with decision limits shown on Table 5, shows that the designed CNNs outperform the respective statistical QC functions, for \(2\leq n\leq 4\) and \(2\leq k\leq n\), that is when the samples they are applied to include at least two QC measurements out of control, distributed either as \(\mathcal{N}(\mu,1),\text{for}\ 0.2<|\mu|\leq 6.0\), or as \(\mathcal{N}(0,\sigma^{2}),\text{for}\ 1.0<\sigma\leq 7.0\). However, statistical QC functions outperform the 1-D CNNs, for \(1\leq n\leq 4\) and \(k=\)1, that is when the samples they are applied to include only one control measurement distributed as either as \(\mathcal{N}(\mu,1),\text{for}\ 0<|\mu|\leq 6.0\), or as \(\mathcal{N}(0,\sigma^{2}),\text{for}\ 1.0<\sigma\leq 7.0,\ \text{but then}\ |\mathcal{A} \underline{P}_{\alpha}(n,1,\mu,\sigma)|<0.028\) (see Figures 1-85 and 147-178 of _Appendix_ and _Supplement 2_).

Besides, the probability for rejection of the 1-D CNNs increases with the sample size, when all the QC measurements of the sample are out of control (see Figures 115-122 of _Appendix_ and _Supplement 2_), while decreases with the sample size when the numbers of the out of control measurements of each sample are equal (see Figures 123-146 of _Appendix_ and _Supplement 2_).

Limitations of this project, that could be improved by further research, are the following:

* The assumption of normality of either the measurements or their applicable transforms (Gillard 2012; Atkinson, Riani, and Corbellini 2021; Sakia 1992; Box and Cox 1964), however, this is usually valid. Furthermore, the four designed CNNs can be trained and tested using datasets of any parametric or nonparametric distribution.
* The arbitrary selection of the different ratios of \(n\)-tuples of random simulated QC measurements distributed as \(\mathcal{N}(0,1)\) of the simulated datasets, for obtaining varying probabilities for false rejection. Another approach could be weighing the output of the CNNs with differing penalization of the probability for false rejection.
* The arbitrary design of the four CNNs. As the processing power of the computer systems is increasing exponentially, efficient methods of optimal design of NNs will be developed, including evolutionary algorithms (Ding et al. 2013).

The thirty two trained CNNs can be used as they are or they can be retrained with different datasets. Their models, including their weights and biases, are available in various formats, to be implemented in any neural networks' framework (see _Supplement 1_).

## 6 Conclusion

One-dimensional CNNs applied to samples of 2-4 QC measurements can improve the detection of nonconformity of a process to quality specifications, with lower cost.
