{'fraction_non_alphanumeric': 0.027739624918167463, 'fraction_numerical': 0.0088186591017034, 'mean_word_length': 4.625243699906131, 'pattern_counts': {'":': 0, '<': 3, '<?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': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Machine Learning Models for Predictive Maintenance

The amount of goods produced and transported around the world each year increases and heavy-duty trucks are an important link in the logistic chain. To guarantee reliable delivery a high degree of availability is required, i.e., avoid standing by the road unable to continue the transport mission. Vehicle downtime can be reduced by replacing components based on statistics of previous failures. However, such an approach is both expensive due to the required frequent visits to a workshop and inefficient as many components from the vehicles in the fleet are still operational. A prognostic method, allowing for vehicle individualized maintenance plans, therefore poses a significant potential in the automotive field. The prognostic method estimates component degradation and remaining useful life based on recorded data and how the vehicle has been operated. Lead-acid batteries is a part of the electrical power system in a heavy-duty truck, primarily responsible for powering the starter motor, but also powering auxiliary units, e.g., cabin heating and kitchen equipment, which makes the battery a vital component for vehicle availability. Developing physical models of battery degradation is a difficult process which requires access to battery health sensing that is not available in the given study as well a detailed knowledge of battery chemistry. An alternative approach, considered in this work, is data-driven methods based on large amounts of logged data describing vehicle operation conditions. In the use-case studied, recorded data is not closely related to battery health which makes battery prognostic challenging. A main contribution of the thesis is development of machine learning models for predictive maintenance, estimating conditional reliability functions, using Random Survival Forests (RSF) and recurrent neural networks (RNN). An important property of the data is that for a specific vehicle there may be multiple data readouts, but also one single data readout which makes predictive modeling challenging and dealing with this situation is discussed for both RSF and neural networks models. Data quality is important when building data-driven models, and here the data is imbalanced since there are few battery failures relative to the number of vehicles. Further, the data includes many uninformative variables and among those that are informative, there are complex dependencies and correlation. A method for selecting which data features to use in the model in this situation is also a key contribution. When a point estimation of the conditional reliability functions is available, it is of interest to know how uncertain the estimate is as it allows to take quality of the prediction into account when deciding on maintenance actions. A theory for estimating the variance of the RSF predictor is another contribution in the thesis. To conclude, the results show that Long Short-Term Memory networks, which is a type of RNN, is the most suitable for the vehicle operational data and give the best performance among methods evaluated in the thesis.


Introduction
Predictive maintenance aims at estimating or predicting failure time of a system or its components based on experience, physical laws, or machine learning techniques and replacing the faulty components before failure, and as the result minimizing downtime of the systems. People were interested in predicting lifetime of various systems from the ancient times. For example, carts are used for transporting goods starting from the time when a wheel was invented. It is a very simple mechanical system, nevertheless, there are several components that can break such as an axle and a wheel which will lead to a failure or a stop. At that time, people used visual inspection and personal experience to decide if a particular part has to be replaced before a journey starts. Nowadays, technology has evolved, systems have become more complex, a lot of new systems have appeared and it is not possible anymore to use only visual assessment to reliably decide when one or another component will fail.
Intelligent, condition-based, maintenance, i.e., predictive maintenance, is an efficient and cost-effective tool to improve avail-1. Introduction ability and uptime in many industrial applications. Prognostics, given the current state of health of the system/component, predicts its state in the future and estimates the possible time of failure. The predictive model is a cornerstone in predictive maintenance.
Application of predictive maintenance and prognostic models to modern industrial systems range from electronics, aeronautical, automotive to industrial machinery and more applications are implemented every day. For example, authors in (Batzel and Swanson, 2009) presented a framework for predicting electrical failures in an aircraft power generator that allows to avoid unexpected failures and reduce expenses for system maintenance. Articles (Miao, Xie, Cui, Liang, and Pecht, 2013) and (Nuhic, Terzimehic, Soczka-Guth, Buchholz, and Dietmayer, 2013) introduce machine learning models to predict failures in Lithium-ion batteries where the investigations show that time of failures can be estimated reliably. Bearings are important components in mechanical systems and authors in (Ali, Chebel-Morello, Saidi, Malinowski, and Fnaiech, 2015) suggest a data-driven prognostic approach to accurately predict breakdown of the bearings to reduce maintenance cost of the mechanical systems. Predictive models for degradation in industrial applications can be integrated into new technologies, such as Internet of Things (IoT), that can improve the manufacturing process by increasing uptime of the plant infrastructure. For instance, opportunities and suggestions on how predictive models can be implemented together with IoT are described in (Kwon, Hodkiewicz, Fan, Shibutani, and Pecht, 2016).
Areas of significant current interest are autonomous systems and autonomous vehicles where the main aim is systems that can perform required tasks without any human supervision. For example, self-driving vehicles should deliver goods to customers or run autonomously at construction sites. Autonomous operation of dynamic systems with high uptime and safety requirements and no direct user feedback is a challenging task where predictive maintenance is important.

Predictive maintenance in transportation
Fast delivery of various goods is important to the world economy as the success of many businesses depend on it. According to Eurostat, a statistical office of the European Union (EU) situated in Luxembourg, the aggregated inland transport performance over EU is 2,438 billion tonne-kilometers in 2017 (Eurostat, 2017). A tonne-kilometer is a unit of measure which represents the transport of one tonne of goods over one kilometer. As can be seen, it is an enormous amount of goods being transported over one year only in the EU. Moreover, the share of road transport, longhaulage and distribution trucks, in the total amount of freight being transported in the EU is 51.5% if air and maritime transports are taken into account, and 76.7% when only inland freight transport is considered (Eurostat, 2017). Apart of delivering goods, heavy-duty vehicles are used, for example in mines and construction cites where they are a vital link in the production process. Therefore, it is important that vehicles have a high degree of availability and in particular avoid vehicle failures causing stops along the road and aborted transport missions. An unplanned stop by the road or at the construction site does not only cost due to the delay in delivery, but can also lead to damaged cargo or influence the work plan of other parts involved. Thus, maintenance planning becomes important in the automotive industry, in particular where car or truck manufactures do not only produce and deliver cars and trucks, but instead sell transports in tonne-kilometers.
In heavy-duty trucks, one cause of unplanned stops are failures in the electrical power system, and in particular, the leadacid starter battery. The main purpose of lead-acid batteries is to power the electrical starter motor that helps the diesel engine during engine starts. At the same time, the battery can also be used to power auxiliary units such heating system during cold periods of year and kitchen equipment, coffee maker and microwave, in long-haulage vehicles. In general, predicting degradation of a 1. Introduction component in a truck is a challenging task due to the fact that vehicles are operated in diverse operating conditions. This is also true for a lead-acid battery where degradation depends on temperature of the ambient environment, extreme values of temperature has negative impact on battery lifetime, number of vehicle starts or stops, distribution trucks performs many stops in a city, or on degradation of other components, for example if the generator overcharges the battery its lifetime decreases, etc.
Predictive maintenance and fault prognosis of lead-acid batteries is the topic of this thesis. It is an industrially relevant component and prognostics is technically challenging which motivates this research.

Lead-acid batteries
It can be a surprising fact, but the first batteries could exist as early as thousands years ago. One such battery was found in 1936 near Baghdad. It is not clear if the discovered object was used as a source of energy, but it has all elements needed to function as a battery. The battery was in the form of a clay jar and had an iron rod as positive terminal, a copper cylinder as negative terminal and probably a vinegar solution as electrolyte.
Considering modern batteries, there are many different types of batteries available, for example lead-acid, nickel-based, lithiumion, sodium-sulfur etc. This thesis concerns lead-acid batteries that are used in heavy-duty trucks. The main purpose of the battery is to power the starter motor to get the diesel engine running, but it is also used to, for example, power auxiliary units such as cabin heating and kitchen equipment. Fig. 1.1 shows one example of a lead-acid starter battery used in Scania heavy-duty trucks.
A schematic illustration of a lead-acid battery is given in Fig. 1.3. It consists of positive terminal, lead dioxide PbO 2 , negative terminal, lead Pb, and sulfuric acid H 2 SO 4 as electrolyte. Notice that the chemical representation given above is for a charged battery. During the battery discharge chemical processes change 1.2. Lead-acid batteries     components of the battery. For instance, in a fully discharged state, both positive and negative terminals of the battery become sulfate of lead PbSO 4 where the electrolyte transforms into primarily a water solution. In Fig. 1.3, the positive and negative terminals are represented with a single lead plate as in Fig. 1.2, however in practice the terminals are a pack of plates. The number of lead plates in the package depends on battery usage, for instance, terminals of batteries for deep discharge applications have a low number of thick plates, but for high peak current applications such as the batteries in heavy-duty trucks, the terminals consists of large number of thin plates.
This thesis concerns estimating the time of battery failure and main reasons for the lead-acid battery degradation, which can eventually cause a failure, are sulfation, corrosion, and internal short. Sulfation happens when the battery is not charged to its full charge value. For example, it is a common problem for trucks operated within cities as the battery is only charged by the generator while the vehicle is moving. In cities, there are many starts and stops, as a result the traveling distances and charging times are short. Corrosion appears due to high charge voltage which can happen if a vehicle is operated in a broad temperature range and if the charging procedure is not designed properly. Internal short is a type of a degradation that progresses during the lifetime when small parts of the lead from the plates accumulate at the bottom of the battery container which can lead to a conducting layer formation that connects two plates. Fig. 1.2 illustrates a healthy and a severely degraded positive plate from a lead-acid battery that are used in the trucks produced by Scania CV.

Prognostics
A basic notion in lifetime prognostics is Remaining Useful Life (RUL), which is either the remaining time until component failure or to the point where it can no longer fulfill its intended function as defined by engineers or component owners. In general, RUL is estimated using sensors that give health related information of the component, meaning, there is a possibility to track the state of health (SOH) related parameters during the lifetime of the component.
A procedure for using estimated and predicted SOH together with the RUL definition is shown in Fig. 1.4. The SOH can be a sensor measurement of a parameter that directly relates to the health of a system or it can be an entity that is derived using sensor measurements. For instance, an example of a SOH definition is given in (Kim, Lee, and Cho, 2011) where SOH of the lithium-ion batteries is a ratio of the battery resistances where R fresh and R aged are the specified battery resistances of a new and worn out battery respectively, and R current is a current battery resistance which is evaluated using impedance spectroscopy technique. The SOH takes values in range from 1 to 0 for this example where the value 1 indicates a new battery and the value 0 -totally worn out one. The SOH is estimated, for instance as in (1.1), and measurements up to the current time value are collected, see a black solid curve in Fig. 1.4. Then, a predictive model takes a sequence of estimated SOH values and makes a prediction for a particular number of time steps into future, denoted as the dashed curve in Fig. 1.4. An estimated time of failure is defined by intersection of the predicted SOH curve and the threshold as shown in Fig. 1.4, where the predictive model and the threshold value is determined using experimental data. The threshold value is not necessarily selected to predict failure time, but rather the time of component replacement which means that the threshold is set higher, deter-mined by the requirement for false alarm for instance, than the threshold selected for time of failure estimation.
The RUL is the time difference between the estimated time of failure or time of replacement and the current value of time as shown in Fig. 1.4. Main challenges in estimating RUL are lack of experimental data for building the predictive models, measurement noise, and varying operating conditions that are often hard to model. Therefore, when we talk about predicting the RUL of a component, it is necessary to estimate the uncertainty of the prediction. In Fig. 1.4 the uncertainties of the prediction at a probable time of failure are illustrated with the blue and green failure time probability density functions (PDF:s). Here, the uncertainties are shown only at time of failure, but they are generally estimated at every prediction time step. In the case of the blue PDF, a model is more certain about the prediction than in the case of the green PDF, i.e., it has heavier tails of the distribution. As a result, one should probably select a more conservative threshold, i.e., earlier component replacement, when the model is uncertain.
There are, coarsely, two main categories of approaches to lifetime prognostics, namely, model-based and data-driven methods (Roemer, Byington, Kacprzynski, and Vachtsevanos, 2005). Cornerstones of model-based methods are physical laws and equations that describe degradation of the components. However, accurate predictions by model-based methods rely on detailed degradation models. It is sometimes, and this is certainly true for the leadacid batteries, hard to develop an accurate degradation model for a particular system, and then the data-driven methods can be an alternative if reliability data is available, for example vehicle operational data in the case of lead-acid battery lifetime prognostics.
Examples of model-based prognostics are given in (Daigle and Goebel, 2011;Hanachi, Liu, Banerjee, Chen, and Koul, 2015;Saha and Goebel, 2009). The authors in (Daigle and Goebel, 2011) developed a detailed physics-based model of a pneumatic valve in a cryogenic refueling system and predicted the RUL of the component based on a discrete sequence of observations and a particle filter as a predictive technique. Prognostics and health management 1. Introduction of gas turbine engines is addressed in (Hanachi, Liu, Banerjee, Chen, and Koul, 2015) where a comprehensive nonlinear thermodynamic model is developed. In (Saha and Goebel, 2009) authors model li-ion battery capacity depletion in a particle filtering framework similar to (Daigle and Goebel, 2011). Here, an empirical model that describes battery depletion during a discharge cycles is suggested, then, it is used in a particle filter to predict the RUL. It is worth mentioning that these works have the possibility to either measure key parameters of the models during operation or at least during the period of tuning the model. However, and this is a key observation for the battery problem studied in this thesis, this is not the case for the data under study here.
Data-driven models use methods from statistics, machine learning, artificial intelligence, genetic algorithms and other fields to either estimate RUL, the health of the component, or prognostic related information, for example whether a component will fail in a specified period of time. Examples of different approaches can be found, for instance, in (Cheng and Titerington, 1994;Fan, Nowaczyk, and Rögnvaldsson, 2015;Ishwaran, Kogalur, Blackstone, and Lauer, 2008;Medjaher, Tobon-Mejia, and Zerhouni, 2012;Prytz, Nowaczyk, Rögnvaldsson, and Byttner, 2015). For example, an approach based on Hidden Markov Models is proposed in (Medjaher, Tobon-Mejia, and Zerhouni, 2012) to predict the degradation of bearings. There, it is assumed that the observation probability densities are a mixture of Gaussian densities and that there are signals from the sensors that can capture degradation of the bearings. Thus, data from the sensors can be used to estimate parameters of the distributions and as the result the RUL. In (Ishwaran, Kogalur, Blackstone, and Lauer, 2008) an ensemble or a collection of tree-based models, Random Survival Forest, method is presented that can be used for prognostic purposes. The method predicts probability of a component being operational at a particular time into the future and partitions data into groups where components have similar degradation profile. For the battery case, this corresponds to partitioning the set of vehicles into the subsets where the vehicles within a subset have similar battery degradation properties. Another non-linear ensemble tree-based method for regression and classification problems, called Random Forest, is used in a data-driven approach proposed by the authors in (Prytz, Nowaczyk, Rögnvaldsson, and Byttner, 2015) to plan maintenance workshop visits. The type of data set, which is available for the study in (Prytz, Nowaczyk, Rögnvaldsson, and Byttner, 2015), is similar to the data set used in this thesis, however, the vehicles from the study in (Prytz, Nowaczyk, Rögnvaldsson, and Byttner, 2015) have more frequent data readouts.
Nowadays, hybrid methods, a fusion of model-based and datadriven, are proposed. For example, in (Zhao, Tian, Bechhoefer, and Zeng, 2015) an integrated prognostic method is demonstrated that uses Paris' law Paris and Erdogan, 1963 as a degradation model (model-based approach) of a gear and Bayesian inference (data-driven approach) as the tool to address the changes in the physical model depending on operating conditions. To be effective, model-based methods require a deep understanding of the degradation process which leads to complex prognostic models. In turn, data-driven methods do not rely on physical laws, but require a large amount of experimental or sensor measurement data. Hybrid methods allow to find a compromise between the two approaches, i.e., to build less complex model-based methods and incorporate uncertainties with the help of data-driven approaches requiring less data than in a standalone data-driven model.

Scope and aim
The data under study in this thesis is mainly a collection of sensor measurements that are retrieved when a vehicle comes to a workshop for a maintenance visit. Data is irregular and nonequidistant, i.e., the number of maintenance visits vary from vehicle to vehicle together with the time between the workshop visits. For example, the maximum number of readouts per truck in the database is three. This is due to the fact that maintenance visits 1. Introduction are scheduled by the fleet owners. The visits are more frequent if there is a contract with Scania AB that reduces maintenance costs during a particular period of time, and the number of workshop visits can be less frequent if no such contract is offered. Thus, it is not possible to get a long and equidistant in time sequence of measurements per vehicle during battery lifetime and, in addition, there is no access to information directly related to the battery health.
Therefore, the main aim of the work is to develop a datadriven prognostic framework that can be applied primarily to the lifetime prognostics of lead-acid batteries in heavy-duty trucks. At the same time, the framework should be generic, i.e., be applicable to other components of a vehicle with similar data structure as in the given study. There are uncertainties in the data, for example a significant missing data rate and the fact that the failure dates of the batteries are known to happen within a time window, whereas the exact failure date is not always available.
Taking into account the uncertainties in the data, a conditional probability function is selected as the target function to estimate for the prognostic framework instead of RUL. The conditional probability function being estimated is the probability for a random variable T , the time of a battery failure, to be larger than t + t 0 time units given that the battery has survived t 0 time units. The time t 0 represents the time when making the prognosis, e.g., when visiting a workshop with a functioning battery. The conditional probability function is formally written as where V are the measurements from the vehicle retrieved at the workshop at time point t 0 . Examples of the lifetime functions B V (t; t 0 ) for batteries with different age are shown in Fig. 1.5. Similar to the RUL and SOH curve from Fig. 1.4 it is possible to set up a threshold, which has value 0.9 in Fig. 1.5, such that a crossing of the lifetime function with the threshold corresponds to the estimated time of battery 0 1 2 3 4 5 0.5 0.6 0.7 0.8 0.9 1 t 0 = 3.32 t 0 = 5.14 t 0 = 7.31 failure, denoted as time T 1 , T 2 and T 3 in the figure. Here, the battery that corresponds to the green lifetime function is replaced first and the battery associated with the blue curve is changed last. The replacement of the batteries in the given example is connected with the age of the vehicle, i.e., the battery is replaced first in the most driven vehicle. However, there are many other aspects that affect battery degradation. How to estimate the lifetime function with different machine learning methods and set up the threshold is described in the research papers. The scope of the work is defined by the research questions which are presented below. Correspondence between the RUL and the lifetime function B V (t; t 0 ) with some assumptions is given in (1.3) and the derivation of the relation is given in Chapter 3 in the form of Proposition 1. The lifetime function B V (t; t 0 ) is related to the expected RUL as (1.3)

Research questions
As mentioned in Section 1.4, the vehicle operational data is a collection of sparse and non-equidistant data readouts without access to the true degradation profiles of the batteries. This poses serious challenges for the predictive maintenance of the component, and how to develop and validate prognostic models is a major part of the thesis. Different machine learning methods are used in the thesis to estimate the lifetime function B V (t; t 0 ), for example, one of them is Random Survival Forest. As mentioned above, it is an ensemble tree-based method with main advantages such as: can be applied to the data without preprocessing and can be applied to the type of data where failures are only available for a small number of batteries, a reduced variance (property of the ensemble) compared to the single tree model.
The number of data readouts per vehicle is low, however the number of vehicles in the database is relatively large, here about 50,000. In this case, it is worth to investigate how neural and/or recurrent networks, that is capable of finding complex dependencies in data (model contains a large number of parameters), can be applied to the vehicle operational dataset.
It is common for the data-driven predictive models that the number of inputs to the model, i.e., variables, are large. Therefore, it is of interest to find and use only informative variables for the predictive model as this increases interpretability of the model and makes it simpler.
Sensor measurements that are retrieved from the vehicles are stored in the database in the form of histograms that accumulate measurements from the beginning of vehicle usage until the time of the maintenance visit to a workshop. This nature of the data is investigated in the thesis giving suggestions regarding the usage of this type of data in the predictive models.
Aforementioned directions in the thesis are summarized in the form of research questions and presented below.
1. How should a framework for predictive maintenance be constructed that is generic and handles infrequent and nonequidistant data readouts?
2. How informative variables for predictive models should be selected?
3. How to estimate a variance of a predictive model?
4. How to validate the models for predictive maintenance when the ground truth of the component degradation profile is not available?
5. How the accumulative nature of the data influence predictive models?

Contributions
The main contributions are summarized for each included paper. The first author in each paper contributed the majority of the research work and writing.

Published in Proceedings of the IFAC Symposium on Advances in Automotive Control, Norrköping, Sweden, 2016
The paper introduces a new method for identifying important variables for battery failure prognosis in the case of highly correlated feature space using Random Survival Forest model. The method is applied to the vehicle operational data which is given by an industrial partner Scania CV. There is large amount of data from trucks in operation, however, data is not closely related to battery health 1. Introduction which makes battery prognostic challenging. Identifying important variables and significantly reducing feature space helps data scientist to understand and interpret the process behind battery degradation in a better way compared to the case when all features are used. It is shown in the paper why the proposed method is applicable in the case of highly correlated feature space and the results of applying the method to the given dataset are compared to the existing methods such VIMP and minimal depth. Validity of the results from the proposed variable selection method is confirmed by generating prognostic model and analyzing its predictions.

Published in Proceedings of European Conference of the PHM Society, Bilbao, Spain, 2016
The paper is a continuation of the first paper on variable selection. The previous paper focuses more on the automotive application case study when the given work on method development. The decision space of the proposed method is augmented which leads to the reduced set of the important variables if compared to the one from the previous paper. At the same time reducing the set of important variables does not deteriorate prognostic performance. The advantages of the proposed method are highlighted and compared to VIMP and minimal depth method on the synthetic dataset.

Published in IEEE Transactions on Reliability 67.2 (2018), pp. 623-639
A data-driven method based on Random Survival Forest that estimates lifetime function instead of remaining usefull life is proposed for predicting the reliability of the batteries given that only one set of measurements per vehicle is available. Another contribution is a theory development of confidence bands for the Random Survival Forest model. The proposed approach for confidence estimation is an extension of an existing technique for variance estimation in the Random Forest method. Adding confidence bands to the RSF method gives an opportunity for an engineer to evaluate the confidence of the model prediction. Some aspects of the confidence bands are considered: their asymptotic behavior and usefulness in model selection. A problem of including time-related variables is addressed with the argument that why it is a good choice not to add them into the model. The approach is illustrated extensively using the real-life truck data case study.

Published in Proceedings of IEEE International Conference on Prognostics and Health Management, Seattle, USA, 2018
Predictive maintenance of lead-acid batteries using fully connected neural networks, i.e. multilayer perceptron models, is a topic of the paper. A battery maintenance planning method and predictive

Introduction
performance evaluation based on reliability and lifetime functions is one of the conributions of the paper. Models of the reliability functions in a case when information about their true shapes is not available are introduced with a reasoning why particular models give better performance than others. An improved loss function is introduced for a neural network that predicts reliability function. It is possible to satisfy monotonically decreasing condition of a reliability function with a help of the new loss function. A neural network architecture that handles imbalanced heterogenous data, i.e. a mixture of numerical and categorical variables, is suggested and performance of different neural networks is evaluated on the vehicle operational data.

Predictive maintenance of lead-acid batteries in the presence of sparse vehicle operational data Authors: Sergii Voronov, Mattias Krysander, and Erik Frisk
Submitted to a journal The paper presents a development of two methods which are based on Long Short-Term Memory (LSTM) network and Random Survival Forest (RSF) to estimate time of battery failures for sparse and non-equidistant vehicle operational data. The vehicle operational dataset is a collection of readouts of vehicle sensors during their visits to a workshop. The dataset has three characteristics: 1) there are no sensor measurements directly related to battery health, 2) the number of data readouts vary from one vehicle to another and 3) readouts are collected at different time periods. First, missing data is addressed by comparing different imputation approaches together with performance of multilayer perceptron and RSF models for the case of one data readout per vehicle. Second, RSF-and LSTM-based models are suggested for the case of sparse vehicle operational data with comparison of their per-

Thesis outline
The thesis has the following outline. Taking into account that the given work is inspired by the data that is available from the industrial partner, a reader is familiarized with the data in Chapter 2. Machine learning models are used to estimate the lifetime function of a battery and the theoretical basis required for understanding the material in the attached papers is given in Chapter 3 followed by the six research publications outlined in Section 1.6.

Vehicle operational data
For a data-driven approach, the available data is of key importance. The data used throughout the thesis is introduced in the current chapter and its distinctive characteristics are described. This thesis is part of a project that is carried out together with Scania CV, our industrial partner, and access to the data has been generously given by them.
Throughout the project we have had access to three versions of datasets that share common characteristics, but also have some differences such as the number of vehicles, dimensionality of the feature space, the amount of available information per vehicle, etc. All differences and similarities among the datasets are presented below. However, we begin the description with presenting the main common characteristics.

Data description
First, the data under study is either static, i.e., there is only one data readout of measurements for each vehicle, or it is sparse, i.e., with only a few non-equidistant in time data readouts per vehicle. Two out of the three datasets have static data, and only the last dataset contained several readouts for every vehicle. This means that it is not possible to track battery lifetime related measurements during a vehicle's lifetime and this greatly influences the method development process.
Another distinctive feature of the datasets is that the true underlying degradation profiles are not known. This means that, in addition to the lack of time series for a vehicle, it is not possible to compare a prediction of a model with a true degradation curve. This issue is addressed in the papers by carefully selecting and developing model validation techniques.
Another important characteristic of the datasets is the fact that a majority of the batteries did not experience a failure during the observation period. The situation is common in survival analysis (Cox and Oakes, 1984) where the entities that have time of event of interest outside observational period are called censored. It is possible to ignore censored batteries and build predictive models based on only failed cases. However, this introduces a bias to the failed batteries, i.e., an estimation of the battery life will be pessimistic which results in many batteries being replaced when they are operational, and results in wasting a lot of useful information from the censored batteries. How to deal with censored batteries is an important part of the method development in the thesis. The censoring rate, i.e., the fraction of censored batteries, varies between the datasets and respective values can be found in Table 2.1.
Every data readout, i.e., a single record in a dataset, is logged into a database when a vehicle visits a workshop and the truck is connected to a remote diagnostic system. There is static and time varying information in every readout. Static data is given in the form of discrete/categorical variables and represent specification of a vehicle, i.e., how it is assembled, for example engine model, battery mount position, if kitchen equipment is present and so on.
As an example, a battery position variable takes one out of three possible values: right, left mount point and rear frame position. Time-varying information from a readout is sensor measurements that are aggregated into histograms, Fig. 2.1, and retrieved at a workshop. Here, every bin in a histogram shows how a vehicle has been operated during the period up to the visit to the workshop when the data is collected. For example, for a battery voltage histogram in Fig. 2.1, each bin shows what fraction of time, given in per cents, out of the total operational time a vehicle has been operated in voltage range that corresponds to a particular bin. Notice that the bin values do not show the immediate value of the battery voltage, but rather an accumulated value during the lifetime of a component. Every bin of the histogram is treated as a separate variable and therefore the voltage histogram contributes with 10 variables to the dataset. Examples of other types of histograms that are encountered in the datasets are ambient temperature, fuel consumption, distance traveled between stops. There are also two dimensional histograms, for example a battery voltage vs temperature and engine speed vs load.
It should be noted that measurements directly related to battery health are not available. Consider the case of the voltage histogram where the logged voltage is the value right before the vehicle is switched on. The measured value of the voltage is not the open circuit voltage for many of the vehicles, because the bat-tery requires hours of relaxation time to get to the open circuit voltage and this does not happen for distribution trucks, for example, as they make many short stops in a city. In addition, the values of battery voltage are accumulated during the battery lifetime as mentioned above. As a result, the measurements that are available do not carry enough information to build a health index for a battery.
The rate of missing data in the data readouts in all datasets is significant, totaling to about 40%. Missing data is not uniformly distributed among the variables, i.e., particular variables can have much higher missing rate than others. Missing data is a common problem for databases in automotive industry. A main reason is that initially the databases were not developed for prognostic purposes. Therefore, the requirements for data collection are not well defined and it is common that there is no primary or foreign keys in the data tables and records are missing for several reasons.
There are two main reasons for missing data in the Scania CV databases. First, when a vehicle is connected to a remote diagnostic system at a workshop, errors can occur during the process of sending data from Electronic Control Unit (ECU), which is responsible for storing particular sensor measurements, to the database and data is not logged in properly. However, missing data due to the aforementioned reason is a minority of cases. The majority of missing data cases are caused by varying sensor installations on the vehicles. Different families of vehicles may have different sensor setups and it is possible that some sensor is not installed any more or vice versa, a new sensor is introduced. The problem of dealing with missing data is addressed in the research publications.
Three datasets that represent three versions of similar information are extracted from Scania CVs databases. The datasets have information from vehicles operating in 5 European markets: Sweden, Germany, Belgium, Netherlands and France. For example, the first data set contains 33,603 vehicles each with 284 variables in a data readout, while the latest dataset has data from 46,974 vehicles with 417 variables in a data readout.

Building the vehicle dataset
A first step before starting to use a dataset for building the predictive models, there are steps to be performed to extract information from either structured or unstructured databases and prepare data for the analysis. This is the case with the datasets summarized in Table 2.1 where three different sources were used. These three sources are three databases, here denoted: VehicleConfiguration database, VehicleOperation database and WorkshopInformation database. The VehicleConfiguration database provides information regarding assembling of a vehicle and this is a source of static information in each data readout. Histogram variables such as battery voltage or fuel consumption mentioned above are contained in VehicleOperation database. Information regarding battery repairs is logged into the WorkshopInformation database. Every database consists of set of tables and many of them contain information not relevant for the predictive maintenance. Therefore, the first stage is an exploration phase where key tables for the battery problem are identified in each database. Information from the three databases is joined using a unique vehicle identifier that can be accessed in some of the tables in the aforementioned databases. Thus, the next step in the data preparation process is to set a data observation period that provides vehicle identifiers of interest and limit the amount of data to be joined while merging information from several tables. A database for prognostic purposes of this kind can be rather big, e.g., gigabytes or even terabytes of data, and restricting the size of the population, at least during the initial exploration phase, is an important step. For example, the tables in the VehicleConfiguration database have tens of millions rows which is not a problem to work with in terms of consumed computational resources, however, the tables in the VehicleOperation database already contain tens of billions rows. Therefore, first extracting variables of interest and then limiting the result that corresponds to the target vehicles is inefficient in terms of computational time and memory.
When the vehicle population is defined by selecting identifiers that fall into a particular time period, sensor measurements from the VehicleOperation database can be extracted. Here, the records of values for every histogram and its bins are logged into the tables as rows, i.e., one column in a table has information about all histograms and their bins. However, one row in a dataset to be used in the machine learning models should contain measurements from all the histogram bins. Therefore, a process called pivoting is performed for the tables in the VehicleOperation database. Then, information from the tables in the VehicleConfiguration and the VehicleOperation databases is joined using vehicle identifiers that make a table with data readouts for every vehicle in the population.
The last step in data preparation process is to annotate the vehicles with failed and censored batteries using information in the WorkshopInformation database. If a component has failed and been replaced at a Scania CV workshop, a record in the Work-shopInformation database is made by a technician. Every component that is produced by Scania CV, or by a third party for Scania CV, has a unique identifier that can be used to find date and a vehicle number for which the component is replaced. In principle, this component identifier could be used to find dates of battery failures and the corresponding trucks. However, if a component is not produced by Scania CV, its identifier is not known and it is hard to find its failure. For the case of batteries, there are many battery manufactures on the market and many clients choose to install a battery that is not produced by Scania CV. This makes the use of battery identifies for finding failures insufficient as the significant amount of failures are missed. For instance, if the Scania CV battery identifier is used to find failures, this gives 20 times higher battery failure rate in the Swedish market compared to the French market. This indicates that a vast majority of clients chose to install non-Scania battery.
When a failed component is replaced at a workshop, a technician has to leave a short description of a problem or cause for replacement. This information is present in the WorkshopInformation database and is used instead of component identifier to find a battery failure. First, text description related to battery problems is aggregated using the component identifier. This shows how in five markets technicians record battery problems. Patterns for the regular expressions are constructed using key words from the component description. This gives new battery identifiers that are used to find broken battery cases. With such an approach, the battery failure rate in all markets is about 20% and do not vary as much as when only the Scania CV battery identifiers are used. This result adds credibility to the proposed approach, because failure rates may vary slightly from country to country but not as much as an order of magnitude. The text description for every failed case is examined and it is confirmed that identified cases are lead-acid battery failures. At the same time, there could be some missed batteries failures due to the fact that it was changed at the non-Scania workshop or the constructed regular expression rejects a record when it describes a battery failure.
Results of battery failure identification method is shared with Scania CV experts and they confirm credebility of the approach at this time. Finding broken batteries in the WorkshopInformation database requires more investigation and it could be a fruitful field for a research. However, the given work stops at this stage due to the resource and time limitation.

Theory
The chapter introduces necessary theoretical background and methods that are used. Machine learning models that are used to estimate probability of battery failure in the thesis rely on techniques from survival analysis. Therefore, it is introduced first followed by the machinery behind Random Forest (RF), Random Survival Forests (RSF), and neural networks. These are the machine learning models that are involved in estimation of probability of battery failure. One of the contributions in the thesis is uncertainty estimation of the RSF predictors. Therefore, a full derivation of the Infinitesimal Jackknife variance estimate for bagged predictors is given in the given chapter to prepare a reader for the further development in the one of the papers.

Survival analysis
Introduction of the survival analysis below is based on the book by Cox and Oakes, (1984). Survival analysis concerns the prediction of future events called failures for a group or groups of individuals.

Theory
The failure time is defined as either the time when end of life for the particular individual occurs or when the state of individual is such that execution of its intended task is no longer possible with the required quality. Example applications of survival analysis could be prediction of component failure times in a gas turbine, the survival times of patients in medicine or the prediction of economic crisis occurrence in economics.
A distinctive feature of survival analysis is the process called censoring. Usually, only a fraction of the individuals fail during trials or time of observation which means that the remaining part of the population do not experience failures, i.e., the failure times are censored. Typical data used for survival analysis is presented in Fig. 3.1 where the time of censoring is depicted with circles and time of failures with squares. Fig. 3.1 shows that 3 out of 7 individuals are censored and the method for prediction has to take this information into account. In general, if there is a random variable T i of failure time for the i th individual and a censoring time that is represented by a random variable c i , then the observed variable X i = min(T i , c i ) together with a response variable R i = 0 for censored and R i = 1 for failed individuals are the input data for a model. Survival analysis can be performed either by building models that use only survival time for prediction, i.e., the time when an individual experience a failure or is being censored, or model prediction that can rely on so called variables/covariates/features that explaining the health degradation of individual. For instance, a variable that shows how long a battery has been operated under low voltages or high temperatures can be used in a predictive method.
For a non-negative random variable T which represent time of failure the survival, or reliability, function is defined as (3.1) t 0 The function gives the probability that the failure time T does not occur before t time units. Usually, it is handy to work with the probability density function for the random variable T which is related to the reliability function R(t) as The functions in (3.1) and (3.2) are two different ways to characterize the distribution of the failure time T . Another special notion in survival analysis is the hazard function that defines probability of instantaneous failure as The hazard function plays an important role in survival analysis. The relationship between the reliability function and the hazard function can be seen by denoting the cumulative distribution func-

Theory
tion for the random variable T with F (t) and expanding (3.3) as Then the relation between the hazard and reliability functions is where H(t) is called the integrated or cumulative hazard rate. Two classes of methods are available when it comes to modelling the survival time T , parametric and non-parametric. The parametric methods assume a parametric distribution as a model for the random variable T , for instance exponential or log-normal. In turn, non-parametric methods do not make any such assumption, making use only of the observations. When one is confident in the underlying distribution of the survival times, then it is better to choose a parametric method since they will give a more accurate prediction compared to a non-parametric one and requires less data in the model estimation. However, if information about the survival time distribution is not known, non-parametric methods can be used. In the given study, non-parametric methods are chosen due to the fact that actual degradation profiles of the batteries are not known. Concepts introduced above such as the reliability function and hazard rate are defined for the case when the random variable T has a continuous distribution. In general, a discrete distribution is used in non-parametric methods. Therefore, let time points t 1 < t 2 < . . . < t n be the time points where either censoring or 3.1. Survival analysis failure occurs. Then, a non-parametric Kaplan-Meier estimator, (Kaplan and Meier, 1958), of the reliability function is given bŷ whereĥ j is maximum likelihood estimator of hazard rate h j defined at time point t j . The estimateĥ j is represented aŝ where d j is the number of failed cases at time point t j and r j = ∑ n i=j+1 (d i +c i ) is the number of available cases at time point t j with c i being the number of censored cases at time t i .
Greenwood's formula, (Cox and Oakes, 1984), is another tool which is often used in survival analysis. It estimates the variance of the reliability estimateR(t) under the assumption that (3.5) is efficient, i.e., reaches its Cramer-Rao bound and using a linearization approach, as follows . (3.7) The confidence bands with (1 − α)% confidence, under a Gaussian assumption, for the reliability estimatorR(t) are computed asR at each time point t where z α = −Φ −1 (α/2) is a quantile of the normal distribution with mean zero and unit variance being computed using cumulative density function Φ(x).
The Kaplan-Meier estimator and Greenwood's formula are useful tools to estimate the reliability and estimator variance if the classes of the individuals are known, i.e., classes of individuals with different degradation profiles. However, it is not the case for the data under study in the current work, therefore, one can not apply the aforementioned estimates directly.

Theory
Another concept from the survival analysis being used in the papers of the current work is the Nelson-Aalen estimator which is a non-parametric estimator of the cumulative hazard rate H(t). The estimate is written in terms of d j and r j aŝ and according to (3.4) it holds thatĤ(t) = − log (R(t)). Introduced concepts from the survival analysis will be used in the consecutive sections and form part of the theoretical basis of the given work.

Relation between RUL and lifetime function
A definition of the RUL and lifetime function B V (t; t 0 ) is given in Chapter 1. The relationship between this two concepts is demonstrated with (1.3) and formally summarized and derived in the result below.

Proposition 1. Let T be a continuous random variable that records time of a component failure with a density function f (t).
Assume also that a hazard function h(t) satisfies for some positive constant h 0 . Then, Proof. First, consider the product tP (T ≥ t) and express it using the hazard function h(t).
Thus, the hazard function assumption guarantees that the product tP (T ≥ t) → 0 when t → ∞. Then, it holds that which ends the proof.

Bagged predictors
In the selection of a suitable data-driven method for the studied battery prognostic problem the following needs to be taken into account. The underlying baseline hazard functions are not known in the data set and, in addition, it is not clear how to estimate the parameters in the case of a parametric model such as Cox regression, (Cox, 1972). Therefore, a non-parametric approach is chosen. Random Survival Forest (RSF), (Ishwaran, Kogalur, Blackstone, and Lauer, 2008), is a non-parametric method that gives the ability to handle different types of data, direct applicability of the method to survival analysis, and automatic missing data imputation. The output from the RSF model is an estimate 3. Theory of the reliability function which can be directly used for further analysis in this work. The basic idea of the RSF model is to group individuals with similar degradation profiles and estimate the reliability function for that particular group of individuals. Before Random Survival Forest is summarized, a brief introduction to basic classification and regression trees and Random Forest methods are given. Classification and regression trees are machine learning techniques that maps/predicts a feature or variable space X into a space of outcomes Y by means of binary trees (Breiman, Friedman, Olshen, and C., 1984) where the features and the outcome for a particular case are considered as a pair (x i , y i ). Target values y i from the outcome space could be continuous valued in case of regression and discrete in case of a classification problem. A decision tree is a non-linear estimator whereθ(x) is built by partitioning the feature space X, which can contain many features/variables, into disjoint regions R m with some fitting model for each region. For a regression problem the fitting model is a real value that fits data in a region R m best, for instance the mean, while for the classification the fitting value is, for example, the majority class among data points in the given region. An example of the aforementioned process is illustrated in Fig. 3.2 where the feature space X has two variables v 1 and v 2 and regions R 1 , R 2 and R 3 are formed in such way that green, blue and red classes are maximally separated, i.e., a region R i contains as few individuals from the minority classes as possible. The partitioning process happens at every node of the tree, see Fig. 3.3 where a structure of the ordinary classification and regression tree is presented. For a basic decision tree the best splitting variable and splitting value is determined in a greedy manner, namely, all variables and every possible splits are accessed based on a cost function. The split with the lowest value of the cost function is then selected. A tree node where a process of splitting stops is called a terminal node, nodes with s i variables in Fig. 3.3.

Bagged predictors
Splitting stops if either a selected minimal number of individuals in the node is reached or the tree has grown to the predetermined value of maximum depth. Decision trees can be applied to data sets with different types of variables and another advantage is interpretability as rules can be built from a single decision tree. A decision tree is, however, a weak classifier, (Hastie, Tibshirani, and Friedman, 2009), and generally performs well on the training data, however, they may generalize poorly on unseen data, i.e., have big variance of the predictor. Therefore, ensemble of trees, a Random Forest (RF) model, was introduced by Breiman, (2001). There are different implementations of ensemble of trees such as (Dietterich, 2000) and (Ho, 1998), however, the basic Breiman model is described here since the RSF model is an extension of RF. There are two techniques that are distinctive features of the RF method, namely, bootstrap aggregation, also known as bagging, and a step that reduces correlation between trees in the forest. When the number of data samples is small, bootstrap is a powerful method for estimating statistics of an estimator. By sampling from the given data samples with replacement one can construct a large set of new samples that can be used to estimate target statistics. Bootstrap aggregation is an ensemble method that combines predictions from different machine learning models. An example of bootstrapping and bootstrap aggregation is given next.

Example 1 (Bootstrap samples and bootstrap aggregation). This example will show what a bootstrap sample is and how the results
can be used to improve the properties of an estimator. Consider a sample (y 1 , . . . , y 5 ) obtained by sampling from the normal distribution with expected value 2 and variance 4. One possible set of samples is given below (y 1 , . . . , y 5 ) = (4.6918, 3.9905, 3.0924, −1.8254, 5.8425).
With a non-linear estimatorθ = θ(y), the results of the bootstrap estimatesθ i = θ(y i ) can be aggregated as

the number of bootstrap samples. This bootstrap aggregation can be very beneficial in some situations, for example in Random Forest models.
A basic use of using bootstrap samples to estimate variance of an estimator is illustrated in the next example.
Example 2 (Bootstrapping for variance estimation). This example will show an example how bootstrap samples can be used to estimate statistics of a specific estimator, in this case the variance of a standard estimator for the expected value. A main observation of the example is how the method is applicable to any statistics and without any assumptions on underlying distributions. Therefore, consider an independent set of samples (y 1 , . . . , y N ) from an unknown distribution. An expected value estimator is then Assume now that we want an estimate of the covariance of the estimateμ. In this case, since the estimator is simple and linear, the true variance of the estimator is varμ = 1 N σ 2 y (3.10) where σ 2 y is the variance of the data. The bootstrap approach, applicable to any non-linear estimator, is to generate a set of bootstrap samples y i i = 1, . . . , B and then apply the estimator on each bootstrap sample computingμ i . The variance estimate for the estimator is then

Theory
Consider the case where the sample y i are drawn from a uniform distribution between 0 and 1 and the number of samples N = 50. Fig. 3.4 shows how the bootstrap variance estimate compares to the theoretical value from (3.10) for different number of bootstrap samples B. It is clear that the bootstrap method can estimate the variance but with no assumption on linearity or knowledge on the underlying distribution.
In the case of a forest of trees, a number of sets of bootstrap samples are created and then a classification or regression tree model is fitted for each of the bootstrap samples. As mentioned, a single tree model is sensitive to unseen data, but by combing outputs from a set of trees, grown on different bootstrap samples, the resulting output has reduced variance of a predictor compared to the single tree model. In regression, the output from a bootstrap whereθ i (x) is a tree model fitted to the i th bootstrap sample, and B is the number of trees/bootstrap samples. It was suggested by Breiman, (2001) that introducing randomness into the procedure of choosing variables for splitting reduces correlation between trees and increase performance of the aggregated model. Therefore, instead of choosing all m available variables for split at each node, only a fraction p of them is considered. This step also increases speed of the algorithm as it requires less variables to check at each split. Structure of the random forest is presented in Fig. 3.5. A Random Survival Forest (RSF) model is an RF model modified for the purpose of survival analysis (Ishwaran, Kogalur, Blackstone, and Lauer, 2008). Structurally, an RSF model is similar to an RF except for the following changes. The cost function used for splitting is so called log-rank test (Ciampi, Thiffault, Nakache, and Asselain, 1986). It is a hypothesis test which compares survival distributions of samples that are formed by dividing data available at the splitting node into two samples which will be the part of the two child nodes. The best split corresponds to a variable with a value under which two samples have as distinctive degradation profiles as possible. The log-rank test is non-parametric and designed for censored data, a type of data encountered in survival analysis. At each terminal node, a node at which splitting no longer 3. Theory is performed, the Nelson-Aalen estimate (3.8) of the cumulative hazard rate is computed (Cox and Oakes, 1984). The estimated cumulative hazard rateĤ(t) of the whole forest is computed by averaging over tree hazard rates and, finally, the estimateR(t) of the reliability function is computed aŝ The estimateR(t) of the reliability function is the forest output.

Confidence estimate of a bagged predictor
This section describes the process behind finding Infinitesimal Jackknife (IJ) estimates of predictor variance for a bagged predictor and, then the explicit expressions for the variance estimates and bias are derived in the case of RF and RSF models. The results are available in the existing literature, but the complete derivation can not be found in any publication and are therefore included here. Assume a bagged predictor (3.11) that is complex, nonlinear, and deriving an exact expression for the estimation covariance is infeasible. Then, one option is to use a bootstrap technique. Since the estimator already uses bootstrap, a bootstrap strategy for estimating the variance would require to compute bootstrap of bootstraps which is not computationally feasible (Efron, 2014). Another approach is to use the original bootstrap samples and structure of the bagged model to estimate the variance of the predictor. One such procedure is the Infinitesimal Jackknife (IJ) variance estimate suggested by (Efron, Hastie, and Wager, 2014). The theoretical fundamentals are described, based on the works by Efron, Hastie, and Wager, (2014) and then extended to RSF models.
To summarize the results from (Efron, Hastie, and Wager, 2014), consider the i th bootstrap sample Y * i = (y * i1 , y * i2 , . . . , y * in ) which is sampled from the initial data set Y = (y 1 , y 2 , . . . , y n ) where y * ij represents the number of times a particular data point y j , a set of variables for the vehicle from the vehicle operational data introduced in Chapter 2, is included in bootstrap sample Y * i . Introduce a resampling vector as where p i denotes the probability of selecting y i in a bootstrap sample. This vector belongs to a set such that (3.14) The resampling vector represents the weight each data point y i in the initial sample Y = (y 1 , y 2 , . . . , y n ) has in the i th bootstrap sample. For example, the resampling vector P 0 = ( 1 n , . . . , 1 n ) is associated with an initial sample Y where each element of the sample has equal weight.
The distribution for the resampling vector P under the bootstrap procedure is a scaled multinominal distribution P ∼ Mult(n, P 0 ) n with mean and covariance matrices By definition, the variance ofθ BAGG is An expansion of the nonlinear estimatorθ BAGG using directional derivatives around resampling vector P 0 keeping only a linear term giveŝ

Theory
The column vector U consists of the directional derivatives U i defined as . . . , n (3.16) with δ i being the ith coordinate vector. Taking the expectation of (3.15), ignoring higher order terms, gives Thus, the variance ofθ BAGG becomes Now, let us show that the sum of all directional derivatives U i is 0. First, the gradient vector D is defined as Thus, the directional derivative U i can be expressed as From this follows that It is evident from (3.18) that the sum of U i is 0. Taking this result into account and using (3.17), the infinitesimal jackknife (IJ) variance estimateV IJ of the true variance var [θ BAGG ] of the bagged predictor isV To compute the variance estimator, we then need the directional derivatives. For a bagged estimatorθ BAGG , it turns out that there exists an explicit expression for the asymptotic, with respect to number of bootstrap samples B, expression of the directional derivatives. Now follows a derivation of the directional derivatives for an RF model.
Consider again a vector Y * = (y * 1 , y * 2 , . . . , y * n ) which represents the number of times a particular sample appears in the bag/bootstrap sample of a tree. The distribution of Y * is a multinomial Y * ∼ Mult(n, P 0 ).
Consider a forest with B = n n trees which corresponds to all possible samples. Then, the Random Forest estimatorθ RF (P ) could be written asθ where P (Y * ) is the probability of bootstrap sample under multinomial distribution, t * i is the output from the i th tree in the forest. We explicitly state that the Random Forest estimator depends on the resampling vector P associated with the bootstrap sample Y * .

Theory
Let P 0 (Y * i ) and P (Y * i ) denote the probability of a bootstrap sample under the multinomial distributions with P 0 and a general P respectively. Then, using the fact that under P 0 all bootstrap samples are equally probable A Taylor expansion of non-linear function A(ϵ) around 0 leads to Substituting the obtained result in the forest estimate from (3.22) gives usθ Noticing that under multinomial distribution with resampling vector P 0 forest estimator becomeŝ Let us show that the result for U j in (3.25) can be expressed as The vector Y * .j shows how many times j th individual appears in all bags. According to the distribution of vector Y * it holds that .j − 1] = 0. Taking into account that B = n n and every possible bootstrap combination is considered, it follows that Therefore, the directional derivative U j can be rewritten as Taking into account the last result we can write the estimate of variance ofθ RF asV (3.27) In general, estimators are biased and it would be great to take that into account. It turns out that for the RF model it is possible to find an estimate for the bias in an explicit form. To find a bias expression considerV IJ which is the perfect estimator when where Cov j means perfect covariance estimate of (3.27) when B → ∞. Thus, the bias of the estimator can be written as follows Assuming independence of y * ij and t * i , we have the following for the large enough samples, i.e., when n → ∞, Assuming that original sample Y is large enough and that t * i and y * ij are independent, (3.28) simplifies as (3.29) The random variable y * ij has the following properties Therefore, if it is assumed that size of sample n → ∞ and n tends to infinity faster than B, the bias becomes An improved unbiased estimator of var [θ RF ] using the results in (3.26) and (3.30) can then be written aŝ (3.31)

IJ variance estimate of the ratio of random variables
This subsection demonstrates the extension of the IJ variance estimate to the RSF model and lifetime function as in (1.2). The lifetime function could be expressed through the ratio of the reliability function estimates aŝ whereR V (t) = P (T ≥ t|V) is the output from the RSF model. There are two main differences between IJ variance estimate of the RF model compared to the variance estimate of the lifetime function B V (t, t 0 ). First, the output of the RF model is either a class or regression value, but in the RSF case the output function is time dependent, and secondly, the lifetime function is a ratio of the reliability estimates. For the first difference mentioned above, the reliability function is computed on the predefined grid of time points, the variance estimateV RSF Here, the reliabilityR V b (t) is the output reliability from the bth tree for a particular vehicle with data V andR V (t) is the output from the forest. These values correspond to t * b andt in (3.26) respectively. An unbiased IJ variance estimateV RSF IJ-U in analogy with Efron's estimate is then For the second property, the variance estimate for the lifetime functionB V (t, t 0 ), which is a ratio of the outputs of the random survival forest, is estimated and summarized in the next theorem.
Theorem 1. Let B V (t, t 0 ) be the battery lifetime function. Then t 0 ) and a first order IJ variance estimate is given by where the random variable X is the reliability functionR V (t + t 0 ) at time point t + t 0 and the random variable Y is the reliability functionR V (t 0 ) at time point t 0 and Result for the estimation of cov [X, Y ] is given in Lemma below.
Proof. As mentioned in (3.32) lifetime function can be expressed as ratio of the reliability functionsR V (t). Assume thatR V (t + t 0 ) is a random variable X andR V (t 0 ) is a random variable Y . Then, the variance of the lifetime function can be estimated using a Taylor series expansion as (3.36) where instead of µ X and µ Y the outputs from the forestR V (t+t 0 ) andR V (t 0 ) are used at time t+t 0 and t 0 respectively. The variances var [X] and var [Y ] correspond to IJ variance estimatesV RSF IJ-U (t) computed at time t + t 0 and t 0 respectively. Covariance cov [X, Y ] =ĉov [R V (t + t 0 ),R V (t 0 )] is a covariance between two random variables which are represented by the values of two points from the reliability curveR V (t) at time t + t 0 and t 0 .
The only missing part and the main contribution to the theorem is the derivation of cov [X, Y ] =ĉov [R V (t + t 0 ),R V (t 0 )] which is given in the next lemma. Lemma 1. LetR V (t) be an RSF model with B trees grown on the original sample Y = (y 1 , y 2 , . . . , y n ) with size n. Assume that the tree outputR V b (t) is independent from one data point y * ij from the ith bag, then an asymptotic expression of the infinitesimal jackknife estimate ofĉov [R V (t + t 0 ),R V (t 0 )] and its bias correction are as the sample size n → ∞, the number of trees B → ∞, and n tends to infinity faster than B.
Proof. Following the steps similar to derivation of variance estimate and its bias of the RF estimator formula (3.38) and (3.39) can be achieved. Full derivation is given in "Data-driven battery lifetime prediction and confidence estimation for heavy-duty trucks" paper, included as Paper C in this thesis.

Neural networks
Neural networks, similarly to Random Forests, are non-linear models that estimate relationships between input and target variables. When the amount of data is large and dependencies between variables are complicated, it is possible that neural networks perform better than a tree-based model. In a feedforward/fully connected neural network, the input layer is connected with hidden layers and an output layer by the means of weights (Hopfield, 1982). An example of a fully connected network is presented in Fig. 3.6. A fully connected network consists of layers that are connected by the weights W i . The layers in turn are comprised of nodes, i.e., circles in Fig. 3.6. The first layer in the network is called an input layer and it accepts a vector of variables x, i.e. x = (x 1 , x 2 , x 3 ) in Fig. 3.6. The rest of the layers in the network are called hidden where the last layer is an output layer, because it estimates the target variable y.
It can be seen in Fig. 3.6 that every hidden node in a hidden layer performs two data transformation operation with the input X 1 X 2 X 3 z 1 a 1 a 2 z 2 y = a 2 a 2 = f 2 (z 2 ) z 2 = W 2 a 1 a 1 = f 1 (z 1 ) z 1 = W 1 x x = (x 1 , x 2 , x 3 ) W 1 W 2 Fig. 3.6: Illustration of feedforward or fully connected neural network.
data. The first transformation is a linear weighting of the input variables, i.e., represented by two vectors z 1 = W 1 ⋅ x and z 2 = W 2 ⋅ a 1 in Fig. 3.6. Then, the result of linear transformation is fed into functions f i that are called activation functions (Goodfellow, Bengio, and Courville, 2016). In general, the activation functions are non-linear, except a case of a regression problem where the nodes in the last layer have a linear activation function. A nonlinear nature of the activation function allows a neural network to capture complex interdependencies between the variables, and if all activation functions are linear a neural network becomes a linear model. Three main choices of the activation functions that have been used in the past and are used today are: sigmoid, tangent hyperbolic and rectified linear unit (RELU). A sigmoid function is defined by RELU activation function is commonly used by neural network practitioners and that is due to two reasons. One is that it is easy to compute gradient of the function, i.e., it is 1 or 0, which is used during the training phase. The second reason is that the RELU function increase gradient propagation which is also needed during training.
Given the data and set of weights θ, for example (W 1 , W 2 ) in Fig. 3.6, we want to find such values of θ thus describe the observed data as well as possible and at the same time generalize well for unseen data. This is accomplished by minimizing a loss function L(θ; data) with respect to the weights θ following a backpropagation procedure (Rumelhart, Hinton, and Williams, 1986). For a regression problem, a mean squared error function, presented below, can in the simplest case be used where N is a size of data, y i andŷ i are a target and estimated by a neural network values respectively. In case a binary classification problem is considered, a loss function which is often used is the cross entropy loss There are other loss functions suggested in the scientific community for the different problems. It is not uncommon that a problem under study requires to develop a new loss function which is the case for the problem considered here. Procedure for training a neural network, i.e., finding the values of the weights that generalize well on the unseen data, is called  backpropagation. It is an algorithm of computing gradients of the loss function L(θ; data) with respect to the weights, W 1 and W 2 in Fig. 3.6, using a chain differentiation rule. When gradients of the loss function are computed with respect to the weights, iterative optimization algorithms are used to find updates of the weights, i.e., find a new value of the weights that explain the observed data better than with old values. A widely used algorithm is stochastic gradient descent (SGD) (Goodfellow, Bengio, and Courville, 2016), name comes from the fact that the gradient calculated using all dataset is approximated by the gradient that is found using only a small part of the data which is called mini-batch. A new value of the weights after processing one mini-batch in SGD method is as follows where η is a learning rate or a step size. As with loss functions, there are extensions and variants for SGD algorithm, for example, adaptive moment estimation (Adam) (Kingma and Ba, 2014). In this algorithm the weights updates depend on the values of the gradients and the second moments of the gradients from the previous iterations, where an influence of the past gradients on the weight updates is controlled by forget factors β 1 and β 2 . A procedure for the weight updates is formalized as where ϵ is a small number that is introduced to avoid computational issues, i.e., division by zero. Information in the fully connected neural networks is flowing only in the forward direction. This means that there are no connections between nodes from the current layer with themselves or to the previous layers. Long Short-Term Memory networks (Hochreiter and Schmidhuber, 1997) is a class of recurrent neural networks (RNN) (Goodfellow, Bengio, and Courville, 2016) that allow feedback connections. In the recurrent neural networks an output from a layer is fed back through a delay unit as shown in Fig. 3.7. RNNs are designed to work with sequential data such as translating text from one language to another, speech recognition, or analyzing frames in a video stream. Thus, this type of neural networks can be a good choice for a sparse and non-equidistant sequence of data readouts from a vehicle and the development and application of the RNN networks for the given data is a part of the thesis.
Training RNNs is in general difficult, in particular due to the problems of vanishing or exploding gradients when sequences of data are long or networks have many layers. LSTM networks mitigate these problems and the core building block is an LSTM cell with a schematic illustration shown in Fig. 3.8. As can be seen, the data from the previous layer x t and the previous time step h t−1 are inputs to the LSTM cell. Flow of information is controlled by three gates, input, forget, and output. Each of the gates has a sigmoid activation function layer, a regular layer as in feedforward networks, which take values in the interval between 0 and 1, and multiplied elementwise with the input data vector. Values that are close to zero indicate which parts of the data that is ignored during the current time step. Conversely, values close to 1 signify active parts of data for making prediction. The most important part of the LSTM cell is the forget gate in combination with internal state s t . The current internal state is memorized and is multiplied with the forget gate at the next time step. The interesting step happens when the result of filtering an internal state through the forget gate is combined with the result of filtering input data through the input gate. It can be seen that the results are combined by summation which is an important part in tackling vanishing gradients problem. The formula