# Towards an Assembly Support System with Dynamic Bayesian Network
## 3 Next Assembly Step Prediction through Dynamic Bayesian Network
### The DBN as a Prediction Model  
A Bayesian network, known also as a belief or causal network, is a probabilistic graphical method that models variables together with their conditional dependencies using a directed acyclic graph (DAG). These networks are ideal for predicting the likelihood of known factors that contributed to the occurrence of an event. If we consider the variables \(A,\ B,\ C,\ D\), we can factor their joint probability \(P(A,\ B,\ C,\ D)\) as a product of conditional probabilities, such that:  
\[P(A,\ B,\ C,\ D)=P(A)\cdot P(B|A)\cdot P(C|A,\ B)\cdot P(D|A,\ B,\ C) \tag{1}\]  
Figure 1: The assembled product from front, back, and perspective. The factorization of variables \(A,\ B,\ C,\ D\) in Equation (1) does not provide any relevant information related to the joint probability distribution because each variable can depend on every other variable [33]. \[P(A,\ B,\ C,\ D)=P(A)\cdot P(B)\cdot P(C|A)\cdot P(D|B,\ C) \tag{2}\]  
If we are considering the factorization in Equation (2), some conditional independent variables can be observed [33]. According to the theory of probability, two random variables (events) \(X\) and \(Y\) are conditionally independent given a third event \(Z\) if, knowing that \(Z\) will occur, event \(Y\) will not be influenced by the occurrence of event \(X\) and event \(X\) will not be influenced by the occurrence of event \(Y\). Mathematically explained, \(X\) is independent of \(Y\) given \(Z\) if \(P(X,\ Y|Z)=P(X|Z)\cdot P(Y|Z)\). From the factorization (Equation (2)), we can show that, given the events \(B\) and \(C\), the events \(A\) and \(D\) are independent of each other. \[P(A,D|B,C)=\frac{P(A,B,C,D)}{P(B,C)}=\frac{P(A)\cdot P(C|A)\cdot P(D|B,C)}{P(C) }=P(A|C)\cdot P(D|B,C) \tag{3}\]  
A Bayesian network can be used to represent the factorization of the joint distribution and, for each random variable, there is a node associated with it in the network. A directed edge is drawn from a node \(X\) to another node \(Y\), if \(Y\) is conditioned on \(X\). Figure 2 is a representation of the above factorization (Equation (2)). Usually, a Bayesian network is built based on existing knowledge about the conditional independence of the variables and a dataset of observations. From the used dataset, we were able to identify variables that might influence the assembly steps. In our case, we have five independent variables that were identified to influence the assembly state. Figure 3 presents our five variables and their conditional dependencies. Node \(H\) represents the height of the user, node \(G\) its gender, node \(S\) its sleep quality, node \(E\) if it wears eyeglasses, and node \(M\) the mood. All these five nodes represent binary variables that, for height, represent tall/small; for gender, male/female; for sleep quality, good/bad; for wearing glasses, true/false; and, for the mood, positive/negative. Node \(A_{t}\) is the assembly state of the product at time \(t\), which is directly dependent on the other five variables. This model is not useful for us to describe the assembly process due to the temporal nature of the assembly. Figure 4 represents a Bayesian network that considers the evolution in time of both the user's mood and the assembly state of the tablet. Thus, the current assembly state directly depends on the human characteristics and on the previous assembly state, respectively. Figure 3: A Bayesian network with the five variables that influence the next assembly step. Figure 2: A directed acyclic graph (DAG) representing the factorization (Equation (2)). The Bayesian networks that can model the sequences, considering the time factor and the evolution of variables through it, are known as DBN and are also called temporal Bayesian networks. A DBN connects variables to each other over adjacent time steps. The DBN can also be considered a two-time-slice Bayesian network (2 TBN) since, at any given time, a variable's value can be computed using the internal regressors and the actual variable's value at time \(t-1\).