Application of Neural Classifier for Automated Detection of Extraneous Water in Milk

An increasing number of dairy producers as well as a vast range of dairy production in the modern world is posing a significant task that consists in product quality assurance, which in its turn is essentially dependent on the quality of raw materials (milk). Hence, search for techniques and methods, which employ state-of-the-art technologies and the latest element base, for design of new information systems enabling to perform speedy and accurate analysis on raw material (milk) parameters becomes of utmost necessity and significance.


Introduction
An increasing number of dairy producers as well as a vast range of dairy production in the modern world is posing a significant task that consists in product quality assurance, which in its turn is essentially dependent on the quality of raw materials (milk). Hence, search for techniques and methods, which employ state-of-the-art technologies and the latest element base, for design of new information systems enabling to perform speedy and accurate analysis on raw material (milk) parameters becomes of utmost necessity and significance.

Equipment
The equipment item that is currently used for determination of milk freezing point depression (also extraneous water in milk) is the cryoscope. Due to low analytical capacity this instrument is not suitable for laboratory's routine operation as it is not possible to assure timely performance of analysis of all samples. The cryoscopic method for determination of freezing point depression is not automated; it requires constant human supervision. Necessity to analyze a flow of tens or hundreds of thousands of milk samples per month triggers an urgent need to create an automated parameter control system that is capable of independent, accurate and fast determination of extraneous water content as well as other relevant parameters in milk, needless of additional human supervision.
Analytical methods that are currently used to determine extraneous water in milk are presented [1] in Table 1.
The data presented in Table 1 point to the fact that the presently used methods are incapable of performance of high-speed analyses ( Table 1, rows 1-2). Development of high analytical speed in these methods is hindered by fact that physical-chemical processes taking place during the analytical process cannot be accelerated. As the result, considerable time and labour expenditures and low analytical speed inevitably remain. Better results can be achieved in evaluation by the indirect method. This method requires evaluation of the effect of multiple independent parameters during analysis.

Structuring of analytical system
As it follows from the analysis, IR spectroscopy can serve as the best basis for creation of electronic-http://dx.doi.org/10.5755/j01.eee.115.9.750 information system. Hereinafter, determination of extraneous water in milk based on the analysis of milk composition is described. It points to a possibility to design [2], a new system by means of combining two methods those of IR spectroscopy and the conventional evaluation of the extraneous water in milk by the cryoscope, i.e. to apply IR spectroscopy for evaluation of extraneous water in milk. Such a system would excel by its high analytical speed (since all analyses are performed simultaneously, with analytical speed being 400 samples per hour) and low error of result (as all parameters that may have impact on the increase of error of result are evaluated).
On the basis of results of the analysis the following structural scheme of the system of milk sample analysis can be drawn (Fig. 1). It presents the actions that are necessary to deliver the results of milk sample analysis: -Collection of results of evaluation of milk sample composition and freezing point depression; -Pooling of results of parallel analyses (determination of bacterial contamination, inhibitors, temperature of sample at the moment of testing; -Verification of correctness of the analysis by means of collating against the data from the data archive on the results of previous analyses of the same sample to check if there are any significant discrepancies; -Correction of the result of analysis (if necessary) in accordance with data recalculation rules in order to assure accuracy of the analytical data (temperature of sample at the moment of testing, bacterial contamination are taken into account); -Delivery of the final result of analysis to the customer based on rules of data reporting. The advantage of this system consists in delivery of exhaustive results of milk sample analysis to the customer. It is of utmost relevance in assurance of top grade quality of milk and dairy products as well as in promptness, accuracy and reliability of results obtained.

Parameter control scheme
On the basis of the system of milk sample analysis presented in Fig. 1 a parameter control scheme can be drawn as shown in Fig. 2. Its principle of operation is presented below, with each part separately described. In the scheme presented in Fig. 2 milk is poured into cell 3, which is exposed to IR beams. The beam from source 1 passes through optical IR filters 2, cell 3 to detector 4, which determines the intensity of the beam. The optical filter 2 produces a beam of the required wavelength, which is absorbed by the component under analysis in cell 3. In the control unit the intensity of the IR beam is used to evaluate the component concentration. Simultaneously electrical conductivity of milk is determined in the unit for evaluation of specific electrical conductivity 5. Having determined the composition and obtained the electrical conductivity, presence of extraneous water in milk is worked out in unit for calculation of milk fat, protein, lactose content, specific electrical conductivity and the fact of presence of extraneous water in milk.

Artificial neural network
An Artificial Neural Network (ANN) is a system of simple processing elements, called neurons. The neurons are connected to a network by a set of connections, which have various weights [3]. The ANN is determined by its architecture, magnitude of the weights and the neurons mode of operation. ANN has many advantages against classical statistical methods. The main advantage is that ANN is independent of the statistical distribution of the data. An ANN is a technique, capable of resolving paradigms that linear computing cannot. ANN learns from given data and does not need to be reprogrammed. The main issue is to set the structure of the ANN for specific task. When there are given inputs and outputs for ANN training, we have a case of supervised learning, and ANN must learn a mapping from the inputs to the outputs. Compared with statistical methods, ANN needs less training data for accurate analysis [4]. ANN can be applied for various tasks. Classification is the task for which solutions ANN is often used.
The basic element of ANN is a neuron. It is a mathematical function that takes a number of inputs, weights these inputs, sums them up, adds a bias and uses the result as the argument for a singular valued function, called activation or transfer function, which result is the neurons output. The corresponding weight, called the bias weight, controls the threshold level of the transfer function. A model of artificial neuron is presented in Fig. 3.

Fig. 3. A model of artificial neuron
Artificial neurons in the ANN are organized into layers. Each neuron in a layer takes as input the outputs of neurons in the previous layer or the external inputs. That means that each neuron of the ANN is interconnected to the neurons in both the preceding and following layer. There are no connections among neurons within a layer. ANN consists of three types of layers: input layer, hidden layers, and output layer. An input layer serves as a carrier of information about the input data distribution. The nodes of the first layer are the elements of a feature vector. The input layer is followed by one or several hidden layers. The final layer is termed output layer because it gives the output data of ANN. All connections of ANN have associated weights with them. The knowledge of the ANN is encoded by values of these weights. The finding of the weights using given data is the main task to get trained ANN. After training stage the weights of ANN are found and ANN can be used for new coming input data classification. Usually the backpropagation algorithm trains the ANN until targeted minimal error is achieved between the desired and actual output of the network [5]. Back-propagation algorithm is a gradient descent algorithm where the weights of ANN are moved along the negative of the gradient of the performance function. The most used performance function for training of feed-forward ANN is the mean sum of squares of the network errors between the ANN outputs and the target outputs.

Analysis and results
To solve milk sample classification task, one of the best engineering environments for technical computing -MATLAB ("MATrix LABoratory") and its Neural Network Toolbox were used. The Neural Network Toolbox was chosen because it is flexible and convenient. It offers a broad variety of parameters for ANN design, use and modification. Wide and clear user guide is provided with the toolbox. A MATLAB script for data loading from a file, ANN training and validating, structure and performance of ANN saving in a file of results was written.
In the researched task the data must be classified into two classes: 1) milk samples with extraneous water; 2) milk samples without extraneous water.
For the data analysis 3618 data records were collected of which 585 records belong to the first class and 3033 to the second class. In our case the data of the firs class are more important because classifying them as wrong greater looses are suffered. Therefore, selecting the structure of ANN more attention must be paid to first class data classification error. It should be kept to a minimum.
The Feed-forward ANN and the Levenberg-Marquardt training algorithm is used in our experiments [3]. Transfer function of each artificial neuron is a logsigmoid function (1). It is suitable for classification tasks because it is nonlinear function, its values are from interval [0; 1], and threshold level is 0.5. Another advantage of logsigmoid function is that its derivative can be expressed in terms of the function itself. That is shown in equation (2). Derivatives are used in the training stage of the ANN: When transfer function is log-sigmoid function -the output of the k th neuron of the first hidden layer can be calculated by the formulae (Fig. 3) here y k is output of the k th neuron of the first hidden layer. w ki are weights of ANN between input and the first hidden layers. x i is input of the ANN. Outputs of other hidden layer neurons are calculated using similar functions.
That the results were more reliable, we trained ANN of each structure with 25 networks and calculated means and standard deviations of classification error. Following structures of ANN were investigated: from 1 to 25 neurons in the firs hidden layer, from 0 to 20 in the second, and from 0 to 15 in the third hidden layer. The simplest investigated ANN has one hidden layer and only one neuron in it. The ANN of largest structure consists of three hidden layers with respectively 25, 20, and 15 neurons.
Data classification results are presented in Table 2. In the first, second and third columns are amounts of neurons in the first, second and third hidden layers respectively. In the fourth column there are means of classification error rate for all data (25 ANNs of the same structure were trained). In the sixth column there are classification error rate of data class when the milk has extraneous water. In the eighth column there are classification error rate of data class when there was no extraneous water in the milk. The fifth, seventh and ninth columns present the classification error standard deviations.  Table 2 shows the results of ten ANNs, which demonstrated the lowest classification error of the first class data (6 th column). We can see that ANN of such structure classifies well the data and of the second class (8 th column). In the table there are highlighted by three best results when the lowest classification error in percents was got for all data, for the first class data, and for the second class data. From the table we can see that the best classifier is the ANN with three hidden layers and 9, 2, and 11 neurons in the relevant layers. The ANN which showed the second best result has simpler structure. It consists of two hidden layers with 23 and 1 neurons.

1.
The results show that it is possible to evaluate the presence of extraneous water in milk using artificial neural network classifier. In our case the optimal structure of ANN appeared to be of two hidden layers with 23 and 1 neurons correspondingly. The error of this classifier is 3.2% (total) and 12.0% (false negative).
2. The results permit us to affirm that the proposed method enables detection of extraneous water in milk sample with desired accuracy and minimizes possibility of operator error as the detection of fact that extraneous water is present in sample is carried out by the control system, not by the operator judging by sample freezing point depression.