Complex Decomposition of the Negative Distance kernel

A Support Vector Machine (SVM) has become a very popular machine learning method for text classification. One reason for this relates to the range of existing kernels which allow for classifying data that is not linearly separable. The linear, polynomial and RBF (Gaussian Radial Basis Function) kernel are commonly used and serve as a basis of comparison in our study. We show how to derive the primal form of the quadratic Power Kernel (PK) -- also called the Negative Euclidean Distance Kernel (NDK) -- by means of complex numbers. We exemplify the NDK in the framework of text categorization using the Dewey Document Classification (DDC) as the target scheme. Our evaluation shows that the power kernel produces F-scores that are comparable to the reference kernels, but is -- except for the linear kernel -- faster to compute. Finally, we show how to extend the NDK-approach by including the Mahalanobis distance.


INTRODUCTION
An SVM has become a very popular machine learning method for text classification [5]. One reason for its popularity relates to the availability of a wide range of kernels including the linear, polynomial and RBF (Gaussian radial basis function) kernel. This paper derives a decomposition of the quadratic Power Kernel (PK) using complex numbers and applies it in the area of text classification. Our evaluation shows that the NDK produces F-scores which are comparable to those produced by the latter reference kernels while being faster to compute -except for the linear kernel. This evaluation refers to the Dewey Document Classification DDC [11] as the target scheme and compares our NDK-based classifier with two competitors described in [6], [10] and [18], respecstively.
An SVM is a method for supervised classification introduced by [17]. It determines a hyperplane that allows for the best possible separation of the input data. (Training) data on the same side of the hyperplane is required to be mapped to the same class label. Furthermore, the margin of the hyperplane that is defined by the vectors located closest to the hyperplane is maximized. The vectors on the margin are called Support Vectors (SV). The decision function dc : R n → {1, 0, −1}, which maps a vector to its predicted class, is given by: dc(x) := sgn( w, x + b) where sgn : R → {1, 0, −1} is the Signum function; the vector w and the constant b are determined by means of SV optimization. If dc(x) = 0 then the vector is located directly on the hyperplane and no decision regarding both classes is possible.
The decision function is given in the primal form. It can be converted into the corresponding dual form: dc(x) = sgn( m j=1 y j α j x, x j + b) where α j and b are constants determined by the SV optimization and m is the number of SVs x j (the input vector has to be compared only with these SVs). The vectors that are located on the wrong side of the hyperplane, that is, the vectors which prevent a perfect fit of SV optimization, are also considered as SVs. Thus, the number of SVs can be quite large. The scalar product, which is used to estimate the similarity of feature vectors, can be generalized to a kernel function. A kernel function K is a similarity function of two vectors such that the matrix of kernel values is symmetric and positive semidefinite. The kernel function only appears in the dual form. The decision function is given as follows: Let Φ : R n → R l be a function that transforms a vector into another vector mostly of higher dimensionality with l ∈ N ∪ {∞}. It is chosen in such a way that the kernel function can be represented by: . Thus, the decision function in the primal form is given by: Note that Φ is not necessarily uniquely defined. Furthermore, Φ might convert the data into a very high dimensional space. In such cases, the dual form should be used for the optimization process as well as for the classification of previously unseen data. One may think that the primal form is not needed. However, it has one advantage: if the normal vector of the hyperplane is known, a previously unseen vector can be classified just by applying the Signum function, Φ and a scalar multiplication. This is often much faster than computing the kernel function for previously unseen vectors and each SV as required when using the dual form.
The most popular kernel is the scalar product, also called the linear kernel. In this case, the transformation function Φ is the identity function: K lin (x 1 , x 2 ) := x 1 , x 2 . Another popular kernel function is the RBF (Gaussian Radial Basis Function), given by: K r (x 1 , x 2 ) := e −γ||x1−x2|| 2 where γ ∈ R, γ > 0 is a constant that has to be manually specified. This kernel function can be represented by a function Φ r that transforms the vector into infinite dimensional space [19]. For reasons of simplicity, assume that x is a vector with only one component. Then the transformation function Φ r is given by: Another often used kernel is the polynomial kernel: For d := 2, a = 1, c = 1, and two vector components, the function Φ p is given by [9]: Φ p : In general, a vector of dimension n is transformed by Φ p into a vector of dimension n+d d . Thus, the polynomial kernel leads to a large number of dimensions in the target space. However, the number of dimensions is not infinite as in the case of the RBF kernel.

THE POWER KERNEL
The PK is a conditionally positive definite kernel given by for some p ∈ R [16], [2], [12]. A kernel is called conditionally positive-definite if it is symmetric and satisfies the conditions [14] n j,k=1 where c j is the complex-conjugate of c j . We consider here a generalized form of the PK for p := 2 (also called NDK): with a, c ∈ R and a > 0. The expression −a||x 1 − x 2 || 2 + c can also be written as: For deciding which class a previously unseen vector belongs to we can use the decision function in the dual form: The decision function shown in formula (9) has the drawback that the previously unseen vector has to be compared with each SV, which can be quite time consuming. This can be avoided, if we reformulate formula (9) to: With z := a m j=1 y j α j x j , u := a m j=1 y j α j x j , x j and c ′ = c m i=1 y j α j , formula (10) can be rewritten as: The expressions u, z, ( m i=1 y j α j ), and c ′ are identical for every vector x and can be precomputed. Note that there exists no primal form for the NDK based on real number vectors which is stated by the following proposition. Proposition 1 Let a,c ∈ R with a > 0 and n, l ∈ N. Then there is no function Φ re : R n → R l (re indicates that Φ re operates on real numbers) with Proof: If such a function existed, then, for all x ∈ R n , which requires that c ≥ 0 since the square of a real number cannot be negative. Now, consider x, y ∈ R n with ||x−y|| 2 > 2c a ≥ 0. On the one hand, we have, by the Cauchy-Schwarz inequality, On the other hand, it holds that Although no primal form and therefore no function Φ re exists for real number vectors, such a function can be given if complex number vectors are used instead. In this case, the function Φ c is defined with a real domain and a complex codomain: Φ c : R n → C 4n+1 and Note that no scalar product can be defined for complex numbers that fulfills the usual conditions of bilinearity and positive-definiteness simultaneously 1 . Thus, the bilinearity condition is dropped for the official definition and only sesquilinearity is required. The standard scalar product is defined as the sum of the products of the vector components with the associated complex conjugated vector components of the other vector. Let x 1 ,x 2 ∈ C n , then the scalar product is given by [1]: x 1k x 2k . In contrast, we use a modified scalar product (marked by a " * ") where, analogously to the real vector definition, the products of the vector components are summated: * x 1 , x 2 := n k=1 x 1k x 2k . This product (not a scalar product in strict mathematical sense) is a bilinear form but no longer positive definite. For real number vectors this modified scalar product is identical to the usual definition. With this modified scalar product we get which is just the result of the NDK. The optimization can be done with the dual form. Thus, no complex number optimization is necessary. For the decision on the class to which a data vector should be assigned we switch to the primal form. The vector w ∈ C 4n+1 is calculated by: Note that the modified scalar product * w, Φ c (x) must be a real number. This is stated in the following proposition. (12) and x ∈ R n . Then * w, Φ c (x) is a real number.
which is clearly a real number.
The NDK is related to the polynomial kernel since it can also be represented by a polynomial. However, it has the advantage over the polynomial kernel that it is faster to compute, since the number of dimensions in the target space grows only linearly and not exponentially with the number of dimensions in the original space [16], [2]. It remains to show that the decision functions following the primal and dual form are also equivalent for the modified form of the scalar product. This is stated in the follow proposition: Normally, feature vectors for document classification represent the weighted occurrences of lemma or word forms [15]. Thus, such a vector contains a large number of zeros and is therefore usually considered sparse. In this case, the computational complexity of the scalar product can be reduced from O(n) (where n is the number of vector components) to some constant runtime, which is the average number of nonzero vector components. Let I 1 be the set of indices of nonzero entries of vector x 1 (I 1 = {k ∈ {1, . . . , n} : x 1k = 0}) and I 2 be analogously defined for vector x 2 . The scalar product of both vectors can then be computed by k∈(I1∩I2) x 1k ·x 2k . Let us now consider the case that both vectors are transformed to complex numbers before the scalar multiplication. In this case, the modified scalar product is considered where φ(x k ) denotes the transformation of a single real vector component to a complex number vector and is defined as: Note that the partial modified scalar product * φ(x 1k ), φ(x 2k ) can be non-zero, if at least one of the two vector components x 1k and x 2k is non-zero, which is easy to see: Only if both vector components are zero, one can be sure that the result is also zero: Thus, the sparse data handling of two transformed complex vectors has to be modified in such a way that vector components associated with the union and not the intersection of non-zero indices are considered for multiplication: A further advantage of the NDK is that the Mahalanobis distance [8] can easily be integrated, which is shown in the remainder of this section. Each symmetric matrix A can be represented by the product V −1 DV where D is a diagonal matrix with the eigenvalues of A on its diagonals. The square root of a matrix A is then defined as √ A := V −1 D 0.5 V where D 0.5 is the matrix with the square root of the eigenvalues of A on its diagonal. It is obvious that √ A · √ A = A. Proposition 4: Let x, z ∈ R n , a := 1, c := 0, then and Cov denotes the covariance matrix between the feature values of the entire training data set.
(since the covariance matrix is symmetric and the inverse and square root of a symmetric matrix is also symmetric) This proposition shows that the NDK is just the negative square of the Mahalanobis distance for some vectorsx andẑ ifx is set to √ Cov −1 x (analogously forẑ), a is set to 1 and c is set to 0. Furthermore, this proposition shows that we can easily extend our primal form to integrate the Mahalanobis distance. For that, we define a function τ : R n → R n as follows: which shows that we have indeed derived a primal form.
We use the NDK for text classification where a text is automatically labeled regarding its main topics (i.e., categories), employing the DDC as one of the leading classification schemes in digital libraries [11]. Documents are classified regarding the 10 top-level categories of the DDC. To this end, we use training sets of documents for which the DDC categories have already been assigned. Lexical features are extracted from this training set and made input to an SVM library (i.e., libsvm [3]) in order to assign one or more DDC categories to previously unseen texts. Features of instance documents are computed by means of the geometric mean of the tfidf values and the GSS coefficients of their lexical constituents [4], [13].

EVALUATION
The evaluation and training was done using 4 000 German documents, containing in total 114 887 606 words and 9 643 022 sentences requiring a storage space of 823.51 MB. There are 400 documents of each top-level DDC category in the corpus. 2 000 of the texts were used for training, 2 000 for evaluation. The corpus consists of texts annotated according to the OAI (Open Archive Initiative) and is presented in [7]. We tested the correctness of category assignment for the 10 toplevel DDC categories. Each document is mapped at least to one DDC category. Multiple assignments are possible. Precision, recall and F-scores were computed for each DDC category using the NDK, the square (polynomial kernel of degree 2), the cubic (polynomial kernel of degree 3), the RBF kernel and the linear kernel (see Tables I and II). The free parameters of the square, the cubic and the RBF kernel are determined by means of a grid search on an independent data set. On the same held-out dataset, we adjusted the SVM-threshold parameter b to optimize the F-scores. The time (on an Intel Core i7) required to obtain the classifications was determined (see Table III for the real / complex NDK, the RBF, square, and linear kernel). The time needed for building the model was not measured because of being required only once and therefore being irrelevant for online text classification.
The F-score for the NDK is higher than the F-scores of all other kernels and faster to compute except for the linear kernel -obviously, the classification using the primal form of the linear kernel is faster than the one using the NDK. Furthermore, the complex decomposition of the NDK leads to a considerable acceleration of the classification process compared to its dual form and should therefore be preferred.
We conducted a second experiment where we compared the linear kernel with the NDK now using text snippets (i.e., abstracts instead of full texts) taken once more from our OAI corpus. This application scenario is more realistic for digital libraries that mainly harvest documents by means of their meta data and, therefore, should also be addressed by text classifiers. The kernels were trained on a set of 19 000 abstracts 2 . This time, the categories are not treated independently of each other. Instead, the classifier selected all categories with signed distance values from the SVM hyperplane that are greater or equal to zero. If all distance values are negative, the category with the largest (smallest absolute) distance was chosen. In this experiment, the linear kernel performed better than the NDK. Using three samples of 500 texts, the F-scores of the linear kernel are (macro-averaged over all main 10 DDC categories): 0.753, 0.735, 0.743, and of the NDK: 0.730, 0.731, 0.737. This result indicates that the heuristic of preferring the categories of highest signed distance to the hyperplane is not optimal for the NDK. We compared our classifier with two other systems, the DDC classifier of [18] and of [6]. [18] reaches an F-score of 0.502, 0.457 and 0.450 on these three samples. The Fscores of the DDC-classifier of [6] are 0.615, 0.604, and 0.574. Obviously, our classifier outperforms these competitors.
Finally, we evaluated the NDK on the Reuters 21578 corpus 3 (Lewis split). This test set is very challenging since 35 of all 93 categories occurring in this split have 10 or less training examples. Furthermore, several texts are intentionally assigned to none of the Reuters categories. We created an artificial category for all texts that are not assigned in this sense. The histogram of category assignments is displayed in Figure 1. The F-scores for the Reuters corpus are given in Table IV. We modified the training data by filling up instances for every category by randomly selecting positive instances such that the ratio of positive examples to all instances are the same for all categories. Hence, in most category samples some training examples were used more than once. This approach prevents from preferring categories due to their multitude of training examples. The F-score of the NDK is lower than the   highest macro-averaging F-score obtained by the linear kernel, but outperforms the square and the cubic kernel. Again, the parameters of the NDK, the square, the cubic and the RBF kernels were determined by means of a grid search.

CONCLUSION AND FUTURE WORK
We derived a primal form of the NDK by means of complex numbers. In this way, we obtained a much simpler representation compared to the modified dual form. We showed that the primal form (and in principle also the modified dual form) can speed up text classification considerably. The reason is that it does not require to compare input vectors with all support vectors. Our evaluation showed that the F-scores of the NDK are competitive regarding all other kernels tested here while the NDK consumes less time than the polynomial and the RBF kernel. We have also shown that the NDK performs better than the linear kernel when using full texts rather than text snippets. Whether this is due to problems of feature selection/expansion or a general characteristic of this kernel (in the sense of being negatively affected by ultra-sparse features spaces), will be examined in future work. Additionally, we plan to examine the PK with exponents larger than two, to investigate under which prerequisites the PK performs well and to evaluate the extension of the NDK that includes the Mahalanobis distance.