Inspection by exception: A new machine learning-based approach for multistage manufacturing

Manufacturing processes usually consist of multiple different stages, each of which is influenced by a multitude of factors. Therefore, variations in product quality at a certain stage are contributed to by the errors generated at the current, as well as preceding, stages. The high cost of each production stage in the manufacture of high-quality products has stimulated a drive towards decreasing the volume of non-added value processes such as inspection. This paper presents a new method for what the authors have referred to as ‘inspection by exception’ – the principle of actively detecting and then inspecting only the parts that cannot be categorized as healthy or unhealthy with a high degree of certainty. The key idea is that by inspecting only those parts that are in the corridor of uncertainty, the volume of inspections are considerably reduced. This possibility is explored using multistage manufacturing data and both unsupervised and supervised learning algorithms. A case study is presented whereby material conditions and time domain features for force, vibration and tempering temperature are used as input data. Fuzzy C-Means (FCM) clustering is implemented to achieve inspection by exception in an unsupervised manner based on the normalized Euclidean distances between the principal components and cluster centres. Also, deviation vectors for product health are obtained using a comparator system to train neural networks for supervised learning-based inspection by exception. It is shown that the volume of inspections can be reduced by as much as 82% and 93% using the unsupervised and supervised learning approaches, respectively. © 2020TheAuthor(s).PublishedbyElsevierB.V.ThisisanopenaccessarticleundertheCCBYlicense (http://creativecommons.org/licenses/by/4.0/).


Introduction
Metal manufacturing processes usually involve a series of processing stages to achieve the desired geometry and properties of parts. There are various manufacturing methods including casting, forming and machining [1]. Each manufacturing method has its own advantages and disadvantages and the selection of the appropriate technology depends largely on the specific application. Forming and casting processes are mostly followed by machining operations to obtain the final geometry and surface finish of parts. Also, in many manufacturing applications, heat treatment techniques such as quenching, tempering and annealing are employed to modify the physical and mechanical properties of the workpiece. Thus, due to the multistage nature of a typical manufacturing process for metallic parts, the part quality deviations from the nominal geometry at a certain processing stage are contributed by multiple error sources introduced by the current, as well as previous, processing stages [2]. * Corresponding author. In traditional manufacturing, machining operations are usually followed by dimensional inspection to evaluate part tolerances. There is a variety of dimensional inspection methods including dedicated gauging, On-Machine Probing (OMP) and Coordinate Measuring Machine (CMM) measurement. Dedicated gauging can enable fast feedback to the production loop but it requires an operator to perform the measurements usually with multiple different gauges in order to evaluate all the specified part tolerances and thus, leading to additional high costs for calibrating each hard gauge. OMP refers to the use of Computer Numerically Controlled (CNC) machine tool as a CMM by using a machine tool probe. OMP possesses the advantage of in-situ inspection and thus, allowing machining and inspection with a single workholding setup as well as immediate re-work of the part when required. However, OMP suffers from significant measurement uncertainties due to the large range of complex influence factors and fails to detect machine tool error-induced deviations [3]. Therefore, supplementing with independent measurements, such as CMM measurement, is usually required. CMMs are accurate measurement systems but most require thermally controlled environments to guarantee their measuring capability. In addition, https://doi.org/10.1016/j.asoc.2020.106787 1568-4946/© 2020 The Author(s). Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/). the heavyweight structure of these machines gives rise to hysteresis error and results in conservative scanning speeds being selected in order to reduce the dynamic effects [4]. To deal with the machine's dynamic and thermal errors, software technology for error compensation has been proposed and applied to CMMs but software error compensation solutions increase the already high cost of these measurement systems. This research work employs a shop floor Coordinate Measuring System (CMS) based on the parallel kinematic configuration. Parallel Kinematic Machines (PKMs) possess many advantages over Cartesian ones such as better dynamic performance and speed capability but they have a limited operational workspace and nonlinear behaviour across it.
In recent years, manufacturers have faced many challenges to remain competitive with respect to costs, quality, delivery, flexibility, adaptability and sustainability. The trend towards autonomous and intelligent manufacturing systems, relies upon efficient data analytics tools such as those that enable process and product health monitoring and control. The fourth industrial revolution, known as Industry 4.0, concerns the digital transformation of manufacturing processes by integrating manufacturing equipment and systems with data analytics to enable production machines to take decisions based on available data and machine learning algorithms. In particular, modern manufacturing processes are supported by numerous data sources from models and monitored processes. However, the efficient use of these datasets requires statistical techniques such as Principal Component Analysis (PCA) to extract the useful information. PCA is a matrix factorization technique used to reduce the dimensionality of a dataset and reveal hidden informative underlying variables. Over the years, many monitoring systems for machining have been proposed to detect early abnormal process behaviour and reduce product quality variations. Two of the most studied areas of machining process monitoring are the cutting-tool and part condition monitoring based on sensor signals such as force and vibration [5]. Continuous tool monitoring is of high importance especially for difficult-to-machine materials where significant variation in tool life is observed. Most proposed methods are based on supervised learning algorithms though unsupervised learning has also been applied [6]. In particular, machine learning algorithms are largely classified into supervised and unsupervised, based on the mechanism by which the learning process is achieved. Unsupervised learning is a class of machine learning techniques that learn from unlabelled data; only input samples are available. Unsupervised learning techniques can be used in various applications such as dimensionality reduction, clustering and anomaly detection. Supervised learning requires labelled data (input-output samples) for training an algorithm. With the continuously growing amount of data collected from all the production process stages at which each product goes through, there exists a gap in the literature for intelligent product condition monitoring considering the dimensional accuracy of the product and the multistage manufacturing scenario. In addition, while many intelligent condition monitoring systems have been developed for manufacturing processes, most are based on supervised machine learning algorithms. Supervised monitoring systems for fault detection suffer from higher training costs since labelled training data (e.g. post-process inspection results) are required. The present work focuses on reducing the volume of dimensional inspections using multistage manufacturing data and machine learning techniques including both unsupervised and supervised; PCA, Fuzzy C-Means (FCM), and Artificial Neural Networks (ANNs). Section 2 presents a detailed review of literature relating to monitoring and control methods for manufacturing processes. Section 3 describes the proposed method for inspection by exception. Section 4 presents the basic theory for the algorithms employed in the present work. Section 5 presents the experimental work. Section 6 implements and validates the proposed method for inspection by exception based on both unsupervised and supervised learning. Section 7 presents the concluding remarks.

Related literature
Manufacturing enterprises are currently confronted with many challenges as a consequence of growing demands for higher quality of finished products, shorter manufacturing times, greater product complexity and variety, and reduced manufacturing costs, energy consumption and material waste in production. To meet these needs, the refinement of existing monitoring and control systems is becoming increasingly important for intelligent, autonomous manufacturing processes. Manufacturing includes a variety of processes and systems. In CNC machining processes, errors can be broadly classified into two main categories: static or quasi-static and dynamic [2]. Quasi-static errors refer to the static or slow-varying errors and include geometric and kinematic errors, thermal errors, cutting force induced errors, fixturing errors, starting material and tooling inaccuracies, etc. Dynamic errors are much larger and more dependent on the particular process conditions than static errors and are typically caused by sources such as controller error and machine structure vibration. A production process for metallic parts or products usually involves multiple stations or operations such as forming and heat treatment, subtractive machining, in-process and post-process inspection, assembly, and testing. Therefore, in a Multistage Manufacturing Process (MMP), workpiece geometric deviations at a certain production stage are caused by the variation sources introduced by the current stage, as well as the variation propagated from preceding stages [7]. In this paper, we focus on MMPs consisting of heat treatment operations, metal-removing operations, including milling and drilling, conducted on CNC machine tools, and post post-process inspection using automated comparator gauges calibrated through CMM measurements on a master part. Manufacturing operations can be divided into two types: value adding operations and non-value adding operations. For example, machining operations are value adding because they add value to the workpiece by changing its shape, dimensions and surface finish, while inspection operations such as OMP are non-value adding, though they can provide significant advantages to the manufacturing industry in terms of productivity and scrap levels.
With the increasing complexity of manufacturing processes employed to change the geometry and certain properties of a workpiece, conventional CNC approaches may not be able to achieve the desired results in terms of dimension, form and geometry. Dimensional product variation management and reduction for MMPs have been studied extensively and several modelling techniques have been proposed over the years, particularly linearized Stream of Variation (SoV) modelling methods based on differential motion vectors, equivalent fixture error, and kinematic analysis [8]. SoV is a model-based method that utilizes mathematical models such as state-space models to describe the dimensional variation and propagation in multistage assembly processes and multistage machining processes. The derivation of such models is based upon physical knowledge and/or process monitoring data [9]. Loose et al. [10] developed a state-space variation propagation model to describe the product dimensional variation propagation among multiple machining operations with different setups. Their modelling approach can handle general fixture layouts, but they limited the scope of the model only to setup errors. Bazdar et al. [11] focused on diagnosing faults within multistage machining processes using state-space variation propagation modelling and discriminant analysis of setup errors. Du et al. [12] presented a generic framework for variation propagation modelling for multistage turning processes of rotary workpieces based on differential motion vectors. Wang et al. [13] described a generic variation propagation framework incorporating the elastic deformation variations into state-space modelling for multistage machining processes and Variable Stiffness Structure (VSS) workpieces as most existing SoV methodologies assume that the workpiece is a rigid body. The validation results obtained from a case study concerned with a four-cylinder engine block indicated that the prediction errors are significantly lower than those obtained from conventional SoV modelling methodologies. Although a large amount of research works have showed the reliability of SoV modelling methods for multistage machining processes to predict the dimensional product quality, the applicability of this approach is limited due to the challenges and difficulties associated with constructing and utilizing the SoV model for many MMPs.
In recent years, manufacturing systems have reaped considerable benefit from advances in sensor and information technologies. Therefore, advanced process and product health monitoring and control techniques based on machine learning models and sensor signals such as temperature, force and vibration have attracted a lot of interest. The use of product health monitoring systems can allow us to identify issues associated with the product being manufactured before post-process inspection and thus can greatly help reduce the need for screening inspection without sacrificing the quality of the manufactured product. Wang et al. [14] proposed Multilayer Feedforward Neural Networks (MFNNs), based on an autoencoder for dimensionality reduction, to detect defective products from a powder metallurgy process. An ANN is a collection of interconnected neurons that are able to learn incrementally from their experience to solve complex problems such as nonlinear function approximation. Li et al. [15] proposed a deep learning-based classification model to detect defective products using the concept of fog computing in order to deal with large amounts of data. Papananias et al. [16] presented a Bayesian approach to estimate the results of postprocess inspection given in-process inspection data. For turning processes, Salgado et al. [17] proposed an in-process surface roughness prediction system, based on Least Squares Support Vector Machines (LS-SVMs), that uses as inputs feed rate, cutting speed, depth of cut, tool geometry parameters and information extracted from vibrations signals using Singular Spectrum Analysis (SSA). Özel and Karpat [18] used MFNNs to predict both surface roughness and tool flank wear in finish dry hard turning using as inputs material hardness in Rockwell-C scale, cutting speed, feed rate, axial cutting length and the mean values of three force components. For milling processes, Huang [19] presented an intelligent neural-fuzzy in-process surface roughness monitoring system for an end-milling operation using five inputs including spindle speed, feed rate, depth of cut, the average resultant peak force and the absolute average force. Kovac et al. [20] applied fuzzy logic and regression to predict surface roughness in dry face milling using as inputs cutting speed, feed rate, depth of cut and flank wear land width. Han et al. [21] presented a varyingparameter drilling method to improve manufacturing efficiency in successive drilling operations and hole surface quality for multi-hole components. They developed Radial Basis Function (RBF) neural networks to predict surface roughness using spindle speed, feed rate, crater wear, flank wear, outer corner wear, thrust force and torque.
Published research on dimensional product health monitoring is limited and much of it focuses on monitoring only the machining process to identify the end product quality, though manufacturing processes typically involve multiple production stages. In addition, although the subject of manufacturing process monitoring and control is a well-developed field of intelligent manufacturing, the manufacturing industry has adopted few monitoring and control systems to replace decision making of a human with a machine. The robustness issues when operating under different conditions and the high costs of training supervised monitoring systems remain two of the major issues faced when extending academic research solutions to industrial exploitation. There is therefore a need for intelligent monitoring and control systems that are able to function under various process conditions and conditions of uncertainty. This paper presents a new method, referred to as 'inspection by exception'. The proposed method is based on the idea of predicting the end product quality using machine learning and multistage, inprocess monitoring data in order to capture sufficient knowledge about the production process and then inspecting the product only if it cannot be classified as conforming or non-conforming with a high degree of certainty. The proposed methodology is tested on a MMP consisting of different processing stages including heat treatment and machining, and on different dimensional metrology characteristics including diameter, true position, and circularity. This modelling problem can be considered to be representative of many manufacturing processes, particularly small batch manufacturing sectors such as aerospace manufacturing applications due to the nonlinearity, high dimensionality, sparsity and uncertainty of the manufacturing process and workpiece data. In addition, in order to achieve inspection by exception with the minimal cost of implementation, clustering-based inspection by exception is also proposed and validated.

Inspection by exception method
This section describes the proposed method for inspection by exception. The key idea of the method is that inspection is not required for parts that can be categorized as healthy or unhealthy with a high degree of certainty but only for those parts that are in the corridor of uncertainty so that the volume of inspections can be reduced without making a wrong decision, e.g. rejecting a part that conforms to design specifications (Type I error) or accepting a part that does not conform to design specifications (Type II error).
The part quality characteristics considered in this paper are the diameter deviation, true position and circularity of a bore. Table 1 shows the deviations from nominal values for the three quality characteristics of interest obtained from the Equator gauge in scanning mode using the CMM Compare method. The columns of Table 1 are as follows: the first column includes the part label/number; the second column includes the diameter deviation; the third column includes the true position; the fourth column includes the circularity; and the fifth column indicates which parts conform to the specified tolerances. The deviations from (drawing) nominal values have been obtained by calculating the absolute difference between the actual/measured value and the nominal value for each measurand and thus, h j = ⏐ ⏐ y j −ỹ j ⏐ ⏐ , for j = 1, 2, . . . , n, where y j denotes an observation of the measured quantity Y j andỹ j denotes the (drawing) nominal value of the same quantity, Y j . Suppose the tolerances are ±0.0700 mm for diameter, 0.0100 mm for true position (47.5 ± 0.075 in X axis from datum B and 40 ± 0.075 in Y axis from datum A), and 0.0500 mm for circularity. The parts that do not conform to the specified tolerances are the parts labelled as: 1, 10, and 23. The diameter deviations for these three parts are: 0.0771 mm, 0.0705 mm, and 0.0802 mm, respectively. The fourth largest diameter deviation is 0.0623 mm for part 19.
The decision rule of the proposed method is given by: Two implementations are presented in this paper, both using machine learning but other modelling techniques may be applicable and may also be possibly advantageous to implement the method. In particular, a neural network-based approach is developed to predict the product health metric deviation vector,ĥ j = (ĥ j1 ,ĥ j2 , . . . ,ĥ jP ) T , for p = 1, 2, . . . ,P, and assess the requirement for inspection, whereP denotes the number of parts used to test the model. The proposed method allows users freedom to choose their preferred bounds τ j and τ j . However, if the bounds τ j and τ j are not selected appropriately, then the gap between τ j and τ j may be too large, resulting in unnecessary inspections or the gap may be too small, which may result in healthy parts being rejected (Type I error) and unhealthy parts being accepted (Type II error). The gap between the bounds depends on the accuracy of the model and the uncertainty associated with the directly measured product health metric deviation vector, h jp . Also, a clustering-based approach is developed to achieve inspection by exception based on the normalized Euclidean distances between the principal components and cluster centres. This approach is based on the FCM algorithm, which allows each data point to belong to more than one cluster. The unsupervised approach will be presented first in this work.

Principal component analysis
The main purpose of PCA is to extract the useful information from a dataset consisting of a set of correlated variables and to represent this information as a new set of uncorrelated variables [22,23]. These uncorrelated variables are principal components and are the directions in which the data have the largest variances. Suppose that we have observations on N variables . , x N . The first principal component, y 1 , is defined to be the linear combination a 11 x 1 + a 12 x 2 + · · · + a 1N x N = ∑ N j=1 a 1j x j , ∥a 1 ∥ = 1, with maximum variance. The second principal component, y 2 , is a linear combination a 21 x 1 + a 22 x 2 + · · · + a 2N x N = ∑ N j=1 a 2j x j , ∥a 2 ∥ = 1, which is uncorrelated with the first derived variable and has maximum variance. The K th principal component, y K , for K = 1, 2, . . . , N, can be defined as a linear combination a K 1 x 1 + a K 2 x 2 + · · · + a KN x N = ∑ N j=1 a Kj x j , ∥a K ∥ = 1, which is uncorrelated with the first K − 1 derived variables and which has maximum variance. Let Σ be the covariance matrix of the vector of variables x = (x 1 , x 2 , . . . , x N ) T , which we assume to be positive definite. Then, the first principal component can be obtained by finding the weight vector a 1 of N constants that maximizes the variance of a T 1 x, given that ∥a 1 ∥ = 1. The technique of Lagrange multipliers can be used to maximize V (y 1 ) = a T 1 Σa 1 subject to a T 1 a 1 = 1. The second principal component can be obtained by finding the weight vector a 2 of N constants that maximizes the variance of a T 2 x, given that a T 2 a 2 = 1 and a T 2 Σa 1 = 0. Hence, the K th principal component is given by The proportion of the total variability explained by the first K principal components can be calculated as:

Fuzzy C-means clustering
Clustering algorithms find natural groupings in data. Clustering methods utilize distance functions to measure the similarity of data points. The FCM algorithm is a soft clustering method in which each data point can belong to multiple clusters with varying degrees of membership [24]. The distance between data points and cluster centres can be computed by the Euclidean distance: where . . , C , is the centre of the jth cluster. FCM is based on the minimization of the following objective function: subject to the constraints µ ij ∈ [0, 1] and ∀i: ∑ C j=1 µ ij = 1, where µ ij is the degree of membership of x i in the jth cluster and w is the weighting exponent which controls the degree of fuzziness. Note that the cluster centres are calculated by: The FCM algorithm in MATLAB performs the following steps during clustering: i The cluster membership values, µ ij , are randomly initialized.
ii The cluster centres, c j , are calculated by Eq. (5): iii The cluster membership values, µ ij , are updated according to: The objective function, J w , is calculated by Eq. (4).
Steps ii-iv are repeated until J w improves by less than a predefined threshold value between two consecutive iterations or until a predefined number of iterations has been reached.

Artificial neural networks
ANNs are computational models that emulate the learning process of biological neural networks. Over the years, many different types of ANNs have been proposed, one of the most popular being the MFNNs also known as Multi-Layer Perceptron (MLP) networks. Let L be the number of layers of the network. Each layer is denoted by l, l = 0, 1, . . . , L, with l = 0 denoting the input layer, l = L the output layer, and l = 1, . . . , L − 1 the hidden layers. The neurons in any layer l = 1, . . . , L operate as follows: where is the input vector for the pth pattern ] T is the desired output vector for the pth pattern. Letĥ ] T denote the output vector for the pth pattern. The Mean Squared Error (MSE) is given by: where e (p) = . Minimization of J w is attempted by using a particular Back-Propagation (BP) algorithm to adjust the network's weights [25].

Experimental work
Experimental work was performed, involving multiple stages of manufacturing, to produce steel bearing housing parts. The MMP consists of heat treatment, grinding, hardness testing, machining and post-process inspection on the shop floor (see Fig. 1). The drawing and Computer-Aided Design (CAD) model of the part is shown in Fig. 2. The part has several critical features that should be sensitive to manufacturing process conditions and errors. For example, any tool/spindle runout can be indicated in the diameter measurement and variation in material hardness can cause differing levels of deflection. The starting material was EN24T steel. The chemical composition of this material is shown is Table 2. Table 3 shows the mechanical properties of the starting material. The EN24T material, is readily machinable because it is heat treated (hardened and tempered and stressfree annealed) by the supplier. However, the starting material was further hardened and tempered at different temperatures. A VECSTAR furnace was used for heat treatment. In particular, the starting material bar was sawn and machined to a nominal size, 25 off blocks. The twenty-five material blocks were divided into five batches and heated up to 845 • C, separately (five batches of five blocks each), and then quenched in oil for hardening. After the hardening operation, tempering was performed at different temperatures (450 • C, 550 • C and 650 • C) to add variability in the properties of the material such as surface hardness (see Table 4). Five K-type thermocouples with protection sheath were used to measure variation in temperature gradient within the furnace during heat treatment. Following the heat treatment process, the blocks were grinded to improve the quality of material surface and measure the material surface hardness. A Rockwell device was used to measure the surface hardness of the heat treated blocks.
A full factorial design (see Table 5) was performed for machining using a DMG MORI NVX 5080 3-axis machine. The factors included material surface hardness, feed rate, spindle speed and datum error in both X and Y axes when handing over to the second orientation of the workpiece (flipped around the Y axis) for machining the features of its bottom side. All the factors included two levels and one centre point. Each workpiece was machined with coolant. Six cutting tools were employed to manufacture the steel bearing housing parts and changed when reached a certain flank wear width. The wear was evaluated on each flute using a Leica microscope after obtaining each product. A Kistler quartz multicomponent dynamometer (9255B), consisting of four 3-component force sensors, and DynoWare software were used to measure force. The dynamometer was located between the vice holding the workpiece and the machine table. An accelerometer sensor, placed on the spindle, and NI LabVIEW SignalExpress software were used to obtain vibration data. The sampling rate for both force and vibration data was 10 kHz. In total, eighteen parts were machined (seventeen parts for the experimental design and one part to be used as a master part in CMM Compare measurement).
A Renishaw Equator gauge (300 Extended Height) equipped with the SP25 3-axis analogue scanning probe was used for post-process inspection under workshop conditions [26,27]. The Equator was employed in CMM Compare and in scanning measuring mode. The CMM Compare method requires a production part to be labelled as a 'master' part and measured on a calibrated CMM to produce a calibration file for the comparator measurement system [28]. A Mitutoyo CMM located in a temperature controlled room was used to produce the calibration file. The master part had been thermally stabilized before generating the calibration file. The CMM was equipped with a Renishaw REVO RSP3 3D scanning probe. The stylus used for both the Equator and the CMM was a typical 30 mm long stylus with tungsten carbide stem and a 2 mm diameter ruby ball. The same part fixturing setup was also used for both the Equator and the CMM.

Clustering-based inspection by exception method
This section presents an unsupervised learning approach to achieve inspection by exception. The machined parts were clustered into two groups using the FCM clustering algorithm in MAT-LAB. The dataset includes: the Root-Mean-Square (RMS), sample kurtosis, sample skewness, sample variance and mean features of three vibration components (Vx, Vy, Vz); the same five features (RMS, sample kurtosis, sample skewness, sample variance and  sample mean) of average values of three force components (Fx, Fy, Fz) obtained from all the four sensors of the dynamometer; the maximum temperature obtained from the five K-type thermocouples during tempering; and a coded vector corresponding to the material surface hardness. All the extracted features were normalized by the Euclidean norm (2-norm).
One major difficulty in multivariate analysis is the problem of visualizing high-dimensional data. To reduce the number of variables to a few (≪N) variables that represent most of the information in the original variables, PCA was performed in MAT-LAB using a Singular Value Decomposition (SVD) of the input data matrix X = U ΣV T ∈ R M×N , where both U ∈ R M×M and V ∈ R N×N are orthogonal matrices and Σ ∈ R M×N is a diagonal matrix with diagonal elements, σ j , such that σ 1 ≥ σ 2 ≥ · · · ≥ σ min(M,N) ≥ 0. Therefore, mean-centring the columns of the normalized input data matrix X was an essential pre-processing step in the process of dimensionality reduction. A 2-fold cross-validation approach was employed to test the PCA-based clustering approach using Table 4 Heat treatment.

+20%
Programmed 0 data from the whole experimental design (seventeen manufactured parts). In particular, the dataset of seventeen parts was partitioned into two sub-datasets: one sub-dataset was used for training the clustering algorithm and one sub-dataset was used for testing it. The cross-validation process was repeated two times so that both sub-datasets were used as the validation dataset once. Given the first two principal components, the FCM algorithm was employed to partition the data into two clusters. The FCM algorithm initially generates a random membership matrix. In each clustering iteration, the FCM algorithm calculates the cluster centres and updates the membership matrix using the calculated cluster centre locations. The algorithm then computes the objective function value. The clustering process stops when the objective function improvement falls below a predefined threshold value or when the maximum number of iterations has been reached. The amount of fuzzy overlap during clustering was set to 15, the maximum number of iterations was set to 100, and the minimum improvement in objective function between two consecutive iterations was set to 0.00001. The clustering algorithm was trained using the first two principal components of the training dataset. Then, new data/test dataset were assigned to the existing clusters and the normalized Euclidean distances between the first two principal components and cluster centres were computed. The computed distances are used to assess whether or not a product meets its specifications and identify the parts that require inspection for conformance assessment. Figs. 3-6 show the clustering results. Figs. 3 and 5 show the clustering results obtained from training the clustering algorithm for fold 1 and 2, respectively, using the first two principal components. Fold 1 uses sub-dataset 1 for training and sub-dataset 2 for testing. Fold 2 uses sub-dataset 2 for training and sub-dataset 1 for testing. Figs. 4 and 6 show the assignment of the test dataset (the first two principal components obtained from the trained PCA model) to the existing clusters shown in Figs. 3 and 5, respectively. Figs. 7 and 8 show the normalized Euclidean distances between the first two principal components and cluster centres for fold 1 and 2, respectively. Based on the results shown in Figs. 7 and 8, it can be concluded that the PCA-based FCM clustering approach can reduce the volume of inspections from seventeen parts to one part for fold 1 and to three parts for fold 2, since only part 19 for fold 1 and parts 10, 13 and 7 for fold 2 require inspection to determine successfully whether or not they conform to specifications.

Neural network-based inspection by exception method
This section implements a supervised learning approach using PCA-based MLP networks to provide deviation vectors for product health and achieve inspection by exception.

Product health metric vectors
A CMS operating in comparator mode (Equator) was used to obtain m measurements on a quantity Y , regarded as a random variable and called the measurand, e.g. the diameter of a bore.
Let y 1 , y 2 , . . . , y m denote the corresponding measured values obtained from the comparator system in reproducibility conditions. The measurements y 1 , y 2 , . . . , y m involve comparator measurements and thus, random effects are dominant [29]. Given the measurand Y and its attached Probability Density Function (PDF) g (y), with g (y) ≥ 0 for all values of y and ∫ ∞ −∞ g (y) dy = 1, the     expectation E(Y ) and the variance V (Y ) are defined, respectively, as: Note that if Y ∼ N ( µ, σ 2 ) then E (Y ) = µ and V (Y ) = σ 2 , where µ is the expectation or mean and σ is the standard deviation, the positive square root of the variance σ 2 . For n geometric tolerances applied to one or more features, let Y denote the product health matrix: y 12 · · · y 1n y 21 where y ij denotes the element located in the ith row and the jth column of the product health matrix Y. Given that the product is measured m times independently, under repeatability conditions, estimates for µ 1 , µ 2 , . . . , µ n and σ 1 , σ 2 , . . . , σ n can be obtained by the sample means y 1 , y 2 , . . . , y n and the sample standard deviations s 1 , s 2 , . . . , s n , respectively: Note that while the sample variance s 2 is an unbiased estimator of the population variance σ 2 , the sample standard deviation s is a biased estimator of the population standard deviation σ [30].
A measure of linear association between the observations of jth and lth product quality characteristics can be provided by the sample covariance: The sample covariance of the standardized observations can be given by the sample correlation coefficient: Two random variables Y j and Y l are statistically independent if their joint PDF g jl ( y j , y l ) can be factored as g jl g l (y l ). Independent random variables are also uncorrelated but the converse does not necessarily hold [31]. The product correlation matrix given by: can be computed to exploit the correlation between the same characteristics for identical features.

Experimental evaluation of uncertainty associated with equator CMM compare measurement
This section presents an experimental method to evaluate the measurement uncertainty associated with an estimate of a product quality characteristic in order to provide confidence in the comparator measurement results and allow the calculation of conformance and non-conformance probabilities. The measurement uncertainties associated with Equator CMM Compare method were calculated experimentally considering: (i) the standard uncertainty, u(cal), associated with the uncertainty of the calibration of the master part; ii) the standard uncertainty, u(p), associated with the comparative coordinate measurement procedure; and iii) the standard uncertainty, u(b), associated with the systematic error component, b, of the comparative coordinate measurement [32]. The effect of the uncertainty in the Coefficient of Thermal Expansion (CTE) will not be considered in this evaluation procedure. The combined standard uncertainty, u c (y), of any measurand was calculated as follows: The standard uncertainty, u(cal), was estimated by the experimental standard deviation of the mean, s (y cal ) = s/ √ m cal , using the CMM measurements on the master part. The uncertainty components, u(p) and u(b), were calculated by the experimental standard deviation of the mean using the comparative coordinate measurements on the test part and master part, respectively.
The systematic error component, b, was calculated by |y − y cal |, where y denotes the mean value of the Equator measurements on the master part and y cal is the CMM calibrated (mean) value of the same part and measurand. The expanded measurement uncertainties, U, of the master part, used to validate the CMM Compare method, are: 0.54 µm, 0.76 µm and 1.08 µm for diameter, true position and circularity, respectively, for a coverage factor k = 2 and a confidence level of 95.45%. For example, for the test part 24, the expanded measurement uncertainties are similarly: 0.63 µm, 0.91 µm and 2.66 µm, respectively. If a random sample of size m is drawn from a population which forms a normal distribution, then, the appropriate test statistic is t = (y − µ) / ( , which has a student's t-distribution with ν = m − 1 degrees of freedom. The mean of the t-distribution is zero and its variance is ν/(ν −2) for ν > 2. As ν → ∞, the t-distribution approaches a normal distribution with µ = 0 and σ = 1 [30].

Prediction of product health metric deviation vectors
To predict the product health metric deviation vectors, an MLP network with 3 inputs, one hidden layer consisting of five neurons, and one output was developed for each product quality characteristic in MATLAB. For all the models, tan-sigmoid transfer functions were used in the hidden layer and a linear activation function was used for the output neuron. The inputs to the network are the first three principal components of the normalized dataset used for the clustering approach presented in Section 6.1. The output is the product health metric deviation vector for each quality characteristic (diameter, true position and circularity of the bore), obtained by the absolute difference between the (drawing) nominal value and the measured value obtained from the Equator gauge in scanning mode using the CMM Compare method. All the models were trained by Resilient BP, which converges faster than the traditional BP algorithm [33].
A 4-fold cross-validation approach was employed to test the neural network models using data from the manufacture of sixteen parts (block 14 was excluded). In particular, the dataset of sixteen parts was randomly partitioned into four sub-datasets and three sub-datasets were used to train the models and a single sub-dataset was used to test the models. The cross-validation process was repeated four times so that each of the sub-datasets was used as the validation dataset once. The performance of each model was evaluated using the MSE. The training process was stopped when reaching the specified maximum number of epochs (1000) or the validation error began to rise. Sub-dataset 1 includes the parts: 2, 23, 22, 21. Sub-dataset 2 includes the parts: 12, 13, 24, 7. Sub-dataset 3 includes the parts: 19,6,9,10. Subdataset 4 includes the parts: 1,16,15,18. Each neural network model was trained using the first three components obtained from the PCA transformation of the training dataset. The percent variability explained by the first three components are: 89.17% for sub-datasets 2,3,4; 90.76% for sub-datasets 1,3,4; 90.88% for sub-datasets 1,2,4; and 93.27% for sub-datasets 1,2,3. Each trained neural network model was tested using the first three components obtained from the trained PCA model on the test dataset. The mean squared reconstruction error for the training dataset using the first three components was 0.00044 for sub-dataset 1 used as test dataset; 0.00063 for sub-dataset 2; 0.00061 for sub-dataset 3; and 0.00037 for sub-dataset 4. The mean squared reconstruction error obtained from the trained PCA model on the test dataset using the first three components was 0.00440 for subdataset 1 used as test dataset; 0.00082 for sub-dataset 2; 0.00099 for sub-dataset 3; and 0.00240 for sub-dataset 4.
The MSE results obtained from all the models on non-training data are shown in Table 6. Based on Table 6, it can be concluded that the MLP network provides accurate predictions for all the measurands and the differences in the MSE values between each sub-dataset are very small. Also, the residual values were calculated by the absolute difference between the measured deviations obtained from the comparator system and the predicted deviations. The residual values range from 0.4 µm to 6.3 µm for diameter, from 0.0 µm to 1.3 µm for true position, and from 0.0 µm to 2.7 µm for circularity. The average residual values for diameter, true position and circularity are 3.0 µm, 0.6 µm and 1.3 µm, respectively. Therefore, it can be concluded that feedforward neural networks perform well in predicting the end product quality deviations especially for true position and circularity.
The proposed method for inspection by exception is based on the following scheme to identify the parts that require inspection in order to assess whether or not they conform to design specifications. Given the predicted product health metric deviation vectorĥ j : the parts withĥ jp < τ j , for p = 1, 2, . . . ,P, are conforming parts and do not require inspection because their predicted deviations are far from the specified tolerances; in order to account for the uncertainty associated with the model predictions, the parts with τ j ≤ĥ jp ≤ τ j require inspection because their predicted deviations are close to the specified tolerances; and the parts withĥ jp > τ j are non-conforming parts with no requirements for inspection because their predicted deviations have greatly exceeded the tolerance specifications. Given the model predictions,ĥ j , and part tolerances (±0.0700 mm for diameter, 0.0100 mm for true position and 0.0500 mm for circularity), the non-conforming parts are the parts: 1, 10, and 23. The predicted diameter deviations for these three parts are: 0.0766 mm, 0.0713 mm, and 0.0794 mm, respectively. Accounting for ±6 µm, ±2 µm and ±3 µm uncertainty associated with the model predictions, for diameter deviation, true position, and circularity, respectively, and thus, given that τ j = 0.0640 mm, where j = 1 for diameter deviation, τ j = 0.0080 mm, where j = 2 for true position, and τ j = 0.0470 mm, where j = 3 for circularity, and, τ j = 0.0760 mm, where j = 1 for diameter deviation, τ j = 0.0120 mm, where j = 2 for true position, and τ j = 0.0530 mm, where j = 3 for circularity, only the part 10 requires inspection because its predicted diameter deviation is within τ 1 and τ 1 .
Given these bounds, the proposed method based on PCA-based neural networks can reduce inspection volume from sixteen parts to just one part.
For comparison, linear regression models were also developed. Figs. 9-11 show the normal probability plots of the residuals of the fitted linear regression models. The MSE results on nontraining data are shown in Table 7. Figs. 12-14 are the bar graphs of residuals calculated by the absolute difference between the measured deviations obtained from the comparator measurement system and the predicted deviations obtained from the neural network and the linear model. Linear regression models are among the most fundamental and widely used tools for many modelling problems due to their simplicity, interpretability and performance in low-data regimes. However, they may be inadequate as models for nonlinear problems and, as a result, they may not fit the data as well as neural networks. Many advanced regression modelling methods including neural networks can be considered as extensions of linear regression modelling [34]. Compared to linear regression, the neural network model provides more accurate predictions. For the linear regression model, the residual values range from 0.2 µm to 12.9 µm for diameter, from 0.1 µm to 1.8 µm for true position, and from 0.2 µm    Tables 8 and 9 show the predicted deviations from the neural network model and linear regression model, respectively.

Conformance and non-conformance probabilities
The probability that a random variable H is no greater than a specified value T is given by the integral of the PDF between −∞ with lim T →−∞ G (T ) = 0 and lim T →∞ G (T ) = 1. Therefore, the CDF can be used to compute the conformance probability: (17) Fig. 11. Normal probability plots of residuals for circularity. Given the tolerance limits T L and T U for diameter, the best estimate h 1p , and associated standard uncertainty u(h 1p ), the con- , where Φ is the CDF of the standard normal random variable with zero mean and unit variance. For example, p c (h 1p ) = 0.3 for p = 10 (part 10) given that the tolerance limits are −0.07 mm and 0.07 mm, the mean is 0.0705 mm, and the standard uncertainty is 1 µm. The non-conformance probability is p c = 1 − p c .
Similarly, the conformance and non-conformance probabilities can be obtained from the prediction resultsĥ jp by calculating an estimate of the variance from the residuals. However, for true position and circularity, one-sided tolerance intervals with a single upper tolerance limit are used and thus, p c (h jp ) = Φ ) for j = 2 and j = 3. Note that, although the (diameter) deviations  have been obtained as absolute values, two-sided tolerance intervals with lower and upper tolerance limits are still required to obtain the conformance and non-conformance probabilities for diameter deviations. Finally, signed deviations must be used for non-symmetrical two-sided tolerance intervals.

Summary and concluding remarks
With the proliferation of in-process metrology data over the years, there has been an increase of interest in machine learning techniques to develop more efficient monitoring and control strategies for intelligent/smart manufacturing. The choice of data analytics and machine learning algorithms used to discover automatically useful patterns and trends in collected data or perform accurate predictions depends on many factors such as the cost and practicality in collecting the class labels. This paper presented a new method for what the authors have called 'inspection by exception'. The proposed method is based on multistage manufacturing data and machine learning techniques, including both unsupervised and supervised learning algorithms. The input data samples included material conditions, tempering temperature, and vibration and force signals of the metal cutting process. PCA was used for dimensionality reduction. An unsupervised learning approach was developed to partition the manufactured products into two groups using the first two principal components of the normalized dataset and the FCM clustering algorithm. The normalized Euclidean distances between the principal components and cluster centres were then computed to identify the conforming parts, the non-conforming parts, and the parts that require inspection in order to determine whether or not they conform to specifications. The unsupervised learning approach reduced significantly the requirement for inspection, and, in particular, based on the 2-fold cross validation results, it was demonstrated that the volume of inspections were reduced from seventeen parts to only three parts.
A supervised learning approach based on neural networks was also developed to provide deviation vectors for product health using the first three principal components of the normalized dataset. The output data used for training the supervised model were obtained from an automated comparator system. An experimental methodology to evaluate the uncertainty associated with comparator measurement was presented to provide confidence in the measurement results and enable the calculation of conformance and non-conformance probabilities. The predicted product health metric deviation vectors compared well with the measured ones especially for true position and circularity. Regression models were also developed and compared with the neural network models. The results showed that the neural network models outperform the regression models. Based on the 4-fold cross validation results from the supervised learning approach, the volume of inspections were reduced from sixteen parts to just one part. The proposed method for inspection by exception accounts for model uncertainties and therefore, it can comply with applications that suffer from tight part tolerances. Determining the parts that require inspection for conformance assessment in an unsupervised manner has the advantage of lower cost since class labels are not required for training the machine learning algorithm. However, obtaining the health condition of the parts require supervised models.

CRediT authorship contribution statement
Moschos Papananias: Implemented the proposed approach and prepared the manuscript. Thomas E. McLeay: Conceived the proposed approach and reviewed the manuscript. Olusayo Obajemu: Reviewed the manuscript. Mahdi Mahfouf: Reviewed the manuscript. Visakan Kadirkamanathan: Supervised the implementation and reviewed the manuscript.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.