Bayesian Predictive Assistance System: An ...

3 downloads 102082 Views 681KB Size Report
vehicles. Therefore, we choose a development kit from emtrion ... The development kit consists of an i. ... provides the binary format for iOS and Android systems.
Bayesian Predictive Assistance System: An Embedded Application for Resource Optimization in Industrial Cleaning Processes Ganesh man Shrestha1 , Peng Li1 and Oliver Niggemann1,2 1 inIT-Institut Industrial IT, University of Applied Sciences, 32657 Lemgo, Germany email: {ganesh.shrestha, peng.li, oliver.niggemann}@hs-owl.de 2 Fraunhofer IOSB-INA, 32657 Lemgo, Germany email: [email protected] Abstract—Bayesian networks (BNs) have been used in different contexts of decision support solutions such as directive, strategic, tactical and operational. These contexts differ from each other only in the realization of the decision support in terms of time. The real-time implementation of BN in an embedded system for resource optimization is very challenging because of the low computation capacity in embedded systems and, to the best of our knowledge, has not been reported yet. In this paper, we present a BN based predictive assistance system that uses real-life data to perform the real-time decision support in industrial cleaning processes.

I.

I NTRODUCTION

Bayesian networks (BNs) have been increasingly used in various applications such as medical diagnosis, epidemiology, environmental science, resource management and artificial intelligence. In recent years, BNs have gained popularity in decision support systems for resource optimization. BN decision support solutions can be categorized in terms of time as either (1) directive, (2) strategic, (3) tactical or (4) operational [1], which correspond to the long-term, mediumterm, short-term and real-time decision supports respectively. In this paper, a BN is implemented in an embedded application with real-time requirements which is still very challenging due to the resource constraints in the embedded devices, especially for the tasks of BN parameter learning and prediction. To the best of our knowledge, a real-time application of BN in an embedded system for resource optimization has not been reported yet. Here, we present an assistance system that supports learning and decision making under uncertainty in a new application domain: industrial cleaning process. A cleaning vehicle cleans drains, as shown in figure 1, by flushing the contained impurities, sediments, fats, etc. with high pressure water jets. The quality of the cleaning, the number of necessary cleaning operations and especially the consumption of resources (water, fuel etc.) depend on the cleaning environment, i.e. kind and amount of dirt, pipe parameters, operational expertise of the cleaning personnel, i.e. how well users choose cleaning parameters such as water pressure. Some of the major challenges of current industrial cleaning processes are: 1) lack of possibility to visualize the real-life cleaning operation, 2) lack of possibility to get a feedback

Fig. 1.

A general cleaning process of waste in pipeline

about the cleaning results due to lack of sensors, 3) low-skilled and inexperienced cleaning personnel who lack the expertise to decide on the optimal cleaning parameters based on a particular cleaning environment, and 4) lack of opportunity to learn from the past cleaning experience. One could argue that these problems could be addressed by equipping the flushing hose with special cameras to visualize the actual condition in the pipeline. But the special cameras that could work in such harsh environment are very expensive and not appropriate to use in regular cleaning vehicles. Furthermore, this approach can not assist the inexperienced cleaning personnel too much in choosing the optimal cleaning parameters. Thus, the use of cameras could be useful in special cases such as pipeline inspection but not in regular cleaning. A better solution would be to develop an assistance system that learns from the past cleaning experience and assists the cleaning personnel in choosing optimal cleaning parameters. Furthermore, possible damage to the pipes by the use of excessive pressure–e.g. due to lack of experience–could also be prevented. Our proposed assistance system is implemented in an embedded device and provides a real-time decision support. The notion of real-time for our application is ca. 4-5 sec. An overview of the learning and prediction processes is shown in

Expert knowledge

Bayesian network structure

Input values (Cleaning scenario)

such as fault detection and diagnosis [3], [4]. The BN is also increasingly used for predictive inference. In [5], the authors present a commercial decision support system for talent retention and [6] presents a new stock price prediction algorithm.

Data

For resource optimization, Varis [7] presents an application of BN in river quality management for waste water treatment plants in a watershed. Similar research is available in the EU project SEEDS [8]. In this project, the different Artificial Intelligence methods such as neural networks, decision tree learning and BN are used to optimize energy consumption.

Bayesian network parameters

Bayesian Predictor

Output values (Optimal cleaning parameters)

Assistance system

Fig. 2.

An overview of the prediction process

figure 2. As seen in the figure, the BN structure, i.e. model, is generated based on expert knowledge and on data. The BN parameters, i.e. the knowledge base, are learned from data only. The assistance system receives the pipeline specific values such as the type of contamination, the level of contamination etc. as input from the cleaning personnel and predicts the optimal cleaning parameters such as the type of nozzle, the flushing pressure etc. The assistance system will be a learning system and stores the successful cleaning results in a central database for future cleaning purpose, which eventually leads in updating of the knowledge base. Thus, the proposed assistance system is a data driven system that, analogous to the behavior of a human being, becomes more stable when it gains more experience. The application is realized using the data from real-life cleaning operations. A real product, currently under development, will be developed in cooperation with an industry partner. From a computer science point of view, the challenges are as follows: 1) 2) 3)

How can a reasonable model of the system’s causalities be defined? Is an embedded implementation of the learning of the BN possible? Can an embedded device use the BN to control the cleaning processes in real-time?

In the following, this paper will address these topics: the first challenge will be addressed in Bayesian Network Structure Learning subsection of the Solution Approach section. The second and third challenges will be addressed in the real-time realization subsection of the Testbed Implementation section.

Most of the studies on BN just focus on the application in general-purpose computers [9], [10]. For the use of BN in industrial fields, the applicability of BN in real-time embedded systems should be studied. Fabio T., Fabio G. and Jaime [11] present an adaptive conditioning algorithm for BN inference, which enable the real-time inference in embedded systems. In this algorithm, a BN is divided in several sub-networks. The proposed algorithm is not generic as it is not always possible to divide the BN with complex dependencies into sub-networks. Furthermore, the paper only addresses the inference algorithm and does not address the parameter learning. Our work focuses on both the BN parameter learning and BN inference. In this paper, we present an embedded application of BN for real-time control of the cleaning processes. III.

S OLUTION A PPROACH

A BN models causal relationships between random variables. Its structure forms a directed acyclic graph (DAG) where nodes model variables and edges correspond to causalities. The strength of a causality is expressed as a conditional probability, employing Bayes’ theorem from equation 1 [12]. Non-connected variables are assumed to be independent. P (h|e) =

P (e|h)P (h) P (e)

(1)

P (h|e) is the posterior probability of a hypothesis given an evidence; P (e|h) is the conditional probability of the evidence given the hypothesis; P (h) is the prior probability of the hypothesis and P (e) is the probability of the evidence. A BN consists of two components: M = {G, θ}

(2)

where G represents a DAG and θ represents conditional probability tables (CPTs) for each node in the DAG. In Bayesian term, the DAG and the CPTs are referred as BN structure and BN parameters respectively [12]. A. Dataset

II.

R ELATED W ORK

A wide range of models, such as Neural network, support vector machine, Bayesian network (BN) etc, that deal with adding intelligence in the machine are available in the literature. We choose BN because it is less sensitive to small data set size and easier to realize, as BN can be easily understood by human [2]. A number of studies on application of BN are available which mainly focus on diagnostic inference

The data used in the evaluation consists of 3200 rows collected from real-life cleaning operations in a German city over the duration of 6 years. The dataset consists of both the variables specific to the cleaning vehicle and the variables specific to the cleaning environment, i.e. the pipeline, dirt, etc. The data specific to the cleaning vehicle was obtained by reading the values recorded by the cleaning vehicle, while the data specific to the cleaning environment was obtained via manual

entry of values by the cleaning personnel during the cleaning processes. The values of some variables such as the speed of waste water and the amount of dirt could not be measured due to lack of the measuring devices in the vehicle. The values of some missing variables are calculated using mathematical equations based on physical models of the cleaning processes. These equations were provided by the project partner as a part of research collaboration within this project. The dataset consists of discrete and continuous variables. The values of the continuous variables were discretized based on the expert’s opinion on the data distribution plots. B. Architecture of Assistance System

the amount of data exceed the storage limit of the embedded device. Instead of loading the data from the central database and then learning the BN parameters online in the embedded device during the cleaning processes, it is advantageous to perform the BN parameter learning offline. In the offline approach, BN parameter learning is performed remotely in a central server. Then the BN parameters are loaded in the embedded device via web services. The offline approach is advantageous as compared to the online approach because, in offline approach, the cleaning personnel does not have to wait idly when the embedded device is performing the BN parameter learning. In this paper, we present both solution approaches and analyze their timing behavior. C. Bayesian Network Structure Learning

Fig. 3.

System Architecture of BPAS

A typical architecture of the assistance system, as shown in figure 3, consists of the user interface, the predicting system, the learning system, and the database for storing the past cleaning results. A graphical user interface (GUI) operates as an input/output interface. The learning system generates a knowledge base using the BN structure and the past cleaning data. The knowledge base is a tabular structure that consists of conditional probabilities for each edge of the BN, i.e. the BN parameters. Based on the learned BN parameters, the prediction system then predicts the optimal parameters (i.e. the values of the output variables) for a given cleaning scenario. Such cleaning scenarios are described by the pipe material, the type of dirt, the amount of dirt, etc. The assistance system is responsible for decision making and updating the knowledge base when new data is available. The control system is responsible for passing the control parameters from the assistance system to the different components of cleaning vehicles. The BN parameter learning requires hardware resources with high computation capacity. Unfortunately, the hardware resources used in the cleaning vehicles are embedded devices with focus mainly on user interface graphics and on stability in harsh environment rather than their computational capacity. Therefore performing online BN parameter learning in the embedded device during a real-life cleaning operation might be very challenging. Furthermore, the embedded devices are equipped with limited storage space. Due to which historical cleaning data needs to be saved in a separate database when

Though learning the BN structure from data is increasingly popular, this approach might not be an ideal choice in situations such as unavailability of enough data, non-standard data collection where its quality is influenced by the level of individual collectors expertise. Due to lack of sensors and cameras in the general cleaning vehicles, it is very difficult to collect the data specific to cleaning environments. In most cases, the data collection during a regular cleaning process is performed from the top of a manhole without being in the manhole because of the regularity issues for the operator to be inside the manhole. The operator measures what is seen from the top of the manhole without using any standard approach and such measurement is influenced by individual operator’s expertise and interpretation. The data collected with such approach will be probably very noisy. In a BN structure learned from such noisy data, it is difficult to differentiate between the correlation and the causation. So, we first constructed the BN structure, shown in figure 4, using the expert knowledge. The nodes T P L (type of pipeline), DP L (diameter of pipeline), T D (type of dirt) and W L (water level) are the input variables. The nodes SW (speed of water) and CAS (cross-section area of sediment) are the intermediate variables whose values were not available during the cleaning processes. These intermediate variables are the result of the expert knowledge and their values were calculated based on the mathematical equations provided by the expert. The user can read and input the value of variable LD (level of dirt) when there is no water in the pipeline but the user is not able to read its value when there is water in the pipeline. In such cases, the value of the LD is calculated using the mathematical equations. The nodes N V (nozzle version), F P (Flushing pressure), N SO (nozzle speed out) and N CC (number of cleaning cycles) are the output variables. Some of the intermediate variables are discarded for now because of lack of data. The work is in progress to generate data for those variables and will be included in the BN later. We then applied the score-based hill-climbing algorithm to learn the BN structure from data. The learned BN structure lack some dependencies that is present in the BN structure constructed from the expert knowledge. The variables T P L and N CC do not have any directed edges to other variables suggesting that they are independent from other variables although the BN structure from expert shows dependencies with other variables. This might be due to the inefficiencies, such as high degree of noise, class imbalance problem etc.,

missing values of the variables to calculate BN parameters using the Bayes’ theorem. The em algorithms consists of two steps. The first, i.e. expectation, step assigns same probability for each missing values and the second, i.e. maximization, step re-estimates the BN parameters using the assigned probabilities in the first step. As mentioned above, some of the data are collected manually due to lack of sensors and cameras. In some cases such as untrained user unable to take measurement or make judgments on certain scenarios, the data collection is not possible resulting in missing values for some variables. we used bayes and em algorithms for parameter learning to handle such missing values and to ensure that a suggestion is provided even when the user is not able to input values of some variables. The evaluation of both the algorithms produced stable result. IV.

T ESTBED I MPLEMENTATION

A prototype is developed to evaluate the two proposed solution approaches. For the proof of concept, we realized the online approach as a standalone application and the offline approach as a client-server application. Furthermore, their timing performances are also evaluated in this paper. A. Hardware Platform

Fig. 4.

A Bayesian network Structure

in the collected data. Thus, it is not suitable to learn the BN structure from the data available to us now. But learning BN structure from data is certainly helpful to decide on the causalities when the experts are not confident. Reasonable model of the system’s causalities: Though we choose the BN structure constructed using the expert knowledge for now but it will not be the final BN structure. The proposed assistance system also records data after the cleaning. This data will be used to validate the BN structure in timely manner because using a combined approach is advantageous as it complements the inefficiency that can occur when using only one approach. D. Bayesian Network Parameter Learning An exact manual definition of the degree of dependencies between variables is very difficult. Thus, usually BN parameters are learned automatically from data. The most widely referred BN parameter learning algorithms in the literature are mle (maximum likelihood estimate), bayes (Bayesian estimate) and em (expectation maximization). Given the BN structure and the data, these algorithms return the BN parameters for each edges in the BN. The mle algorithm performs simple frequency estimates to calculate the BN parameters and is not able to calculate the BN parameters if there are missing values in the data. The bayes and the em algorithms are also able to calculate BN parameters even if there are missing values in the data. The bayes algorithm randomly assigns same probability for each

The ARM Cortex-A8 processor i.MX537 is widely used in HMI (Human Machine Interface) systems for industrial vehicles. Therefore, we choose a development kit from emtrion embedded systems which has compatible hardware components with such HMI systems for the testbed implementation. The development kit consists of an i.MX537 CPU (800 MHz), 1 GB RAM and operates under a Linux operation system. A desktop PC with 3.2 GHz Core and 8 GB of memory is also used in the testbed implementation to realize the client-server approach. B. Software Implementation There are different libraries supporting BN implementation [13]. Table I shows a comparison between some widely used libraries. Most of them are just compiled for x86 platform. SM ILE library is available for ARM platform but just provides the binary format for iOS and Android systems. To realize the BN in this ARM based embedded device, an open source library is necessary. We implemented testbed in c++ language with the library libDAI [14] because it provides more inference algorithms as compared to the library Dlibc++ [15]. We have ported libDAI library to ARM based Linux platform. Our testbed implementation consists of both the standalone and the client-server approach. Figure 5 (a) shows the flow chart of standalone approach: it implements both the BN parameter learning and the prediction in the embedded device. In the client-server approach, the client performs only the prediction and is implemented in the embedded device, without the section inside the dotted line (figure 5 (a)). The BN parameter learning (figure 5 (b)) is implemented in the server as RESTful web-services using the Apache Axis2/C library. A web-service runs in background to check the database status and automatically calls the BN parameter learning function,

TABLE I. Library

OS/Platform

C OMPARISON OF DIFFERENT LIBRARIES PL/SL

Prog.Language

Usability

Open Source/Commercial

Current Version

libDAI [14]

Windows/x86, Unix/x86, iOS/x86

Yes/No

c++

good

Yes (LGPL)/Yes

V0.3 - 07.2013

Dlibc++ [15]

Windows/x86, Unix/x86, iOS/x86

Yes/No

c++

good

Yes (Boost)/Yes

V18.9 - 06.2014

SMILE [16]

Windows/x86, Unix/x86, iOS/x86, iOS/ARM, Android/ARM

Yes/Yes

c++, c#, java

very good

No/Yes

V11.0 - 04.2014

Infer.Net [17]

Windows/x86

Yes/No

very good

No/No

V2.5 Beta - 04.2013

.Net

* OS: operating system; PL: parameter learning; SL: structure learning; Prog.Language: program language.

on the desktop PC. In a real-life cleaning scenario, such a high response time is not acceptable. Thus the BN parameter learning should not be performed on this embedded device during the cleaning process. The communication overhead of the web service in the client-server approach is just 35 ms for LAN connection. Based on the information from the industry partner this communication overhead should not be more than 4 sec for Internet connection in the cleaning vehicle. When the BN parameters are in the up to date form as stated above, the response time of the assistance system is ca. 400 ms (356 ms prediction time + 35 ms overhead) for LAN connection and 4.356 sec (356 ms prediction time + 4 sec overhead) for Internet connection. Thus, client-server approach enables successful realization of BN in the embedded device and also enables the real-time control of the cleaning processes. Fig. 5. Flowcharts of (a) standalone approach and (b)server in client-server approach

TABLE II.

C OMPUTING TIME ON BOARD AND ON PC

Solution approach

when new data is uploaded into the database. This web-service assures that the BN parameters are always in the up to date form and avoids BN parameter learning during the cleaning processes. When the server gets a request from client, another web-service just sends the updated BN parameters as HTTPresponse back to the client. In case the client do not have access to the server, it uses the knowledge base stored locally in the embedded device to predict the output variables. Thus, the assistance system can also function in scenario where the connection to the server is not available. We evaluated both exact inference (Junction tree) and approximate inference (Gibbs sampling) algorithms for prediction. Though Junction tree algorithm is faster (table II), we choose the Gibbs sampling algorithm because in most cases the Junction tree algorithm failed to predict the values of the rare classes whereas the Gibbs sampling algorithm in most cases predicted the values of the rare classes also. C. Real-time Realization As stated before, the notion of real-time in our case is 4-5 sec. It is also stated in literature that for a human machine system the response time for a request should not be more than 10 sec with respect to its usability [18]. Table II shows the BN parameter learning and the prediction time comparison for the standalone and the client-server approaches. We tested the standalone approach both in the PC and also in the board, i.e. the embedded device. BN parameter learning takes 9420 sec (ca. 2.5 hr) on the board and 285 sec (ca. 5 min)

Learning (sec)

Prediction (ms)

Standalone (board)

9420

356 (Gibbs) 254 (JTree)

Standalone (PC)

285

17 (Gibbs) 13 (JTree)

Client-Server (board+PC)

285

356 (Gibbs) 254 (JTree)

V.

R ESULTS

We performed random sampling on our dataset with 3200 rows and divided it into five equal subsets of 640 rows each. We used 4 subsets as training set and remaining 1 subset as test set. To evaluate the learning quality, we performed learning and predicting on the same training set. To evaluate the prediction quality, we learned from the training set and predicted the test set. The learning and predicting were performed five times, each time using a separate randomly sampled training and test sets. We then calculated the mean error rates for both training and test sets by comparing the predicted output variable values with their original values. The evaluation was performed on the statistical software ’R’ as well as on the demonstrator. The bayes algorithm was used for parameter learning in ’R’ and the em algorithm was used for parameter learning in the demonstrator. Figure 6 shows the mean training and test error rate plot for output variables N V , F P , N SO and N CC. The dark and light solid lines represent the mean training error rates in ’R’ and demonstrator while the dark and light dotted lines represent the mean test error rates in ’R’ and demonstrator respectively. The plot shows similar results for both ’R’ and the demonstrator. The difference between the training and test

error rates is higher in case of ’R’ than the demonstrator. In all cases the test error rates are higher than the training error rates except for the output variable N CC in demonstrator. It might be due to the imbalance in the class distribution of the variable N CC. The error rate in case of output variable N SO is higher as compared to other output variables. Given the low quality, i.e. very high noise, and imbalance in data, the results in overall look convincing and stable. So, the optimal cleaning parameters suggested by the assistance system will help even the inexperienced user to perform better cleaning. We plan to investigate the results further to improve the performance of the assistance system by tweaking the conditional probabilities using expert knowledge.

Fig. 6.

Mean training and test error rate plot

VI.

C ONCLUSION AND F UTURE W ORK

The paper presented an embedded implementation of Bayesian predictive assistance system (BPAS) for resource optimization that meets the real-time requirements of industrial cleaning processes. The proposed approach not only provides decision support for low skilled workers and optimizes the resource consumption but also prevents possible damage to the material being cleaned due to the use of excess water pressure during the cleaning process. The paper further presented performance evaluation using the statistical software ’R’ and a demonstrator implemented on an embedded device. The evaluation shows that the results are convincing and stable. Following approaches will be further investigated to improve the performance of the BPAS: •

The BN parameters learned from the data will be tweaked using the expert knowledge



The mathematical equations expressing the physical relations between the variables will be used to generate additional data for the variables which are discarded in the current version. The mathematical equations will be provided by our project partner as a part of the research project.

ACKNOWLEDGMENT This work was funded by the German Federal Ministry of Economics and Technology (BMWi) project Assistance System for Efficient Sewer Cleaning (AsK) under the grant number KF2448213KM3. R EFERENCES [1] D. N. Barton, S. Kuikka, O. Varis, L. Uusitalo, H. J. Henriksen, M. Borsuk, A. de la Hera, R. Farmani, S. Johnson, and J. D. Linnell, “Bayesian networks in environmental and resource management,” Integrated Environmental Assessment and Management, vol. 8, no. 3, pp. 418–429, 2012. [Online]. Available: http://dx.doi.org/10.1002/ieam. 1327 [2] R. Zhang and A. J. Bivens, “Comparing the use of bayesian networks and neural networks in response time modeling for service-oriented systems,” in Proceedings of the 2007 Workshop on SOCP. ACM, 2007, pp. 67–74. [3] V. Sylvain, T. Teodor, and K. Abdessamad, “Fault detection with bayesian network,” Frontiers in Robotics, Automation and Control, pp. 341–356, October 2008. [Online]. Available: Availablefrom:\url{http: //www.intechopen.com/books/frontiers in robotics automation and control/fault detection with bayesian network} [4] S. Xie, X. Peng, X. Zhong, and C. Liu, “Fault diagnosis of the satellite power system based on the bayesian network,” in Computer Science Education (ICCSE), 2013 8th International Conference on, April 2013, pp. 1004–1008. [5] M. Ashcroft, “Bayesian networks in business analytics,” in Computer Science and Information Systems (FedCSIS), 2012 Federated Conference on, Sept 2012, pp. 955–961. [6] E. Kita, M. Harada, and T. Mizuno, “Application of bayesian network to stock price prediction.” Artif. Intell. Research, vol. 1, no. 2, pp. 171–184, 2012. [Online]. Available: http://dblp.uni-trier.de/db/journals/ aires/aires1.html#KitaHM12 [7] O. Varis, “A belief network approach to optimization and parameter estimation: Application to resource and environmental management,” Artif. Intell., vol. 101, pp. 135–163, 1998. [8] SEEDS, “Self learning energy efficient buildings and open spaces,” http: //www.seeds-fp7.com, 2014, duration:09.2011 - 08.2014, Accessed: 28Juli-2014. [9] Z. Lian, Y. Jinsong, W. Jiuqin, and X. Wei, “Real time diagnosis with compiling bayesian networks,” in Industrial Electronics and Applications (ICIEA), 2011 6th IEEE Conference on, June 2011, pp. 542–546. [10] E. Reed, A. Ishihara, and O. Mengshoel, “Adaptive control of bayesian network computation,” in Resilient Control Systems (ISRCS), 2012 5th International Symposium on, Aug 2012, pp. 106–111. [11] F. T. Ramos, F. G. Cozman, and J. S. Ide, “Embedded bayesian networks: Anyspace, anytime probabilistic inference,” 2002. [12] K. B. Korb and A. E. Nicholson, Bayesian Artificial Inlligence. CRC Press, 2010. [13] K. Murphy, “Software packages for graphical models,” http://www. cs.ubc.ca/∼murphyk/Software/bnsoft.html, 2014, [Online; accessed 30July-2014]. [14] J. Mooij, “A free and open source c++ library for discrete approximate inference in graphical models,” https://staff.fnwi.uva.nl/j.m.mooij/ libDAI, 2012, [Online; accessed 30-July-2014]. [15] D. E. King, “A c++ machine learning library,” http://dlib.net/, 2014, [Online; accessed 30-July-2014]. [16] U. Pittsburgh, “Structural modeling, inference, and learning engine,” http://genie.sis.pitt.edu, 2014, [Online; accessed 30-July-2014]. [17] Microsoft, “Infer.net,” http://research.microsoft.com/en-us/um/ cambridge/projects/infernet, 2013, [Online; accessed 30-July-2014]. [18] J. Nielsen, Usability Engineering. Morgan Kaufmann; 1st. Edition, 1993.