Rancidity Analysis Management System Based on Machine Learning Using IoT Rancidity Sensors

Rancidity data can be used in various fields such as the quality analysis of food and raw materials used for construction. The rancidity of raw materials used in road pavement asphalt is currently only at the level determined by the temperature or visual factors. Although construction workers are managed individually and subjectively, such as by visual methods, they cannot be managed in practice. In this paper, we propose a system combining a rancidity sensor with an Internet of Things (IoT) communication module that collects and predicts rancidity measurements in real time at a site. The values measured by the sensor are periodically transferred to the Cloud through the IoT communication module, the validity of the data set is established, and the systematic management of the data is performed using machine-learning-based data analysis techniques. The results of an experiment showed a high classification prediction accuracy of 91.3% and a short-term pattern prediction accuracy of 96.6% (weighted scaling), confirming its excellent potential for raw material quality management. The results of this paper will be applied as a road pavement quality management system.


Introduction
Rancidity data can be used in diverse areas such as the quality analysis of food and raw materials for construction, and rancidity measurement is becoming an important method of determining the state of raw materials. In the case of oil used for frying food, the rancidity of the oil is measured by using a paper or from experience (such as how many times it has been used to fry chicken) in general restaurants, making accurate measurements difficult. The rancidity of raw materials used for pavement asphalt is determined merely by the temperature or visual estimation. Although rancidity can be managed by subjective measurement methods, such as a visual method and individual control, its systematic management at each position is not possible. Studies on systems allowing the transmission of measured data for monitoring and management and methods of analysis are scarce. In existing studies, although rancidity sensors, particularly those for edible oils were investigated, (1)(2)(3) the development of sensors combined with communication modules for the collection or analysis of data is insufficient. (4,5) The system proposed in this paper allows the real-time collection of rancidity measurements in the field and predictive analysis by coupling rancidity sensors and an Internet of Things (IoT) communication module. It periodically transmits the values of rancidity measured by sensors to the Cloud via the IoT communication module, constructs a data set of rancidity, and performs the systematic management of rancidity measurements using data analysis techniques based on machine learning. By integrating the data transmitted to the Cloud to construct the data set and processing the data to construct a training set, we have proposed a system that allows classification and short-term predictions. The proposed system is provided through a mobile application or the web and enables the extraction of a quality management pattern for rancidity by applying an IoT rancidity sensor and an intelligent data analysis technique. In this system, real-time monitoring and quality management are possible as features are extracted from the patterns, and quality management levels are classified through time series analysis to classify and predict the quality states of rancidity and to predict changes in quality so as to enable real-time monitoring and quality management. By the rational use of materials and the construction of a quality management system, the reliability of the quality of raw materials can be enhanced. Additionally, as reported in the paper, experiments on quality management, classification, and prediction as well as the prediction of changes in patterns have been carried out with the proposed system ( Fig. 1) by using the developed IoT sensors to collect actually measured data from restaurants using oil for a given period. According to the results of the implementation, high accuracies for a classification prediction accuracy of 91.3% and a shortterm pattern prediction accuracy of 96.66% were observed, confirming the excellent potential of the proposed system for the quality management of raw materials.

Machine learning methods for IoT data analysis
IoT is set to revolutionize all aspects of our lives. The number of objects connected to IoT is expected to reach 50 billion by 2020, giving rise to an enormous amount of valuable data. (6,7) The data collected from IoT devices will be used to understand and control complex environments around us, enabling better decision making, greater automation, and higher efficiency, productivity, accuracy, and wealth generation. Data mining and other artificial intelligence methods will play a critical role in creating smarter IoTs, albeit with many challenges. There are eight well-known data mining algorithms for IoT data. These include deep learning artificial neural networks (DLANNs), which build a feedforward multilayer artificial neural network (ANN) for modelling high-level data abstractions. In Ref. 7, the results of three real IoT datasets show that C4.5 and C5.0 have higher accuracies, are memory-efficient, and have relatively higher processing speeds.
ANNs and DLANNs can provide highly accurate results but have high computation cost and complexity. (8) Through the performance comparison of eight typical algorithms, the efficiency of IoT and machine learning algorithms was assessed, and each feature was presented in Ref. 6. As such, the technology is being used in various fields ranging from data collection to analysis and prediction in conjuction with IoT sensors and machine learning methods. (9,10)

Support vector machine (SVM)
The classification model was constructed using the SVM as the machine learning model. The basic principle of the SVM begins with the classification of SVM input patterns into two classes {+1, −1} through supervised learning. When training groups are classified into two classes, the hyperplane that separates the training patterns can be determined. The hyperplane here refers to the cutting plane that separates individual groups. The boundaries of the patterns determining this plane are called support vectors. (11) There are three key stages in the SVM algorithm. The first is to find the boundaries, the second to find the hyperplane that maximizes the margin or distance of the hyperplane from each boundary, and the last to determine which side of the hyperplane the given test record belongs to. (12) • Find boundary of each class The outline obtained when all points corresponding to one class in the data set is the boundary of the class. Figure 2 shows a boundary, which is referred to as the convex hull (Fig. 3). Each class has its own convex hull, and the convex hulls of different classes do not intersect.  (10) • Find the best hyperplane to satisfy conditions When finding the hyperplane, a mathematical method is employed, where any hyperplane has two attributes of x 1 , x 2 as follows, and an expression such as H: b + ω = 0 is given. Examining this expression, we have x = (x 1 , x 2 ) and b is an intercept called the deflection. This expression is similar to the standard form of a linear equation, and the equation describing the optimum hyperplane is given as H 0 : b 0 + ω 0 = 0. The margin is given by 2 ω ω . From this expression, the optimum hyperplane is obtained.
• Classification of test records Once the boundaries and the hyperplane are determined, it is calculated on which side of the hyperplane a new test record to be classified lies. This can be done easily by substituting the test record x into the mathematical expression for the hyperplane. If the calculated value is +1, it belongs to the positive class, while it belongs to the negative class in the case of −1.

• Features
The SVM is an algorithm used for classification and prediction together with such algorithms as decision-making trees and neural networks. It is a model allowing the linear transformation of the training set, which shows better performance, making it easier to transform the data set.

Intelligent Rancidity Analysis System Based on IoT
The proposed system can transmit the sensor data by using rancidity sensors capable of measuring temperature and rancidity and by coupling a Bluetooth communication module to the sensors. Figure 4 shows a hardware of rancidity sensors. Sensors and modules are designed and developed, and the data measured by the sensors is transmitted to the data collection server via gateway. By installing one gateway for each field, the gateway transmits rancidity and temperature data, and these gateways will later be developed into diversified IoT gateways in an expandable form. (11,13) For the data analysis module, an algorithm that supports a classification function (rancidity quality state) and a prediction function (quality change) based on the rancidity measurements has been proposed by our other studies. It employs a newly developed technology that analyzes to enable control and management from the viewpoint of monitoring and maintains the rancidity of raw materials. Figure 5 shows the process of our proposed system. The communication protocol between the sensor and the server is shown in Fig. 6. The data measured by sensors is transmitted to the gateway via the Bluetooth communication module, then the gateway processes the data according to the prescribed protocol for transmission to the server.
The data transmitted by using the protocol in Rest API form is collected, saved, and managed through a data collection server based on a web application server that enables realtime monitoring. Data analysis is carried out in the analysis module using the collected data. Discussed in detail below are the contents of the analysis module.

Model for quality classification and prediction
The classification and prediction functions respectively classify and predict the quality states through the proposed classification model based on machine learning, as well as identify and evaluate the current quality state following the identification of management levels. Through the model obtained by the accumulation of data, a standardized data model allowing the identification of oil management states is constructed. The classification function is characterized as follows.  1. Signal preprocessing and feature extraction from the rancidity pattern as a function of the time flow of the location using each raw material. 2. Labeling of the existing data according to the prescribed levels with the quality management level determined by prior knowledge as a target variable (Good, Normal, Poor, or Very Poor). 3. Management label classification by generating an analysis model through data learning and by inputting data collected from individual businesses. 4. In the present module, each feature from the data collected for 500 days has learning sets constructed using feature sets with the current rancidity, the average rancidity for day D-1, the weekly average rancidity, and the monthly average rancidity. Each training set is constructed from data for 100 days to generate an SVM model. When the data of a new time window is inputted from the generated model, quality levels are classified and predicted.

Prediction model for short-term quality patterns
In the prediction function for short-term patterns, patterns for a given time section are identified to determine the quality change times in the levels according to quality, and the quality change pattern for the next time section is predicted. Through the prediction of quality changes, quality management can be performed by predicting replacement times for the raw materials, the state changes of the original material, and so forth. To generate a prediction model, an autoregressive integrated moving average (ARIMA) (14) was applied.
Real-time series data are frequently nonstationary. However, the AR(p), MA(q), or ARMA(p, q) model combining these two cannot explain such a nonstationary aspect. Therefore, the model used to remove such a nonstationary aspect from the model is the ARIMA model itself, which is expressed as ARIMA(p, d, q). (15) In the prediction module, the ARIMA model has been designed using actually measured data in the unit of 1 over one day and then changes in the data for 1 h are predicted later. Since rancidity usually increases over time then decreases again at the time of material replacement, the ARIMA model is suitable for our application.

Environment of experiment
We performed various experiments. The environment used in the experiment is shown in Table 1. The rancidity sensor used a sensor we developed in another study. (16) Because we implemented it on the web, we used a server/client model.

Experiment on quality management level classification
In the classification experiments on quality management labels, actually measured data were generated to produce a measured data set for 500 days, using feature sets prepared with the current rancidity, yesterday average rancidity, weekly average rancidity, and monthly average rancidity for the construction of the training sets. By constructing a total of 10 training sets with 100 cases of data each composed of feature sets, as shown in Table 2, a model was produced by using the SVM from each learning set, and the performance of the model was verified using the test set.
Experimental results outputted by inputting the test set in the model made from individual training sets are shown below. The total number of data for the data set is 101, with the data level composition of 16 for Good, 57 for Normal, 6 for Poor, and 22 for Very Poor. Measurements were made to determine whether the existing label and the label results predicted by the models were accurate. According to the experimental results with the same test sets used as 10 training sets (Table 3), the prediction accuracy of the final average classification was found to be 91.3%. From the experimental results obtained using the actually measured data, it was found that the prediction model of the SVM quality management label showed excellent performance.

Experiment on prediction of short-term quality
In the next experiment, short-term quality was predicted using the ARIMA model for the data collected through the developed rancidity sensor. The accuracy was calculated by determining whether the predicted values were similar to the rancidity values actually measured    in the field using edible oils. We collected and predicted data using the following order. 1. Receive actually measured values of rancidity in the field. 2. Generate a prediction and analysis model for the rancidity values collected thus far through data learning and predict the next values whenever new data are received. 3. Predict rancidity values on previous dates and determine the prediction accuracy by comparison with actually measured values.
The data are configured as follows.
We repeated each experiment 10 times and measured the average of the accuracy results. According to the standard deviation and dispersion results, individual error values do not show    The accuracy of the error for overall predicted values can be determined by using average errors of the data. Since the deviation and dispersion are small, the accuracy of the model is considered to be excellent. The range of the average error for data sets 1-5 was about 0.138 from the actual values. Since rancidity values have a range of 0-100, the prediction accuracy calculated from the average value of the error is about 99.862% on the relevant scale (Table 9). Apart from that in special cases, the actual rancidity does not exceed 24. If managed normally, the error is about 3.332 when the accuracy is computed by adjustment for a rational range so that the accuracy is determined to be about 96.668%. Consequently, from the accuracy result, the performance of the model for short-term quality prediction in the present system is considered to be excellent.

Further Study and Conclusion
In this study, sensors allowing the measurement of rancidity have been developed, and a communication device capable of transmitting measurement data to the network has been proposed to analyze data obtained from the sensors. In addition, a data analysis system has been constructed, and a system where rancidity states are determined and changes are predicted by the analysis of the collected rancidity data by machine learning has been proposed.
The proposed system is an intelligent system that allows the monitoring of the rancidity of raw materials in the field by real-time measurement, the determination of quality states for raw materials through analysis, and the prediction of changes. For the verification of the performance, the performance of the sensors has been evaluated by measuring the rancidity of oils at actual businesses. In addition, classification and prediction experiments have been performed by analyzing the collected data using the proposed technique. The results showed excellent performance levels of 91.3% for classification and 96.668% for prediction.
For further study, the development of a dispersion processing system capable of real-time processing/analysis is planned once multiple data have been collected from experiments using raw materials other than oil and multiple sensors. Figure 12 schematically shows joint cutting using IoT and bigdata analysis in a road pavement quality management system. The proposed system can be applied as a quality control system in various fields when combined with not only saturation sensors but also widely available temperature sensors. As a representative application, data are being collected using IoT for road pavement quality management and building information modeling (BIM) area construction, and raw material and construction quality management is being studied. In the case of asphalt and concrete, rancidity, temperature, and humidity are important quality control factors. Therefore, analyzing and predicting the changes in rancidity, temperature, and humidity can predict the quality characteristics (e.g., strength) of asphalt and concrete. According to the analysis results, it is possible to predict the optimal timing of the construction process such as joint cutting. The training set consists of IoT sensor data, temperature, rancidity, humidity, weather data, and source information data. The data set is redefined as feature vectors based on factors that affect the strength of concrete. Figure 13 shows a system for further study. We will study a road pavement quality management technology that can provide automated information using IoT and a big data platform. The system collects data from actual sites, such as rancidity using IoT sensors. We will analyze the road paving quality by analyzing the data using the accelerated big data platform and providing the prediction data.