{'fraction_non_alphanumeric': 0.03202746365105008, 'fraction_numerical': 0.005775444264943457, 'mean_word_length': 5.005578462284744, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Predictive Maintenance for Edge-Based Sensor Networks: A Deep Reinforcement Learning Approach

Failure of mission-critical equipment interrupts production and results in monetary loss. The risk of unplanned equipment downtime can be minimized through Predictive Maintenance of revenue generating assets to ensure optimal performance and safe operation of equipment. However, the increased sensorization of the equipment generates a data deluge, and existing machine-learning based predictive model alone becomes inadequate for timely equipment condition predictions. In this paper, a model-free Deep Reinforcement Learning algorithm is proposed for predictive equipment maintenance from an equipment-based sensor network context. Within each equipment, a sensor device aggregates raw sensor data, and the equipment health status is analyzed for anomalous events. Unlike traditional black-box regression models, the proposed algorithm self-learns an optimal maintenance policy and provides actionable recommendation for each equipment. Our experimental results demonstrate the potential for broader range of equipment maintenance applications as an automatic learning framework.


I. INTRODUCTION
Equipment downtime is generally defined as the outage time that accumulates whenever production process stops and current world class standards for downtime is ≤10% [1]. Despite the rapid technological advances and increasing equipment complexity, frequent occurrence of equipment downtime remains and often results in monetary loss. Maintenance teams are given limited maintenance budgets and face tremendous cost pressure to ensure that the production line is always operational. In an event of an unplanned equipment fault, the corrective maintenance option is performed to bring the failed equipment up to its operational status to meet the product delivery deadline. Forward looking companies employ preventive maintenance to reduce the likelihood of unplanned equipment downtime through scheduled upkeep of production equipment condition. Although the long-term goal of reducing overall maintenance costs has been touted, manufacturing productivity is slightly improved at the expense of higher maintenance cost. Predictive maintenance is overall considered more efficient (i.e manpower and cost) and equipment downtime is minimized because maintenance is only performed based on the real-time condition of an equipment.
As industries worldwide journey towards the Industry 4.0 vision to boost manufacturing productivity, modern equipments become increasingly complex and requires longer maintenance time. Admist a manpower lean economy that is driven by productivity, one of the key challenges resides in the latent demand to simplify the complexity of machine sensor data interpretation for predictive maintenance purposes. Traditional black-box regression models are feature-engineered towards domain-specific applications, and solution extensibility to similar applications and feature updates request are costly shortterm endeavours. Deep Learning (DL) have recently been proposed as an alternative for estimation of remaining useful life of equipment [2]- [4] and ball bearings [5], [6]. Similar work has also been reported in [7] to learn the health indicators for the remaining useful life estimation of a turbofan engine by using Temporal Difference (TD) learning. However, these approaches are only concerned about accurate estimation of the equipment's remaining operational uptime and lack meaningful insights to support the maintenance team's decisionmaking process. Common reasons can be attributed to the fact that explicit models of real-world problems are largely unknown or too complex to accurately model with traditional model-based approaches. In this work, we propose a modelfree Deep Reinforcement Learning (DRL) algorithm approach to self-learn optimal maintenance decision policies, from the health state of an equipment, more importantly with actionable recommendation.
Increased pressure on margins, higher customer expectations and the declining cost of cloud computing are enticing factors for manufacturers to stay competitive. Conversely, both manufacturing and equipment-maker companies remain security averse to transmitting sensitive production sensor data to the cloud, via unreliable internet connections, and any adoption is generally reserved only for companies with deep pockets [8]. An alternative approach is to utilize a locally interconnected sensor network of equipment. In our proposed system model, each equipment is equipped with sensor-based edge computing devices [9], which can share data and communicate with other edge devices or equipment. Overall benefits of adopting this approach includes time-efficient decisionmaking process, a responsive yet data informed maintenance support team and reduction in network traffic across the factory shopfloor IT infrastructure.
In summary, the contributions of this paper are as follows: 1) Problem formulation of maximizing equipment runtime as a function of multiple sensor data input. The decision-policy is obtained by using the model-free DRL approach.
2) The DRL algorithm offers recommendation support for the replacement policy of an equipment with easy-tounderstand data-driven recommendations via an Equipment Health Indicator status. 3) Despite random initial health states and an absent ground truth, the proposed DRL algorithm tackles the sparsely-dense reward maintenance problem with almost consistent recommendations across similar datasets and equipment.

II. SYSTEM MODEL
Consider the application of a sensor network for the purpose of equipment health monitoring, either through retrofitting or in-situ configuration. Our proposed system model resembles a Star Topology network at the Equipment level, see Figure 1. From the current configuration, the aggregated data can be propagated to a larger Sensor Network, such as tree or mesh topology configurations, for more complex data analysis. Typical network components include Sensor Nodes (SN) and a Sensor Gateway (SG), also known as Base Station. Please note that the terms Base Station and SG are used interchangeably.  Figure 1. Concurrent streaming of raw sensor data is known to consume high network bandwidth and degrades overall network performance. To mitigate network congestion scenario, SG-based data aggregation and processing at the SG node is proposed. The SG node is assumed to be always powered with adequate computation and storage capabilities. Next, sensor data analysis will be performed using batch processing (i.e time-frame comprising of fixed time-step duration) of sensor data for memory and computation efficiency purposes. Without loss of generality and for ease of presentation, a pair of SG and SN is assumed.
Data analysis is performed on window size with K timesteps and the output of the prediction are three maintenance action: Repair, Replace and Hold. Hold is the default action where SG predicts a low probability of imminent failure to occur. In the event that an anomalous sensor reading is observed with high certainty, the SG node has to decide which of the two recommendations, Replace or Repair, should be provided to the maintenance team -mirroring real-life decision-making. In practice, the Repair action is almost certainly executed given the busy schedule and maintenance budget constraints.
III. PROBLEM FORMULATION In our system model, the challenge is to maximize the total run-time of the equipment with maintenance budget constraints. The objective function is described in (1) as Maximum Equipment UpTime (ρ) and is cast into a Markov Decision Process (MDP) framework with fully observable states. MDP is formally described as a 5-tuple consisting of state (S), action (A), probabilistic distribution of state transitions (P), reward function (R) and discount factor (γ). Mathematically, the tuple can be compactly denoted as (S, A, P, R, γ).
Given a sensor network, the generated sensor data is denoted as x i t , where i ∈ {0, 1, . . . , Z} at every time-step (t). From (1), N represents the number of SN devices within the considered sensor network, and N = 1 is assumed. The sensor data is then discretized and simplified in (2). Then, we generalize the state space of each sensor node in (3).
For every equipment or sensor manufactured, the manufacturers specify the Mean-Time-Between-Failure (MTBF) and operating temperature information in the technical datasheet. Due to the elasticity of environmental temperature, the equipment's degradation rate and state change is inadvertently nonsequential. In this work, we consider the sensor state changes to be initially sequential with decreasing trend over finite timesteps. For example, assume the probability of state change increases as operating temperature increases. Eventually, an obvious temperature mode change occurs, and the rate of sensor degradation decays exponentially with respect to time, described in (4). Within the current operating temperature mode, the sensor's state change would skip multiple states to reflect corresponding temperature changes. The observed state change behavior is known to mirror a concave exponential decay trend with respect to equipment run-time. When the transition probability of the state-action pair is considered, a pseudo health indicator is derived and shown to vary according to increasing failure probability, see Figure 3. Notably, the health degradation trend clearly illustrates inverse correlation to the increasing sensor state values and is aligned with the proposed system model.
To model the environmental state (S τ ), we consider and simplify the operating temperature conditions (τ ) into a binary form with conditional constraints, see (5). To be clear, units of τ is in degree Celsius while Low and High operating temperatures are binarily represented.
The resultant state space for our system model is summarized as the Cartesian product: Next, the model's action space is encoded as a vector of scalar actions: Replace( ), Repair(η) and Hold(κ). Let us assume that a maintenance account (β) is credited to the maintenance agent. κ represents the agent's default action and the associated maintenance cost is zero. As the equipment state (i.e. sensor health values) starts degrading, the frequency and cost of repairs will gradually increase with time before increasing exponentially. Hence, the agent is tasked to decide the appropriate sequence of actions to perform at each state as described in (7). To mimic maintenance decision-making process, the imposed cost constraints (C) ensures that the agent derives a sensible maintenance policy where β is not violated within the given time frame.
For model simplification purposes, consider a single equipment with N = 1 sensor attached. Given observable state changes and transitions, the agent can select random actions to perform. resets the sensor's operational state to an almost new condition while η seemingly reverts the sensor's operational state by y Repair states, to a previously observed sensor state. In addition, we consider that not all repairs are identical and the sensor state change φ(S), will vary according to the RepairType(ψ), where ψ ∈ {0, 1, ..., M }. From Figure 2, η is invoked at S t = y − 1 and the selected type of repair invokes a state transition from S t = y to S t = y − |φ(S)|. A compact representation of the behaviour is described in (8). The Reward function is formally described as R(s t , a t , s t+1 ). From the previous derivations, R can be re-interpreted as the cumulative sum of the sensor runtime with respect to state S and action A. An immediate reward function R t ∈ R is proposed in Equation 9 to guide the agent's actions: For example, executing either y Replace or y Repair action, within the β constraints, will offer the agent an arbitrary high health points for performing Replace (R Rpl ) and Repair (R Rpa ) actions respectively. Conversely, the agent is heavily penalized if either κ is performed throughout the episode or when the sensor state is zero (R Pen ). Real-world applications have sparse rewards and motivating the agent to explore is very challenging. In this paper, R Exp value is arbitrarily defined to intrinsically motivate the agent to explore the environment. To increase the probability of sparse state visitation, where potentially high rewards are found, a proposed ranking mechanism is proposed and described in Section IV-B. R Frug reward is also defined to encourage the agent to execute the corresponding action optimally, mimicking human decision-making.
Next, the state-value function (V π (s)) is expressed as: Then, we utilize the standard RL framework to obtain the optimal policy (π * ). The Markov property is applied on (10) and the value function is simplified and re-expressed as: where α denotes the learning rate of the agent; γ ∈ [0, 1] is the discount factor where the agent performs tradeoff between the observed immediate and potential future reward. The max operator selects the highest-valued state-action pair that consequently assists in the derivation of the optimal policy.
Many real-world problems have very large state space, which makes it infeasible to compute and learn all exact stateaction transition values. Instead, an approximated estimate of the state-action value pair can be learned using Temporal Difference (TD) learning. As TD learning process resembles a stochastic gradient descent, the updated Q-value is denoted as Q S i t , A t ; θ t towards a target value of y Q t in (12).
In coupling a multi-layered neural network, a Deep Q-Network (DQN), with experience replay and target network (y DQN t ), performance of the algorithm is vastly improved and achieved fairly good generalization performance [10]. The target network is a copy of the original Q-network and parameter synchronization occurs every τ steps, such that θ − t = θ t , and is represented in (13).

A. Double Deep Q Learning
DQN's inherent tendency for value overestimation and biased estimates are caused by random environment noise and arg max operator respectively. Double Deep Q-Learning (DDQN) was then proposed [11] to stabilize vanilla DQN algorithm by decoupling the choice and evaluation of best action on two separate networks. In this work, the DDQN inputs contain a tuple of sensor data (x i t ) at every time-step and random action is performed by the DDQN agent. The DDQN's target network generates an output of Q-values and is denoted as: where a * = arg max Q (s t+1 , A; θ t ). The discounted Q-value (y DoubleDQN t ) is taken from the target network with weights θ − t and the target network weights (θ − t ) are periodically copied from the Q-value network. In particular, the agent's performed actions are extracted from the primary Q-value network and the future reward evaluation step is taken from the Q-target network.

B. Prioritized Experience Replay
The DRL agent is expected to infer an optimal point from the system model or dataset from the reward constraints. With reference to Figure 3, the equipment replacement point is likely to occur further into the equipment operational cycle as failure probability increases exponentially. Likewise within the DRL context, the sparsely-dense-like reward configuration and the likelihood of performing either R Rpl or R Rpa , is higher towards the end of the equipment's operational cycle. The gained intuition suggests a normalized equipment health state value of 0.2 to be the target optimal value.
Although the traditional combination of -greedy algorithm with Experience Replay (ER) Buffer technique is well-known, the ER Buffer has a bias to repeatedly sample the same highlyrewarding experiences and is ill-posed for a sparse-reward problem, typical of real-world applications. Moreover, the decay rate of value over the training set is a hyperparameter and an inefficient approach given varying Time-to-Failure cycles for each equipment. For the mentioned problems, Prioritized Experience Replay (PER) [12] is the proposed component to compliment DDQN.
PER is considered to be an enhancement over ER, and it prioritizes the experiences which offers large differences between prediction and the Temporal Difference (TD) target value. Implicitly, the DRL agent can use the TD error magnitude as an indicator to better focus its attention on the least visited states which could yield potentially larger rewards.
The magnitude of the TD error (|δ i |) can be incorporated into the ER buffer sample as a tuple (s t , a t , r t , s t+1 , |δ i |). To minimize over-fitting problem in the ER method, stochastic prioritization [12] is introduced to generate a probability P (i), of a selected state-action pair, from the replay buffer, see (15). p i denotes the priority value of the i-th sample in the buffer and α is a hyperparameter that is used to induce randomness within the experience selection for the replay buffer. Pure uniform randomness is denoted by α = 0 while α = 1 emphasizes experiences with the highest priorities; k denotes the normalization of all priority values within the Replay Buffer.
During training of the neural network, the experiences sampled must match the underlying distribution with priority sampling, resulting in a bias towards high-priority samples. The weights of frequently seen samples, within the replay buffer, are then adjusted using Importance Sampling Weights (IS) with the effect of reducing bias. From (16), N denotes the Replay Buffer size; P (i) denotes the sampling probability from (15); b is considered a weighting factor to control the degree in which IS affects the learning process and is annealed up to 1 over the duration of training phase. Readers may refer to [12] for additional details on PER.

C. Parameter Noise
Exploration inefficiency of Reinforcement Learning (RL) is a well-known problem and becomes more challenging when applied on a sparse reward problem. Existing RL approach influences the action space policy at each time-step with no influence on the RL agent's decision policy (i.e neural network). Evolution strategies seek to manipulate the decision policy parameters during each rollout and no influence is exerted on the action space policy. Parameter Noise (PN) [13] is a technique which strikes an in-between balance of the aforementioned approaches with encouraging results for both on-policy and off-policy algorithms. To explain, PN randomly alters the parameters of the RL agent's decisions which introduces a more consistent exploration behaviour and a less confused RL agent. In this work, PN is introduced to improve exploration efficiency for the RL agents for the sparsely-dense reward problem at hand and the pseudocode for the proposed algorithm, Prioritized DDQN-PN Parameter Noise (PDDQN-PN) algorithm is described in Algorithm 1.

A. Dataset
The NASA Commercial Modular Aero-Propulsion System Simulation dataset (C-MAPSS) [14] is widely used in literature and is selected to test our model. The data set is generated from Turbofan Engine Degradation Simulator and contains measurements which mimics the degradation behaviour of multiple turbofan engines under various operating Algorithm 1 Prioritized Double Deep Q-Learning with Parameter Noise (PDDQN-PN) 1: Input: Action space A, mini-batch size L b , target network replacement frequency L − 2: Output: Optimal policy π * 3: Initialize: Prioritized Experience Replay Memory D priority to capacity N , Primary network Q θ , target network Q θ , action-value function Q with random weights, target action-value functionQ with weights θ − =θ 4: for Episode=1 to E do 5: for timestep=1 to T do 6: Observe state s t and select a t ∼ π (a, s) 7: With probability , perform random action 8: Otherwise, choose a t = argmax a Q(s t , a) from Q(s, a; θ); 9: Execute a t and receive reward r t 10: Observe next state s 11: Store tuple (s t , a t , r t , s ) in D with max priority 12: Sample random mini-batch transitions, size (L b ), from D priority , according to transition priority 13: y DDQN t = r, if episode terminates at timestep+1 r + γmax a Q (φ j+1 , a , θ − ), else 14: Perform Gradient Descent on (y DQN t −Q(s t , a t )) 2 and update priority of each transition 15: Reset θ − =θ every L − steps

B. Data Preparation
Individual sensor values have been normalized for each sensor type (i.e sensor data column): where µ i and σ denotes the mean value and standard deviation for the sensor types respectively. x i denotes the i-th sensor value within the corresponding sensor type dataset. Remaining Useful Life (RUL) calculation is then appended to the normalized data and linear regression is performed.
Once the sensor parameters are identified, an RUL distribution graph is plotted and a Gaussian distribution was observed for all data. Sensor data is then dimensionally reduced using principal component analysis and the equipment health indicator is obtained. In the absence of ground truth for equipment health values, [14] suggested that the degradation behaviour should resemble an exponential decay function like model: where d denotes the non-zero initial degradation, and a and b are weighted coefficients. Similar degradation behaviour was observed for turbofan equipment health indicator dataset, see Figure 5. Note that in the absence of a ground truth for both repair and replacement action, only the replacement action is tested and a medium-criticality equipment is assumed.

C. Results
PDDQN-PN was implemented using Tensorflow based deep learning library [15] and Adam optimizer was selected. 5000 time-steps of warm-up was performed to fill the agent's memory, using random policy, before commencing actual training. To balance between exploration and exploitation, the exploration fraction was set to 80% of the number of training simulation time-steps. In order to demonstrate the benefits of the proposed algorithm, separate tests were conducted on engine #76 sensor data from FD001. As a result, the learning performance contribution factor of each sub-component is clearly illustrated. PER component significantly contributed to the DRL agent's ability to learn an optimal policy within 1.2 × 10 4 time-steps and a mean cumulative reward score of 95. Once stacked with parameter action noise, a notable 50% improvement in learning efficiency is clearly observed with a performance loss of 10%. From Figure 4, it is likely that the mean score for both DDQN-PER and PDDQN-PN will converge given longer simulation time-steps and reduction in exploration time. DDQN-Vanilla performed marginally worse than a random policy given the sparse-reward problem and the results are illustrated in Figure 4. For improved readability, Exponential Mean Average (EMA) smoothing factor of 0.18 was performed on the reported results.
The model prediction method is used to quantify and analyze the DRL agent's learnt decision policy. The prediction results in Table II   Part of the validation process involves random selection of Engine Health Indicators from both the training and test dataset with results presented in Figure 5. The DRL agent is able to propose a suitable replacement policy, even when the starting point indicates steep downward trend approaching imminent equipment failure, see Figure 5c. This is due to the failure-to-failure penalty constraint R Pen in (9). Likewise, the DRL agent demonstrated encouragingly consistent recommended actions, on different engine and dataset. The proposed replacement points are highlighted in Figure 5. As industries worldwide journey towards the Industry 4.0 vision to boost manufacturing productivity, modern equipments become increasingly complex to perform maintenance on. The result is an increased customer demand for accurate, interpretable and actionable insights from predictive maintenance tools. In this paper, we have introduced an approach to provide actionable recommendation, based on an equipment's health state. We have formulated the maximization of equipment uptime as a function of multiple input sensor data and model the derived equipment health states with state-action pair. The optimal states are observed in a sparsely-dense configuration and is challenging to solve with existing approaches. Then, we have proposed a model-free-based Deep Reinforcement Learning algorithm which can rapidly learn an optimal maintenance decision policy, for example within 2000 time-steps. The experimental results have shown consistent maintenance recommendations across similar equipment, despite different initial health state. Future work could include extending current work to other equipment failure dataset and benchmark against an actual equipment maintenance policy schedule.