scieee AI-readable full text Open interactive document viewer

Study and extension of kernel functions for missing value treatment

Hernández Potiomkin, Yaroslav

Full text

Technical University of Catalonia Barcelona School of Informatics Study and extension of kernel functions for missing value treatment Author: Yaroslav Hern´andez Potiomkin Supervisor: Llu´ıs A. Belanche Mu˜noz January 20, 2015 Contents 1 Introduction 2 2 Planification, methodology and alternatives 4 3 Preliminaries 6 3.1 Sparse Kernel Machines . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.2 Kernelfunctions ............................. 8 3.3 Kernel density estimation (non parametric) . . . . . . . . . . . . . . 9 4 The missing value problem 11 5 Kernel extension 14 5.1 RBF (SVM kernel) - Gaussian (KDE kernel) . . . . . . . . . . . . . 14 5.2 RBF (SVM kernel) - Epanechnikov (KDE kernel). . . . . . . . . . . 15 5.3 Polynomial (SVM kernel) - Gaussian (KDE kernel) . . . . . . . . . . 18 6 Implementation 20 7 Experimentation 22 7.1 Datasets ................................. 22 7.2 Training.................................. 24 7.2.1 Training for extended kernels . . . . . . . . . . . . . . . . . . 24 7.2.2 Training for imputed data sets . . . . . . . . . . . . . . . . . 24 7.3 Test .................................... 25 7.4 Statistical study of the error rates . . . . . . . . . . . . . . . . . . . 25 7.4.1 Confidence interval definition . . . . . . . . . . . . . . . . . . 25 7.4.2 Paired t-test definition . . . . . . . . . . . . . . . . . . . . . . 25 8 Results 27 8.1 Results for the synthetic-data data set . . . . . . . . . . . . . . . . . 27 8.2 Results for the real-data data set . . . . . . . . . . . . . . . . . . . . 29 8.3 Discussion................................. 29 9 Conclusions and future work 31 10 Annex 32 10.1 RBF (SVM kernel) - Gaussian (KDE kernel) . . . . . . . . . . . . . 32 10.2 RBF (SVM kernel) - Epanechnikov (KDE kernel) . . . . . . . . . . . 35 10.3 Polynomial (SVM kernel) - Gaussian (KDE kernel) . . . . . . . . . . 40 10.4 Solutions for the used integrals . . . . . . . . . . . . . . . . . . . . . 42 11 References 47 1 1 Introduction Modern modelling problems are difficult for a number of reasons, including the challenge of dealing with a significant amount of missing information. Kernel methods have won great popularity as a reliable machine learning tool; in particular, Support Vector Machines (SVMs) are kernel-based methods that are used for tasks such as classification and regression, among others [13]. The kernel function is a very flexible container under which to express knowledge about the problem as well as to capture the meaningful relations in input space. Some classical modelling methods –like Na¨ıve Bayes and CART decision trees– are able to deal with missing values without any preprocessing step. However, the process of optimizing an SVM assumes that the training data set is complete. The main goal of this work is to study kernel functions and extend them in such a way that the kernel-based methods, mentioned above, are able to handle data sets with missing values directly. There is a very big range of possibilities when talking about types of kernel functions. We had selected the most important ones, as they are widely used and by this reason their extension may become a very useful and practical approach for the missing value problem. The extensions are then compared with other methods through statistical analysis and observing their behaviour ob the different scenarios, for instance, varying the rate of missing information or examining their performance on a real data set problem. The data sets with missing information appear in many applications and studies, as biological indicators or social source surveys and many others. In addition, when working with kernel methods, these do not accept incomplete data sets and thus, an imputation procedure is then necessary but often leads to a very complex solutions due to the missingness mechanism that will be discussed later. So, an extension to kernel functions becomes a very interesting alternative. This study is based on previous work [2, 5] which handles missing values in kernel methods by extending kernel functions. There are several methods that use kernel functions, but here the learning method corresponds to Support Vector Machines (SVMs). The work had been divided in several parts:  Study of related literature and knowledge acquisition  Analytical kernel function extension  Implementation  Experimentation  Analysis of the results Several SVM kernel functions and KDE basis functions had been proposed for the 2 analysis. After the extension, and careful implementation, the methods had been compared, including imputation models. Finally, several results had been presented and future work discussion. 3 2 Planification, methodology and alternatives The planification have been followed as strict as possible. The working phase consisted in several iterative steps, composed by  Analyses  Extension  Validation  Implementation  Experimentation The duration of each iteration has been incremented from the beginning of the semester due to: Analytical mistakes detected during the implementation Computational efficiency Finally, the main goals were achieved. The most important kernel functions were analyzed and extended. In the following figure can be seen the final Gantt diagram that matches the whole work performed during the realization of this sudy. Figure 1: Final Gantt diagram. Regarding the methodology, the programming languages that have been used are: Maple, Matlab, R and C++. The first two have been used to deal with symbolic expressions and for test purposes. R deals with data and training parts. C++ is used uniquely to compute the Gram matrix (expleined later) 4 The R scripts perform the following tasks:  Dataset generation  Parameter estimation  Model training  Presentation of results Matlab is used for numerical computing and results checking. Regarding the error detection and analyses of alternatives, the computation performance had to be reviewed and a new programming language was introduced (C++). Additionally, the parameter estimation had to be reviewed. The choice of the best solution was based on the analyses of the bottleneck in the extended methods computation. 5 3 Preliminaries In this chapter we will develop the theoretical foundations of the methods used in this work. First, we will start introducing the SVM method. Later on, we will define and present several kernel functions and finally we will talk about the missing value problem and its solutions. 3.1 Sparse Kernel Machines The algorithms based on kernel functions that determine sparse solution, are such that the evaluation of this kernel functions is done only over a small subset of the training dataset. The parameters of the SVM (Support Vector Machine) model are found through the optimization of a quadratic function subject to certain conditions, a set of linear inequations. Thus, the optimum is always found. Let D={(x1, t1), ..., (xN, tN)}the dataset to be separated, where xn∈Rdand tn∈ {−1,1}. Linear model for two classes: y(x) = wTϕ(x) + w0(1) Regarding maximum margin separators, the OHS (optimum hiperplane separator) is such that defines the largest margin. γ= max w,w0 min 1≤n≤Nm(xn) where m(x) = t(wTϕ(x)+w0) ∥w∥, the distance from the point to the separator and wTϕ(x)+w0is the separator. Is forced that min xn|wTϕ(xn)+w0|= 1 with n= 1÷N. The support vectors, by definition, are such that xnwhere tn(wTxn+w0) = 1. Then, the margin to be maximized is γ=1 ∥w∥, that is equivalent to minimize ∥w∥2 2; that is to say, the optimization problem is the following: min w,w0 ∥w∥2 2 that, at the same time, is subject to a set of conditions of the form: tn(wTϕ(xn) + w0)≥1 with n= 1 ÷N. In order to solve this optimization problem with the corresponding conditions, is convenient to introduce Lagrange multipliers of the form an≥0 with n= 1 ÷N, that results in a Lagrangian function: 6 L(w, w0,a) = ∥w∥2 2− N ∑ n=1 an{tn(wTϕ(xn) + w0)−1} where the sign (−) is due to the fact that the conditions that been multiplied by (−1), minimizing with respect to wand w0and maximizing with respect to a. Derivative with respect to wand w0is obtained: w= N ∑ n=1 antnϕ(xn) and 0 = N ∑ n=1 antn So substituiting in the Lagrangian function it gives dual representation of the maximum margin separator problem: ˜ L(a) = N ∑ n=1 an−1 2 N ∑ n=1 N ∑ m=1 anamtntmk(xn,xm) where the kernel function is defined as k(x,x′) = ϕ(x)Tϕ(x′). Substituiting these results in the equation (1) is obtained: y(x) = N ∑ n=1 antnk(x,xn) + w0 Using the support vector properties xn, that satisfy tny(xn) = 1 and using the previous expression it gives: tn(∑ m∈S amtmk(xn,xm) + w0)= 1 where Sis the set of indexes that correspond to support vectors. Multiplying by tn both sides it results in: w0=1 NS∑ n∈S(tn−∑ m∈S amtmk(xn,xm)) 7 where NSis the total number of support vectors. In the practice, when classes distributions overlap it can lead to a bad model generalization. For this reason is convenient to modify support vector machine so that it allows some data points to be missclassified. Therefore slack variables are introduced. They representthe penalties for the missclassified points. In this way, the data points that are inside or just over the boundary have ξn= 0, those that are on the decision boundary ξn= 1, ξn>1 for the points that are missclassified and ξn=|tn−y(xn)|for the rest. The following conditions arise: tny(xn)≥1−ξn with ξn≥0 and n= 1 ÷N. This environment is sensitive to the outliers, as the penalty for the missclassified points is incremented linerly with ξ. Thus, the objective becomes to maximize the margin and penalize softly the points that lie on the wrong side of the boundary of the margin. The expression to be minimized is as follows: C· N ∑ n=1 ξn+∥w∥2 2 where ∑N n=1 ξnis the upper bound of the number of missclassified points and the parameter C > 0 (cost constant) controls the balance between the slack variables penalty and the margin; that is to say, establishes the control of minimizing training data error and the model complexity. When C→ ∞ the margin decreases and can over-fit, otherwise if C→0 the margin increases and the generalization is better, but it can lead to under-fitting. Usually, is sorted out by k-fold cross-validation. The Lagrangian form is: L(w, w0,a) = ∥w∥2 2+C· N ∑ n=1 ξn− N ∑ n=1 an{tny(xn)−1 + ξn}− N ∑ n=1 µnξn The dual representation is obtained in similar way as in the previous case, but without slack variables. Actually, the model y(xn) has the same appearance in both cases, but the Lagrangian multipliers, for example, are now subject to 0 ≤an≤C with n= 1 ÷N. Other conditions are added too [12]. 3.2 Kernel functions By definition, a function that returns the inner product between the images of two inputs in some feature space is known as a kernel function. 8 where ωj=   1 (n−mj)√2h2 jπ∑n i=1 i/∈Mj δif xjis missing exp (−1 2σ2 j(xj−yj)2)if xj,yjare not missings with δ= exp (−a(σ2 jx2 ij +h2 jy2 j h2 j+σ2 j)+ab2)√π a,a=h2 j+σ2 j 2h2 jσ2 j and b=h2 jy+σ2 jxij h2 j+σ2 j . The extension for the case four has the form: ˆ k(x,y) = d ∏ j=1 ωj where ωj=   1 2(n−mj)2h2 j√a√a′∑n k=1 k/∈Mj∑n i=1 i/∈Mj δif xj,yjare missings exp (−1 2σ2 j(xj−yj)2)if xj,yjare not missings with δ= exp (a′b′2−y2 kj h2 j+y2 kj σ2 j+x2 ij h2 j 2h2 j(h2 j+σ2 j)),a′=2σ2 jh2 j+σ4 j 2h2 jσ2 j(h2 j+σ2 j)and b′=ykj σ2 jh2 j+ykj σ4 j+σ2 jh2 jxij 2σ2 jh2 j+σ4 j . Please, notice that aand bhave the same definition as in the case two. For complete development, please check the section 10.1. 5.2 RBF (SVM kernel) - Epanechnikov (KDE kernel). The kernel RBF is the same as in 5.1. The Epanechnikov KDE base function has the form: ˆp(x) = d ∏ j=1 3 4hjn n ∑ i=1 (1−(xij −xj hj)2)I xij −xj hj≤1 The extension for the case two has the form: ˆ k(x,y) = d ∏ j=1 ωj where ωj=   3 4hj(n−mj)∑n i=1 i/∈Mj Iif xjis missing exp (−1 2σ2 j(xj−yj)2)if xj,yjare not missings 15 with I21 =x2 ij h2 j[√π 2√aerf ((x−y)√a)]b c I22 =2xij h2 j[−1 2aexp(−a(x−y)2) + y√π 2√aerf ((x−y)√a)]b c I23 =1 h2 j[√π 4√a3erf ((x−y)√a)−x 2aexp(−a(x−y)2) −y 2aexp(−a(x−y)2) + y2√π 2√aerf ((x−y)√a)]b c and a=1 2σ2 j ,c=xij −hjand b=xij +hj, such that I2=I21 −I22 +I23 and I=I1−I2. The extension for the case four has the form: ˆ k(x,y) = d ∏ j=1 ωj where ωj=     (3 4hj(n−mj))2∑n k=1 k/∈Mj∑n i=1 i/∈Mj Iif xj,yjare missings exp (−1 2σ2 j(xj−yj)2)if xj,yjare not missings with I1=[[h2 j√π−y2 kj√π 2h2 j√a∫erf ((x−y)√a)dy −√π 2h2 j√a(∫y2erf((x−y)√a)dy −2ykj ∫yerf ((x−y)√a)dy)]d e]b c 16 I2=[[x2 ij√π 2h2 j√a∫erf ((x−y)√a)dy −2xij h2 j(√π 2√a∫yerf ((x−y)√a)dy −1 2a∫exp(−a(x−y)2)dy) +1 h2 j(√π 4√a3∫erf ((x−y)√a)dy −x 2a∫exp(−a(x−y)2)dy −1 2a∫yexp(−a(x−y)2)dy +√π 2√a∫y2erf ((x−y)√a)dy)]d e]b c I31 =(xijykj)2 h4 j[[√π 2√a∫erf ((x−y)√a)dy]d e]b c I32 =−2x2 ijykj h4 j[[√π 2√a∫yerf ((x−y)√a)dy]d e]b c I33 =x2 ij h4 j[[√π 2√a∫y2erf ((x−y)√a)dy]d e]b c I34 =−2xijy2 kj h4 j[[σj√π √2∫yerf ((x−y)√a)dy −σ2 j∫exp(−a(x−y)2)dy]d e]b c I35 =4xijykj h4 j[[σj√π √2∫y2erf ((x−y)√a)dy −σ2 j∫yexp(−a(x−y)2)dy]d e]b c I36 =−2xij h4 j[[σj√π √2∫y3erf ((x−y)√a)dy −σ2 j∫y2exp(−a(x−y)2)dy]d e]b c 17 I37 =y2 kj h4 j[[√π 4√a3∫erf ((x−y)√a)dy −x 2a∫exp(−a(x−y)2)dy −1 2a∫yexp(−a(x−y)2)dy +√π 2√a∫y2erf ((x−y)√a)dy]d e]b c I38 =−2ykj h4 j[[√π 4√a3∫yerf ((x−y)√a)dy −x 2a∫yexp(−a(x−y)2)dy −1 2a∫y2exp(−a(x−y)2)dy +√π 2√a∫y3erf ((x−y)√a)dy]d e]b c I39 =1 h4 j[[√π 4√a3∫y2erf ((x−y)√a)dy −x 2a∫y2exp(−a(x−y)2)dy −1 2a∫y3exp(−a(x−y)2)dy +√π 2√a∫y4erf ((x−y)√a)dy]d e]b c and a=1 2σ2 j ,e=ykj −hj,d=ykj +hj,c=xij −hjand b=xij +hj, such that I3=I31 +I32 +I33 +I34 +I35 +I36 +I37 +I38 +I39 and I=I1−I2+I3 For complete development, please check the section 10.2. 5.3 Polynomial (SVM kernel) - Gaussian (KDE kernel) The Polynomial kernel has the form: k(x,y) = (⟨x,y⟩)g= g ∏ j=1 ( d ∑ ij=0 xijyij)= d ∑ i1=0 · d ∑ i2=0 ··· d ∑ ig=0 (xi1yi1·xi2yi2···xigyig) where gis the degree of the polynomial and x0=y0=√bwith b≥0 (the constant term of the polynomial). The gaussian KDE base function is the same as in 5.1. The extension is of the form: ˆ k(x,y) = [d ∑ i=0 κi]g 18 where κi={Iyiif yiis missings yi·ωiotherwise and ωi={Ixiif xiis missings xiotherwise with Iyi=ωi 1 (n−mi) n ∑ k=1 k/∈Mi yki Ixi=1 (n−mi) n ∑ k=1 k/∈Mi xki where miis the number of missings in the i-th variable and Mi={i′:i′∈ {1..n},xi′iis a missing}. For complete development, please check the section 10.3. 19 6 Implementation Regarding the computational complexity, the solution for the SVM approach can be found in polynomial time. Thus, following a good programming practices the algorithm is straightforward. However, as it is described below, the choice of the programming language and different techniques were crucial in order to achieve good performance results, as some polynomial time algorithms may take days or even weeks to be computed. All the kernel methods must compute a Gram matrix, that is the metrics matrix of the space of the data. Is a positive semi-definite symmetric matrix [13]. Its computation is the most time-consuming part when training an SVM model. It needed much effort to achieve good time performance. The first goal was to implement the solution carefully, programming small scripts or functions ensuring this way their correctness by separate. That is to say, fulfilling the basic rule of modular programming. The first attempt was to implement using symbolic calculus provided by Matlab. As this approach was too much time-consuming, several optimization have been done (please see the figure below): Figure 2: Execution time improvement in Matlab (50 ×2 data set). where each cumulative optimization step (xlabel) means: 1. No optimization done 2. Partial loop vectorization 3. Complete loop vectorization 4. By reference mode of passing variables 5. Use of variables instead of symbolic expressions 20 6. Use of erf approximation [3] with three correct decimals After measuring the time consumption of every function (extension case), the bottleneck turned out to be the 4-th case, as it was expected. In the latest optimization (erf approximation) the execution time had been reduced from 0.46s to 0.35s, and for big datasets it was not noticeable. Finally, the decision was to implement this part in C++ and also to precalculate the 4-th case. These improvements have made the execution time to be very reasonable. 21 7 Experimentation In this chapter we will perform an experimental study of the extended methods performance against other imputation methods. Thus we have kernel extensions that are (for more details please check the section 5): 1. RBF (SVM) - Gaussian (KDE) 2. RBF (SVM) - Epanechnikov (KDE) 3. Polynomial (SVM) - Gaussian (KDE) And the imputation methods are: 1. MICE (Multivariate Imputation by Chained Equations) [15] - RBF (SVM) 2. Mean imputation - RBF (SVM) Therefore, two data sets had been provided. One of them consisted of artificially generated data, while the second one was based on a real data [4]. The first and the third extensions are assuming normal distribution of the data, as they integrate the Gaussian KDE basis function. MICE constructs a very complex models and its performance is expected to be good in any situation. By the contrary, Mean imputation is a very simple and straightforward way of univariate imputation. The goal of this study is to see the effect of the missing value rate on the methods (mentioned above) performance and also to check the stability of the extended methods; that is to say, RBF - Gaussian extension should perform better than RBF - Epanechnikov on the synthetic data set (this will be discussed later). Moreover, the real-data data set allows us to compare the accuracy of the methods objectively. 7.1 Data sets The artificial data set was generated from the gaussian distribution with the following parameters: µ1= (0,0) µ2= (3,3) Σ1=Σ2=(2 0 0 2) where the subindex 1 is for the class +1 and the subindex 2 is for the class −1. Training set size corresponds to n= 200. The test set is generated only once and it consists of 500 examples. The number of variables is two (without label) for 2-D representation purposes. 22 The missings are added randomly over the whole training and test data sets, thus the missing-data mechanism corresponds to MCAR. In order to perform more accurate and complete study, the training sets are sampled 10 times and the rate of missings ranges from 0% to 80% by steps of 10% for each of these sets. The real data problem is a much studied dataset and represents a complex classification problem, in which a population of Pima Indian women living near Phoenix, Arizona, was tested for diabetes according to World Health Organization criteria. The dataset contains 768 examples, 500 meaning negative conditions for diabetes (class 1) and 268 showing positive conditions of diabetes (class 2). Each example contains 8 attributes plus the class label. In this data set, most of the variables show impossible zero values (e.g, the diastolic blood pressure), which are actually missing values. A more exhaustive analysis have been done, as can be seen in the table 1. Pregnancies Pedigree Age Plasma BMI Blood Skin Serum 392 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 140 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 4 1 1 1 0 1 1 1 0 2 2 1 1 1 1 1 0 1 0 2 192 1 1 1 1 1 1 0 0 2 1 1 1 1 1 0 1 1 0 2 26 1 1 1 1 1 0 0 0 3 2 1 1 1 1 0 1 0 0 3 7 1 1 1 1 0 0 0 0 4 0 0 0 5 11 35 227 374 652 Table 1: This table shows how the missings are distributed over the data set. It turns out that only 392 out of the 768 observations are unaffected by missing values. There are 51% of rows with missing values for which only Skin (Triceps skin fold thickness in mm) and Serum (2-Hour serum insulin in mu U/ml) are missing. In fact, this variables have the biggest proportion of missingnes through all the observations (30% and 49% respectively). The third less observed variable is the Blood (Diastolic blood pressure mm Hg) with 5%. Thus, the conclusion is that Skin and Serum are critical. In 37% of rows with missings only Serum is not informed. 3 and 4 variables are not informed in 7% and 2% of rows with missings respectively. The total proportion of missing values is ≈10.6% against 48.9% of rows with missing values. 23 After this analysis it seems to be obvious that this difference is due to the high concentration of missings in the two critical variables, Skin and Serum. 7.2 Training The training for extended kernel approach and imputation methods differs completely, as in the first case a Gram matrix is precomputed and in the second case it does ksvm() itself. 7.2.1 Training for extended kernels For each kernel extension the corresponding training Gram matrix had been computed, that is, only over the training examples. There are three parameters to take into account, that are bandwidth KDE parameter, σRBF kernel parameter (where it appears as γ=1 2σ2) and polynomial degree and offset parameters for Polynomial kernel. The first one is inherent to kernel extension and is estimated with density() [7], giving as parameters bandwidth smoothing and kernel or window basis function (Gaussian and Epanechnikov have been proposed in this work). The rest of parameters are so called hyperparameters and, usually, are tuned by means of k-fold cross-validation technique, that is explained below. In this work and for computational purposes the σRBF kernel parameter had been estimated over training data set with sigest() [9] from kernlab package and the polynomial degree parameter was set by k-fold cross-validation, the offset was set to 1 by default. For the regularization parameter C−cost k-fold cross-validation method had been applied. 7.2.2 Training for imputed data sets In the case of imputed data is slightly different. The model is trained with RBF predefined kernel. For this purpose, the imputation must be performed against both sets (training and test), but separately. For the case of MICE imputation, the parameters are the number of imputations for each missing (5 by default) and predictor matrix, that describes the relation between the variables, thus only some of the variables might be used for the imputation of another variable. For example, the diagonal is zero, as no variable predicts itself. For the case of Mean imputation, there are no parameters. The σparameter had been estimated as in the extension case, but over the whole training data matrix. The regularization parameter C−cost had been tuned through k-fold cross-validation. 24 9 Conclusions and future work This work have consisted mostly in theoretical development under the guidance of my teacher. The approach that has been presented is considered novel in the literature and there is much work to do. The main goal of practical part was to make a feasible solution from the computational point of view. There is much room for improvement and optimization. Moreover, as have been seen in section 8.3, all three kernel extensions are competitive with standard imputation methods. In the synthetic-data problem they behave similarly to Mean - RBF (SVM) method and in the real-data problem, statistical analyses show that they are near to the MICE - RBF (SVM) method. The advantages that present kernel extension methods are the following:  They do not modify the data  They are completely deterministic  They allow to predict data with missings (even one observation)  They are well formed theoretically There can be done several improvements in the future:  Normalize the kernels  Optimize σparameter  Improve the efficiency  Test with more problems 31 10 Annex 10.1 RBF (SVM kernel) - Gaussian (KDE kernel) Case 2: ˆ k(x,y) = d ∏ j=1 ∫∞ −∞ 1 n−mj n ∑ i=1 i/∈Mj 1 √2h2 jπ exp (−1 2h2 j(xij −xj)2) exp (−1 2σ2 j(xj−yj)2)dxj where mjis the number of missings in the j-th variable and Mj={i′:i′∈ {1..n},xi′jis a missing}. All dintegrals are identical, thus only one of them will be solved. ˆ kj(x,y) = ∫∞ −∞ 1 n−mj n ∑ i=1 i/∈Mj 1 √2h2 jπ exp (−1 2h2 j(xij −x)2)exp (−1 2σ2 j(x−y)2)dx with x=xjand y=yj(for simplicity). By the linearity of the antidifferentiation: ˆ kj(x,y) = 1 (n−mj)√2h2 jπ n ∑ i=1 i/∈Mj∫∞ −∞ exp (−1 2h2 j(xij −x)2)exp (−1 2σ2 j(x−y)2)dx that performing simple algebraic operations conduces to ˆ kj(x,y) = 1 (n−mj)√2h2 jπ n ∑ i=1 i/∈Mj exp (−a(σ2 jx2 ij +h2 jy2 h2 j+σ2 j))∫∞ −∞ exp (−a(x2−2bx))dx where a=h2 j+σ2 j 2h2 jσ2 j and b=h2 jy+σ2 jxij h2 j+σ2 j . 32 I=∫∞ −∞ exp (−a(x2−2bx))dx = exp (ab2)∫∞ −∞ exp (−a(x−b)2)dx = exp (ab2)∫∞ −∞ exp (−at2)dt = exp (ab2)√π a where t=x−band dt =∂ ∂x (x−b) = dx. For more details, please check 10.4. Finally, the kernel extension expression is: ˆ k(x,y) = d ∏ j=1 ωj where ωj=   1 (n−mj)√2h2 jπ∑n i=1 i/∈Mj δif xjis missing exp (−1 2σ2 j(xj−yj)2)if xj,yjare not missings with δ= exp (−a(σ2 jx2 ij +h2 jy2 j h2 j+σ2 j)+ab2)√π a. Case 4: ˆ k(x,y) = d ∏ j=1 ∫∞ −∞ ∫∞ −∞ 1 (n−mj) n ∑ k=1 k/∈Mj 1 √2h2 jπ exp (−1 2h2 j(ykj −yj)2) 1 (n−mj) n ∑ i=1 i/∈Mj 1 √2h2 jπ exp (−1 2h2 j(xij −xj)2) exp (−1 2σ2 j(xj−yj)2)dxjdyj Again, is considered only one integral. Performing substitution of the result obtained in case 2: 33 ˆ kj(x,y) = ∫∞ −∞ 1 (n−mj)√2h2 jπ n ∑ k=1 k/∈Mj exp (−1 2h2 j(ykj −y)2)· ·1 (n−mj)√2h2 jπ n ∑ i=1 i/∈Mj exp (−a(σ2 jx2 ij +h2 jy2 h2 j+σ2 j))exp(ab2)√π ady =√π ((n−mj)√2h2 jπ)2√a n ∑ k=1 k/∈Mj n ∑ i=1 i/∈Mj∫∞ −∞ exp (−1 2h2 j(ykj −y)2)· ·exp (−a(σ2 jx2 ij +h2 jy2 h2 j+σ2 j)) ·exp(ab2)dy I take I=∫∞ −∞ exp (−1 2h2 j(ykj −y)2−a(σ2 jx2 ij +h2 jy2 h2 j+σ2 j)+ab2)dy and applying simple algebraic operations I= exp (−y2 kjh2 j+y2 kjσ2 j+x2 ijh2 j 2h2 j(h2 j+σ2 j))∫∞ −∞ exp (−a′(y2+ 2b′y))dy where a′=2σ2 jh2 j+σ4 j 2h2 jσ2 j(h2 j+σ2 j)and b′=ykj σ2 jh2 j+ykj σ4 j+σ2 jh2 jxij 2σ2 jh2 j+σ4 j . I= exp(a′b′2) exp (−y2 kjh2 j+y2 kjσ2 j+x2 ijh2 j 2h2 j(h2 j+σ2 j))∫∞ −∞ exp (−a′(y+b)2)dy = exp(a′b′2) exp (−y2 kjh2 j+y2 kjσ2 j+x2 ijh2 j 2h2 j(h2 j+σ2 j))∫∞ −∞ exp (−a′t2)dt = exp(a′b′2) exp (−y2 kjh2 j+y2 kjσ2 j+x2 ijh2 j 2h2 j(h2 j+σ2 j))√π a′ where t=y+b′and dt =∂ ∂y (y+b′) = dy. For more details, please check 10.4. Finally, the kernel extension expression is: ˆ k(x,y) = d ∏ j=1 ωj 34 where ωj=   1 2(n−mj)2h2 j√a√a′∑n k=1 k/∈Mj∑n i=1 i/∈Mj δif xj,yjare missings exp (−1 2σ2 j(xj−yj)2)if xj,yjare not missings with δ= exp (a′b′2−y2 kj h2 j+y2 kj σ2 j+x2 ij h2 j 2h2 j(h2 j+σ2 j)). 10.2 RBF (SVM kernel) - Epanechnikov (KDE kernel) Case 2: Is considered only one integral as in 10.1. ˆ kj(x,y) = ∫∞ −∞ 3 4hj(n−mj) n ∑ i=1 i/∈Mj(1−(xij −x hj)2)I xij −x hj≤1·exp (−a(x−y)2)dx where x=xj,y=yjand a=1 2σ2 j . Manipulating the terms is obtained the following expression: ˆ kj(x,y) = 3 4hj(n−mj) n ∑ i=1 i/∈Mj∫b c(1−(xij −x hj)2)·exp (−a(x−y)2)dx where c=xij −hjand b=xij +hj. I take the following integrals I=∫b c(1−(xij −x hj)2)·exp (−a(x−y)2)dx =∫b c exp (−a(x−y)2)dx −∫b c(xij −x hj)2·exp (−a(x−y)2)dx , I1=∫b c exp (−a(x−y)2)dx =√π 2√a[erf ((x−y)√a)]b c 35 I2=∫b c(xij −x hj)2·exp (−a(x−y)2)dx and I21 =x2 ij h2 j∫b c exp (−a(x−y)2)dx =x2 ij h2 j[√π 2√aerf ((x−y)√a)]b c I22 =2xij h2 j∫b c x·exp (−a(x−y)2)dx =2xij h2 j[−1 2aexp(−a(x−y)2) + y√π 2√aerf ((x−y)√a)]b c I23 =1 h2 j∫b c x2·exp (−a(x−y)2)dx =1 h2 j[√π 4√a3erf ((x−y)√a)−x 2aexp(−a(x−y)2) −y 2aexp(−a(x−y)2) + y2√π 2√aerf ((x−y)√a)]b c such that I2=I21 −I22 +I23 and I=I1−I2. For more details, please check 10.4. Finally, the kernel extension expression is: ˆ k(x,y) = d ∏ j=1 ωj where ωj=   3 4hj(n−mj)∑n i=1 i/∈Mj Iif xjis missing exp (−1 2σ2 j(xj−yj)2)if xj,yjare not missings Case 4: 36 ˆ kj(x,y) = ∫∞ −∞ ∫∞ −∞ 3 4hj(n−mj) n ∑ k=1 k/∈Mj(1−(ykj −y hj)2)I ykj −y hj≤1 ·3 4hj(n−mj) n ∑ i=1 i/∈Mj(1−(xij −x hj)2)I xij −x hj≤1 ·exp (−a(x−y)2)dxdy where a=1 2σ2 j ,x=xjand y=yj. Manipulating the expression above ˆ kj(x,y) = (3 4hj(n−mj))2n ∑ k=1 k/∈Mj n ∑ i=1 i/∈Mj∫d e∫b c δx,y dxdy where δx,y =((1−(ykj −y hj)2)−(xij −x hj)2(1−(ykj −y hj)2))exp (−a(x−y)2), e=ykj −hj,d=ykj +hj,c=xij −hjand b=xij +hj. I take the following integrals I1=∫d e∫b c(1−(ykj −y hj)2)exp (−a(x−y)2)dxdy =∫d e(1−(ykj −y hj)2)√π 2√a[erf ((x−y)√a)]b cdy =[[h2 j√π−y2 kj√π 2h2 j√a∫erf ((x−y)√a)dy −√π 2h2 j√a(∫y2erf((x−y)√a)dy −2ykj ∫yerf ((x−y)√a)dy)]d e]b c 37 I2=∫d e∫b c(xij −x hj)2exp (−a(x−y)2)dxdy =[[x2 ij√π 2h2 j√a∫erf ((x−y)√a)dy −2xij h2 j(√π 2√a∫yerf ((x−y)√a)dy −1 2a∫exp(−a(x−y)2)dy) +1 h2 j(√π 4√a3∫erf ((x−y)√a)dy −x 2a∫exp(−a(x−y)2)dy −1 2a∫yexp(−a(x−y)2)dy +√π 2√a∫y2erf ((x−y)√a)dy)]d e]b c and I3=∫d e∫b c((xij −x)(ykj −y) h2 j)2exp (−a(x−y)2)dxdy that can be decomposed into the following integrals I31 =(xijykj)2 h4 j∫d e∫b c exp (−a(x−y)2)dxdy =(xijykj)2 h4 j[[√π 2√a∫erf ((x−y)√a)dy]d e]b c I32 =−2x2 ijykj h4 j∫d e∫b c yexp (−a(x−y)2)dxdy =−2x2 ijykj h4 j[[√π 2√a∫yerf ((x−y)√a)dy]d e]b c I33 =x2 ij h4 j∫d e∫b c y2exp (−a(x−y)2)dxdy =x2 ij h4 j[[√π 2√a∫y2erf ((x−y)√a)dy]d e]b c 38 I34 =−2xijy2 kj h4 j∫d e∫b c xexp (−a(x−y)2)dxdy =−2xijy2 kj h4 j[[σj√π √2∫yerf ((x−y)√a)dy −σ2 j∫exp(−a(x−y)2)dy]d e]b c I35 =4xijykj h4 j∫d e∫b c yx exp (−a(x−y)2)dxdy =4xijykj h4 j[[σj√π √2∫y2erf ((x−y)√a)dy −σ2 j∫yexp(−a(x−y)2)dy]d e]b c I36 =−2xij h4 j∫d e∫b c y2xexp (−a(x−y)2)dxdy =−2xij h4 j[[σj√π √2∫y3erf ((x−y)√a)dy −σ2 j∫y2exp(−a(x−y)2)dy]d e]b c I37 =y2 kj h4 j∫d e∫b c x2exp (−a(x−y)2)dxdy =y2 kj h4 j[[√π 4√a3∫erf ((x−y)√a)dy −x 2a∫exp(−a(x−y)2)dy −1 2a∫yexp(−a(x−y)2)dy +√π 2√a∫y2erf ((x−y)√a)dy]d e]b c I38 =−2ykj h4 j∫d e∫b c yx2exp (−a(x−y)2)dxdy =−2ykj h4 j[[√π 4√a3∫yerf ((x−y)√a)dy −x 2a∫yexp(−a(x−y)2)dy −1 2a∫y2exp(−a(x−y)2)dy +√π 2√a∫y3erf ((x−y)√a)dy]d e]b c 39 I39 =1 h4 j∫d e∫b c y2x2exp (−a(x−y)2)dxdy =1 h4 j[[√π 4√a3∫y2erf ((x−y)√a)dy −x 2a∫y2exp(−a(x−y)2)dy −1 2a∫y3exp(−a(x−y)2)dy +√π 2√a∫y4erf ((x−y)√a)dy]d e]b c such that I3=I31 +I32 +I33 +I34 +I35 +I36 +I37 +I38 +I39 and I=I1−I2+I3. Finally, the kernel extension expression is: ˆ k(x,y) = d ∏ j=1 ωj where ωj=     (3 4hj(n−mj))2∑n k=1 k/∈Mj∑n i=1 i/∈Mj Iif xj,yjare missings exp (−1 2σ2 j(xj−yj)2)if xj,yjare not missings 10.3 Polynomial (SVM kernel) - Gaussian (KDE kernel) For construction of the extension I will assume that both variables are completely missing, except the constant term, and then two more variables will be introduced in order to manage all the possible cases. By the linearity of the antidifferentiation, the extension has the following form: ˆ k(x,y) = d ∑ i1=0 · d ∑ i2=0 ··· d ∑ ig=0 ∫∞ −∞ ∫∞ −∞ xi1yi1ˆp(xi1)ˆp(yi1)dxi1dyi1· ·∫∞ −∞ ∫∞ −∞ xi2yi2ˆp(xi2)ˆp(yi2)dxi2dyi2··· ·∫∞ −∞ ∫∞ −∞ xigyigˆp(xig)ˆp(yig)dxigdyig Grouping the terms the expression is (here the first auxiliar variable is introduced) 40 11 References [1] Consultations with my teacher, Llu´ıs A. Belanche Mu˜noz. [2] G. Nebot and Ll. Belanche. A kernel extension to handle missing data. In Bramer, Ellis and Petridis, editors, Research and Development in Intelligent Systems XXVI, Springer, 2010. [3] Abramowitz M., Stegun I. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, New York: Dover 1965, ISBN 978 −0486612720. [4] Ripley, B. Pattern Recognition and Neural Networks. Cambridge Univ. Press, (1996). [5] V. Kobayashi, T. Aluja, L. Belanche. Handling missing values in kernel methods with application to microbiology data. 2014. [6] Gibergans J., Gil A., Rovira C. Estad´ıstica. UOC, 4a ed. (2009). [7] Bandwidth selection. Retrieved on 1st of October of 2014 from https://stat.ethz.ch/R- manual/R-devel/library [8] RDocumentation. Retrieved on 1st of December of 2014 from http://cran.rproject.org/ [9] σestimation. Retrieved on 1st of October of 2014 from http://cran.r-project.org/web/ packages/kernlab/ [10] Notes on KDE - Manchester School of Mathematics. Retrieved from http://www.maths.manchester.ac.uk/ peterf/MATH38011/ [11] E. Parzen. On the estimation of a probability density function and mode. Annals of Mathematical Statistics, 33:1065–1076, 1962. [12] [Bishop2006] Christopher M. Bishop. Pattern Recognition and Machine Learning. 2006. Edicions Springer. [13] J Shawe-Taylor, N Cristianini. Kernel methods for pattern analysis. 2004. Cambridge university press. 47 [14] A. Gelman, J. Hill. Data Analysis Using Regression and Multilevel/Hierarchical Models. 2006. [15] S. van Buuren and K. Groothuis-Oudshoorn. mice: Multivariate imputation by chained equations in R. Journal of Statistical Software, 45(3):1–67, 2011. [16] A. Rogier T. Donders, Geert J.M.G. van der Heijden, Theo Stijnen, Karel G.M. Moons. A gentle introduction to imputation of missing values. Journal of Clinical Epidemiology 59, 2006. 48