Skip to content

Aherontas/SpcPatternRecognition

Repository files navigation

SpcPatternRecognition-Exercise

Msc_In_Robotics_NTUA_Exercise

Exercise on Identification of patterns of statistical control charts with use of artificial neural networks.

In the present exercise we were asked to approach the SPC (Statistical Process Control) pattern approach and the automatic recognition by TND. Our initial approach was to understand the simple and the complex patterns, as well as our familiarity with Western Electric rules (These rules detect out-of-control or non-random patterns in control charts). The languages programming we chose to use is Python for production and data presentation, R programming language for use and familiarity with standards Western Electric and finally the MatLab program for the creation and training of the Artificial Neural Network.

Creating Patterns

The logic we followed was to create 20 point patterns between the ± 3 values. Specifically the simple patterns Uptrend, Stratification, Point Outside of Control Limits and Instability were created. In addition, the complex Cycle and Instability and Instability and Grouping patterns were created. The way their creation was as follows:

  1. Create a 20-dot pattern for each type of pattern we will use (Uptrend, Stratification, ...., Instability and Grouping) with values ​​that we type manually.
  2. Automatic production of 1000 patterns for each of them added to them so White Noise as well as random noise from Gaussian distribution (Figures 1 to 6 graphic representation of the manual pattern in relation to what is produced that has been added randomness). The final Dataset created is 6000 sample patterns.
  3. In each of them, an average of 20 points is calculated for four parameters of each pattern (Mean), minimum and maximum value (min, max) and curvature (Kurtosis) as defined by Fisher. It is worth noting that others can be added calculations in future implementation if the Python Pandas library offers us a variety of options. Therefore the current state of our dataset is an array dimensions 6000x24.
  4. For the 6 patterns we have, a dataset with the targets should be created which will be binary. This will be in the format 6000x6. Structure:

Stratification Pattern = 1 0 0 0 0 0

Uptrend = 0 1 0 0 0 0

Instability = 0 0 1 0 0 0

Point Outside of Control Limits = 0 0 0 1 0 0

Cycle and Instability = 0 0 0 0 0 1 1 0

Instability and Grouping = 0 0 0 0 0 1

Data Creation Examples:

UptrendExample1 UptrendExample2 UptrendExample3

(Figure 1 Examples of data generation for pattern: Uptrend)

StratificationExample2 )StratificationExample3 StratificationExample1

(Figure 2 Examples of pattern data creation: Stratification)

OutsideOfControlExample2 OutsideOfControlExample3 OutsideOfControlExample1

(Figure 3 Examples of pattern data generation: Point Outside Of Control)

InstabilityExample1 InstabilityExample2 InstabilityExample3

(Figure 4 Examples of data creation for pattern: Instability)

CycleAndInstabilitylExample1 CycleAndInstabilitylExample2 CycleAndInstabilitylExample3

(Figure 5 Examples of data generation for pattern: Cycle and Instability)

Instability_And_GroupingExample3 Instability_And_GroupingExample1 Instability_And_GroupingExample2

(Figure 6 Examples of data creation for pattern: Instability and Grouping)

Creation of the Artificial Neural Network

The TND was created using MatLab's Neural Pattern Recognition library. We have selected this tool for the ease of use it offers as well as the plethora of options. Below we see the steps we followed to create 2 TND. The only difference two TNDs is that one consists of one Hidden Layer and the other of two (Figure 7). Education of TND was done with a percentage of 80-5-15, ie 4800 training data, 300 validation data and 900 testing data (Figure 8).

Network_Architecture_2Hidden_Layers Network_Architecture_1Hidden_Layer

(Figure 7 Architecture of the two ANNs)

Validation_and_Test_Data_Parameters

(Figure 8 training data structure)

Training Results

After training both ANNs we came to the following range of results (Figures 9-13 contain a simulation for each ANN):

image

More Information from Plot Confusion Graphs:

1_LAYER_PLOT_CONFUSION

(Figure 9 Plot Confusion for NN with one Hidden Layer)

2_LAYER_PLOT_CONFUSION

(Figure 10 Plot Confusion for NN with two Hidden Layers)

More Information from ROC Graphs:

1_PLOT_ROC

(Figure 11 Plot ROC for NN with a Hidden Layer)

2_PLOT_ROC

(Figure 12 Plot ROC for NN with two Hidden Layers)

Training_State_1Layer Training_State_2Layers

(Figure 13 Training state of Neural Nets Gradients in correlation with epochs for 1 Layer and 2 Layers)

Conclusions

The two ANNs gave us quite reliable results and we did not detect any signs of overfitting, however providing more patterns both simple and complex would definitely make ANN more demanding. Additionally we notice that the ANN with a Hidden Layer, has mainly the difficulty in separating Class 3-4-6 (Instability, Point Outside of Control Limits and Instability and Grouping) patterns which have the most similarities between them. One of future upgrades that could make our system more reliable would be extraction of primary patterns from real processing machines. Finally it is quite easy with the structure of our program in Python to add a variety of other methods data for patterns such as UCL, LCL and feature addition (median, percentage change between the current and a prior element etc.)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages