Space-Efficient Feature Maps for String Alignment Kernels

String kernels are attractive data analysis tools for analyzing string data. Among them, alignment kernels are known for their high prediction accuracies in string classifications when tested in combination with SVM in various applications. However, alignment kernels have a crucial drawback in that they scale poorly due to their quadratic computation complexity in the number of input strings, which limits large-scale applications in practice. We address this need by presenting the first approximation for string alignment kernels, which we call space-efficient feature maps for edit distance with moves (SFMEDM), by leveraging a metric embedding named edit-sensitive parsing and feature maps (FMs) of random Fourier features (RFFs) for large-scale string analyses. The original FMs for RFFs consume a huge amount of memory proportional to the dimension d of input vectors and the dimension D of output vectors, which prohibits its large-scale applications. We present novel space-efficient feature maps (SFMs) of RFFs for a space reduction from O(dD) of the original FMs to O(d) of SFMs with a theoretical guarantee with respect to concentration bounds. We experimentally test SFMEDM on its ability to learn SVM for large-scale string classifications with various massive string data, and we demonstrate the superior performance of SFMEDM with respect to prediction accuracy, scalability and computation efficiency.


I. INTRODUCTION
Massive string data are now ubiquitous throughout research and industry, in areas such as biology, chemistry, natural language processing and data science.For example, ecommerce companies face a serious problem in analyzing huge datasets of user reviews, question answers and purchasing histories [11], [22].In biology, homology detection from huge collections of protein and DNA sequences is an important part for their functional analyses [25].There is therefore a strong need to develop powerful methods to make best use of massive string data on a large-scale.
Kernel methods [12] are attractive data analysis tools because they can approximate any (possibly non-linear) function or decision boundary well with enough training data.In kernel methods, a kernel matrix a.k.a.Gram matrix is computed from training data and non-linear support vector machines (SVM) are trained on the matrix.Although it is known that kernel methods achieve high prediction accuracy for various tasks such as classification and regression, they scale poorly due to a quadratic complexity in the number of training data [9], [13].In addition, calculation of a classification requires, in the worst case, linear time in the number of training data, which limits large-scale applications of kernel methods in practice.
String kernels [10] are kernel functions that operate on strings, and a variety of string kernels using string similarity measures have been proposed [5], [17], [20], [25].As stateof-the-art string kernels, string alignment kernels are known for high prediction accuracy in string classifications, such as remote homology detection for protein sequences [25] and time-series classifications [5], [34], when tested in combination with SVM.However, alignment kernels have a crucial drawback; that is, as in other kernel methods, they scale poorly due to their quadratic computation complexity in the number of training data.
Kernel approximations using feature maps (FMs) have been proposed to solve the scalability issues regarding kernel methods.FMs project training data into low-dimensional vectors such that the kernel value (similarity) between each pair of training data is approximately equal to the inner product of the corresponding pair of low dimensional vectors.Then, linear SVM are trained on the projected vectors, thereby significantly improving the scalability, while preserving their prediction accuracy.Although a variety of kernel approximations using FMs for enhancing the scalability of kernel methods have been proposed (e.g., Jaccard kernels [19], polynomial kernels [23] and Min-Max kernels [18]), and random Fourier features (RFFs) [24] are an approximation of shift-invariant kernels (e.g., Laplacian and radial basis function (RBF) kernels), approximation for string alignment kernels has not been studied.Thus, an important open challenge, which is required for large-scale analyses of string data, is to develop a kernel approximation for string alignment kernels.
Several metric embeddings for string distance measures have been proposed for large-scale string processing [2], [4].Edit sensitive parsing (ESP) [4] is a metric embedding of a string distance measure called edit distance with moves (EDM) that consists of ordinal edit operations of insertion, deletion and replacement in addition to substring move operation.ESP maps all the strings from the EDM space into integer vectors named characteristic vectors in the L 1 distance space.To date, ESP has been applied only to string processing such as string compression [21], indexing [29], edit distance computation [4]; however, as we will see, there remains high

Training
Training Prediction Approach time space time GAK [5], [6] Global alignment potential for application to an approximation of alignment kernels.ESP is expected to be effective for approximating alignment kernels, because it approximates EDM between strings as L 1 distance between integer vectors.Contribution.In this paper, we present SFMEDM as the first approximation of alignment kernels for solving largescale learning problems on string data.Key ideas behind the proposed method are threefold: (i) to project input strings into characteristic vectors leveraging ESP, (ii) to map characteristic vectors into vectors of RFFs by FMs, and (iii) to train linear SVM on the mapped vectors.However, applying FMs for RFFs to high-dimensional vectors in a direct way requires memory linearly proportional to not only dimension d of input vectors but also dimension D of RFF vectors.In fact, characteristic vectors as input vectors for FMs tend to be very high dimensional d for solving large-scale problems using FMs, and output vectors of RFFs needs to also be highdimensional D for achieving high prediction accuracies, and those conditions limit the applicability of FMs on a largescale.Although fastfood approach [16] and orthogonal range reporting [32] have been proposed for efficiently computing RFFs in O(D log d) time and O(d) memory, they are only applicable to RFFs for approximating RBF kernels with a theoretical guarantee.Accordingly, in this study, we present space-efficient FMs (SFMs) that requires only O(d) memory to solve this problem and can be used for approximating any shift-invariant kernel such as a Laplacian kernel.This is an essential property which is required for approximating alignment kernels and has not been taken into account by previous research.Our SFMEDM has the following desirable properties: 1) Scalability: SFMEDM is applicable to massive string data.2) Fast training: SFMEDM trains SVM fast.

3) Space efficiency:
SFMEDM trains SVM spaceefficiently.4) Prediction accuracy: SFMEDM can achieve high prediction accuracy.We experimentally test the ability of SFMEDM to train SVM with various massive string data, and demonstrate that SFMEDM has superior performance in terms of prediction accuracy, scalability and computational efficiency.

II. RELATED WORK
Several alignment kernels have been proposed for analyzing string data.We briefly review the state of the art, which is also summarized in Table I.Early methods are proposed in [1], [27], [34] and are known not to satisfy the positive definiteness for their kernel matrices.Thus, they are proposed with numerical corrections for any deficiency of the kernel matrices.
The global alignment kernel (GAK) [5], [6] is an alignment kernel based on global alignments originally proposed for time series data.GAK defines a kernel as a summation score of all possible global alignments between two strings.The computation time of GAK is O(N 2 L 2 ) for number of strings N and the length of strings L, and its space usage is O(N 2 ).
A local alignment kernel (LAK) on the notion of the Smith-Waterman algorithm [28] for detecting protein remote homology was proposed by Saigo et al. [25].LAK measures the similarity between each pair of strings by summing up scores obtained from local alignments with gaps of strings.The computation time of LAK is O(N 2 L 2 ) and its space usage is O(N 2 ).Although, in combination with SVM, LAK achieves high classification accuracies for protein sequences, LAK is applicable to protein strings only because its scoring function is optimized for proteins.
D2KE [30] is a random feature map from structured data to feature vectors such that a distance measure between each pair of the structured data is preserved by the inner product between the corresponding pair of mapped vectors.The feature vector for each input structured data is built as follows: (i) D structured data in input are sampled; (ii) the D-dimension feature vector for each structured data is built such that each dimension of the feature vector is defined as the distance between the structured data and a sampled one.D2KE has been applied to time series data [31]; however, as we will see, D2KE cannot achieve high prediction accuracies when it is applied to string data.
Despite the importance of a scalable learning with alignment kernels, no previous work has been able to achieve high scalabilities while preserving high prediction accuracies.We present SFMEDM, the first scalable learning with string alignment kernels that meets these demands and is made possible by leveraging an idea behind ESP and SFM.
CGK [2] is another metric embedding for edit distance and maps input strings S i of alphabet Σ and of the maximum length L into strings S ′ i of fixed-length L such that the edit distance between each pair of input strings is approximately preserved by the Hamming distance between the corresponding pair of mapped strings.Recently, CGK has been applied to the problem of edit similarity joins [33].We also present a kernel approximation of alignment kernels called SFMCGK by leveraging an idea behind CGK and SFM.
Details of the proposed method are presented in the next section.

III. EDIT SENSITIVE PARSING
Edit sensitive parsing (ESP) [4] is an approximation method for efficiently computing edit distance with moves (EDM).EDM is a string-to-string distance measure for turning one string into another in a series of string operations, where a substring move is included as a string operation in addition to typical string operations such as insertion, deletion and replacement.Formally, let S be a string of length L and S[i] be the i-th character in S. EDM (S, S ′ ) for two strings S and S ′ is defined as the minimum number of edit operations defined below to transform S into S ′ as following: Computing EDM between two strings is known as an NPcomplete problem [26].ESP can approximately compute EDM by embedding strings into L 1 vector space by a parsing.
Given string S, ESP builds a parse tree named an ESP tree, which is illustrated in Figure 1 as an example.The ESP tree is a balanced tree and each node in the ESP tree belongs to one of three types: (i) a node with three children, (ii) a node with two children and (iii) a node without children (i.e., a leaf).In addition, internal nodes in the ESP tree have the same node label if and only if they have children satisfying both two conditions: (i) the numbers of those children are the same, and (ii) the node labels of those children are the same in the left-to-right order.The height of ESP tree is O(log L) for the length of input string L.
Let V (S) ∈ N d be a d-dimension integer vector built from ESP tree T (S) such that each dimension of V (S) is the number of a node label appearing in T .V (S) is called characteristic vectors.ESP builds ESP trees such that as many subtrees with the same node labels as possible are built for common substrings for strings S and S ′ , resulted in an approximation of EDM between S and S ′ by L 1 distance between their characteristic vectors V (S) and V (S ′ ), i.e., EDM (S, More precisely, the upper and lower bounds of the approximation are as follows, where log * L is the iterated logarithm of L, which is recursively defined as Detail of the ESP algorithm is presented in the appendix.

IV. SPACE-EFFICIENT FEATURE MAPS
In this section we present our new SFMs for RFFs using space proportional to the dimension d of characteristic vectors and independent of the RFF target dimension D. The proposed SFMs improve space usage for generating RFFs from O(dD) to O(d) while preserving theoretical guarantees (concentration bounds).The method is general and can be used for approximating any shift-invariant kernel.
From an abstract point of view, an RFF is based on a way of constructing a random mapping such that for every choice of vectors x, y ∈ R d we have where k is the kernel function.The randomness of z r comes from a vector r ∈ R d sampled from an appropriate distribution D k that depends on kernel function k (see section V for more details), and the expectation is over the choice of r.For the purposes of this section, all that needs to be known about D k is that the d vector coordinates are independently sampled according to the marginal distribution ∆ k .
Since (z r (x) ′ z r (y)) 2 ≤ 1 we have V ar(z r (x) ′ z r (y)) ≤ 1, i.e., bounded variance; however, this in itself does not imply the desired approximation as k(x, y) ≈ z r (x) ′ z r (y).Indeed, z r (x) ′ z r (y) is a poor estimator of k(x, y).The accuracy of RFFs can be improved by increasing the output dimension to D ≥ 2. Specifically RFFs use D/2 independent vectors r 1 , . . ., r D/2 ∈ R d sampled from D k , and they consider FMs that concatenates the values of D/2 functions to one Ddimensional vector.It can then be shown that |z(x) ′ z(y) − k(x, y)| ≤ ε with high probability for sufficiently large D = Ω(1/ε 2 ).
To represent the function z, it is necessary to store a matrix containing vectors r 1 , . . ., r D/2 , which uses space O(dD).
Our assumption for ensuring good kernel approximations is that the vectors r i do not need to be independent.Instead, for a small integer parameter t ∈ N , we compute each vector r i using a hash function h : {1, . . ., D/2} → R d chosen from a t-wise independent family such that for every i, h(i) comes from distribution D k .Then, instead of storing r 1 , . . ., r D/2 , we only store the description of the hash function h in memory O(td).A priori, two issues seemingly concern this approach: • It is unclear how to construct t-wise independent hash functions with output distribution D k .
• Is t-wise independence sufficient to ensure results similar to the fully independent setting?We address these issues in the next two subsections.

A. Hash functions with distribution D k
For concreteness, our construction is based on the following class of t-wise independent hash functions, where t ∈ N is a parameter: For a = (a 0 , a 1 , . . ., a t−1 ) ∈ [0, 1] t chosen uniformly at random, let where y mod 1 computes the fractional part of y ∈ R. It can be shown that any t distinct integer inputs i 1 , . . ., i t ∈ N, the vector Let CDF −1 denote the inverse of the cumulative distribution function of the marginal distribution ∆ k .Then, if y is uniformly distributed in [0, 1], CDF −1 (y) ∼ ∆ k .Accordingly hash function h can be constructed where the j-th coordinate on input i is given, as where a 1 , . . ., a d are chosen independently from [0, 1] d .We see that for every i ∈ N, h(i) = (h(i) 1 , . . ., h(i) d ) has distribution D k .Furthermore, for every set of t distinct integer inputs i 1 , . . ., i t ∈ N, the hash values h(i 1 ), . . ., h(i t ) are independent.

B. Concentration bounds
We then show that for RFFs, D = O(1/ε 2 ) random features suffice to approximate the kernel function within error ε with probability arbitrarily close to 1.
Theorem 1: For every pair of vectors x, y ∈ R d , if the mapping z is constructed as described above using t ≥ 2, for every ε > 0, it follows that Proof: Our proof follows the same outline as the standard proof of Chebychev's inequality.Consider the second central moment: Algorithm 1 Generation of Cauchy random numbers using 2-wise independent hash function.array 1 , array 2 : arrays of d 64-bit unsigned integers; U M AX32: maximum value of unsigned 32-bit integer; β: a parameter.1: Initialize array 1 and array 2 with 64-bit random numbers as unsigned integers.2: function FUNC F(i, j) ⊲ Get the most-significant 32-bit of value 5: 6: function FUNC H(i, j) return z The second equality above uses 2-wise independence, and the fact that to conclude that only D/2 terms in the expansion have nonzero expectation.Finally, we have: where the second inequality follows from Markov's inequality.This concludes the proof.
In the original analysis of RFFs, a strong approximation guarantee was considered; namely, the kernel function for all pairs of points x, y in a bounded region of R d was approximated.This kind of result can be achieved by choosing t ≥ 2 sufficiently large to obtain strong tail bounds.However, we show that the point-wise guarantee (with t = 2) provided by Theorem 1 is sufficient for an application in kernel approximations in Sec.VII.

V. SCALABLE ALIGNMENT KERNELS
We present the SFMEDM algorithm for scalable learning with alignment kernels hereafter.Let us assume a collection of N strings and their labels (S 1 , y 1 ), (S 2 , y 2 ), ..., (S N , y N ) where y i ∈ {0, 1}.We define alignment kernels using EDM (S i , S j ) for each pair of strings S i and S j as follows, where β is a parameter.We apply ESP to each S i for i = 1, 2, ..., N and build ESP trees T 1 , T 2 , ..., T N .Since ESP approximates EDM (S i , S j ) as an L 1 distance between characteristic vectors V (S i ) and V (S j ) built from ESP trees T i and T j for S i and S j , i.e., EDM (S i , S j ) ≈ ||V (S i ) − V (S j )|| 1 , k(S i , S j ) can be approximated as follows, Since Eq.1 is a Laplacian kernel, which is also known as a shift-invariant kernel [24], we can approximate k(S i , S j ) using FMs z(x) for RFFs as follows, where z(x) = 2 D (z r1 (x), z r2 (x), ..., z r D/2 (x)).For Laplacian kernels, z rm (x) for each m = 1, 2, ..., D/2 is defined as where random vectors r m ∈ R d for m = 1, 2, ..., D/2 are sampled from the Cauchy distribution.We shall refer to approximations of alignment kernels leveraging ESP and FMs as FMEDM.
Applying FMs to high dimensional characteristic vectors consumes O(dD) memory for storing vectors r m ∈ R d for m = 1, 2, ..., D/2.Thus, we present SFMs for RFFs using only O(td) memory by applying t-wise independent hash functions introduced in Sec.IV.We fix t = 2 in this study, resulted in O(d) memory.We shall refer to approximations of alignment kernels leveraging ESP and SFMs as SFMEDM.
Algorithm 1 generates random numbers from a Cauchy distribution by using O(d) memory.Two arrays array 1 and array 2 , initialized with 64-bit random numbers as unsigned integers, are used.Function f a (x) is implemented using array 1 and array 2 in F unc F and returns a random number in [0, 1] for given i and j as input.Then, random number u returned from F unc F is converted to a random number from the Cauchy distribution in F unc H as tan(π • (u − 0.5))/β at line 8. Algorithm 2 implements SFMs generating RFFs in Eq.2.Computation time and memory for SFMs are O(dDN ) and O(d), respectively.

VI. FEATURE MAPS USING CGK EMBEDDING
CGK [2], [33] is another string embedding using a randomized algorithm.Let S i for i = 1,2,...,N be input strings of alphabet Σ and let L be the maximum length of input strings.CGK maps input strings S i in the edit distance space into strings S ′ i of length L in the Hamming space, i.e, the edit distance between each pair S i and S j of input strings is approximately preserved by the Hamming distance of the corresponding pair S ′ i and S ′ j of the mapped strings.See [33] for the detail of CGK.
To apply SFMs, we convert mapped strings S ′ i in the Hamming space by CGK to characteristic vectors V C (S ′ i ) in the L 1 distance space as follows.We view elements S ′ i [j] for j = 1,2,...,L as locations (of the nonzero elements) instead of characters.For example, when Σ = {1, 2, 3}, we view each , then we code it as (0.5, 0, 0); if S ′ i [j] = 3, then we code it as (0, 0, 0.5).We then concatenate those L vectors into one vector V C (S ′ i ) of dimension L|Σ| and with L nonzero elements.As a result, the Hamming distance between original strings S ′ i and S ′ j is equal to the L 1 distance between obtained vectors V C (S ′ i ) and V C (S ′ j ), i.e., Ham( By applying SFMs or FMs to V C (S ′ i ), we built vectors of RFFs z(V C (S ′ i )).We shall call approximations of alignment kernels using CGK and SFMs (respectively, FMs) SFMCGK (respectively, FMCGK).

VII. EXPERIMENTS
In this section, we evaluated the performance of SFMEDM with five massive string datasets, as shown in Table II.The "Protein" and "DNA" datasets consist of 3,238 human enzymes obtained from the KEGG GENES database [14], respectively.Each enzyme in "DNA" was coded by a string consisting of four types of nucleotides or bases (i.e., A, T, G, and C).Similarity, each enzyme in "Protein" was coded by a string consisting of 20 types of amino acids.Enzymes belonging to the isomerases class in the enzyme commission (EC) numbers in "DNA" and "Protein" have positive labels and the other enzymes have negative labels.
The "Music" and "Sports" datasets consist of 10,261 and 296,337 reviews of musical instruments products and sports products in English from Amazon [11], [22], respectively.Each review has a rating of five levels.We assigned positive labels to reviews with four or five levels for rating and negative labels to the other reviews.The "Compound" dataset consists of 1,367,074 bioactive compounds obtained from the NCBI PubChem database [15].Each compound was coded by a string representation of chemical structures called SMILES.The biological activities of the compounds for human proteins were obtained from the ChEMBL database.In this study we focused on the biological activity for the human protein microtubule associated protein tau (MAPT).The label of each compound corresponds to the presence or absence of biological activity for MAPT.
All the methods were implemented by C++, and all the experiments were performed on one core of a quadcore Intel Xeon CPU E5-2680 (2.8GHz).The execution of each method was stopped if it did not finish within 48 hours in the experiments.Software and datasets used in this experiments are downloadable from https://sites.google.com/view/alignmentkernels/home.

A. Scalability of ESP
First, we evaluated the scalability of ESP and CGK.Table III shows the execution time, memory in megabytes and dimension d of characteristic vectors generated by ESP and CGK.ESP and CGK were practically fast enough to build characteristic vectors for large datasets.The executions of ESP and CGK finished within 60 seconds for "Compound" that was the largest dataset consisting of more than 1 million compounds.At most 1.5GB memory was consumed in the execution of ESP.These results demonstrated high scalability of ESP for massive datasets.
For each dataset, characteristic vectors of very high dimensions were built by ESP and CGK.For example, 18 million dimension vectors were built by ESP for the "Sports" dataset.Applying the original FMs for RFFs to such high dimension characteristic vectors consumed huge amount of memory, deteriorating the scalability of FMs.The proposed SFMs can solve the scalability problem, which will be shown in the next subsection.

B. Efficiency of SFMs
We evaluated the efficiency of SFMs applied to characteristic vectors built from ESP, and we compared SFMs with FMs.We examined combinations of characteristic vectors and projected vectors of SFMEDM, FMEDM, SFMCGK and FMCGK.The dimension D of projected vectors of RFFs was examined for D = {128, 512, 2048, 8192, 16384}.
Figure 2 shows the amount of memory consumed in SFMs and FMs for characteristic vectors built by ESP and CGK for each dataset.According to the figure, a huge amount of memory was consumed by FMs for high dimension characteristic vectors and projected vectors.Around 1.1TB and 323GB of memory were consumed by FMEDM for D = 16, 384 for "Sports" and "Compound", respectively.Those huge amounts of memory made it impossible to build high-dimension vectors of RFFs.The memory required by SFMs was linear in regard to dimension d of characteristic vectors for each dataset.Only 280MB and 80MB of memory were consumed by SFMEDM for D = 16, 384 for "Sports" and "Compound", respectively.These results suggest that compared with FMEDM, SFMEDM dramatically reduces the amount of required memory.
Figure 3 shows the execution time for building projected vectors for each dataset.According to the figure, execution time increases linearly with dimension D for each method and for "Compound", SFMs built 16,384-dimension vectors of RFFs in around nine hours.
We evaluated accuracies of our approximations of alignment kernels in terms of average error of RFFs, defined as where k(S i , S j ) is defined by Eq. 1 and β = 1 was fixed.Average error of SFMs was compared with that of FMs for each dataset.Table IV shows average error of SFMs and FMs using characteristic vectors built from ESP for each dataset.The average errors of SFMEDM and FMEDM are almost the same for all datasets and dimension D. The accuracies of FMs were preserved in the case of SFMs, while the amount of memory required by FMs was dramatically reduced.The same tendencies were observed for average errors of SFMs in combination with CGK, as shown in Table V.

C. Classification performance of SFMEDM
We evaluated classification abilities of SFMEDM, SFMCGK, D2KE, LAK and GAK.We used an implementation of LAK downloadable from http://sunflower.kuicr.kyoto-u.ac.jp/ ∼ hiroto/project/homology.html.We implemented D2KE by C++ with edit distance as a distance measure for strings.Laplacian kernels with characteristic vectors of ESP and CGK in Eq.1 were also evaluated and denoted as ESPKernel and CGKKernel, respectively.In addition, we evaluated a classification ability of the state-of-the-art string kernel [8], which we shall refer to as STK17, and we used an implementation of STK17 downloadable from https://github.com/mufarhan/sequenceclass NIPS 2017.We used LIBLINEAR [7] for training linear SVM with SFMEDM and SFMCGK.We trained non-linear SVM with GAK, LAK, ESPKernel and CGKKernel using LIBSVM [3].We performed three-fold cross-validation for each dataset and measured the prediction accuracy by the area under the ROC curve (AUC).Dimension D of the vectors of RFFs and D2KE was examined for D = {128, 512, 2048, 8192, 16384}.We selected the best parameter achieving the highest AUC among all combinations of the kernel's parameter β={1, 10, 100, 1000, 10000} and the SVM's parameter C ={0.001, 0.01, 0.1, 1, 10, 100}.
Table VI shows the execution time for building RFFs and computing kernel matrices in addition to training linear/nonlinear SVM for each method.LAK was applied to only "Protein" because its scoring function was optimized for protein sequences.It took 9 hours for LAK to finish the execution, which was the most time-consuming of all the methods in the case of "Protein".The execution of GAK finished within 48 hours for "Protein" and "Music" only, and it took around seven hours and 28 hours for "Protein" and "Music", respectively.The executions of D2KE did not finish within 48 hours for three large datasets of "Music", "Sports" and "Compound".In addition, the executions of EDMKernel and CGKKernel did not finish within 48 hours for "Sports" and "Compound".These results suggest that existing alignment kernels are unsuitable for applications to massive string datasets.The executions of D2KE did not finish when large dimensions (e.g., D = 8, 192 and D = 16, 384) were used, which showed that creating high dimension vectors for achieving high classification accuracies by D2KE is timeconsuming.The executions of SFMEDM and SFMCGK finished with 48 hours for all datasets.SFMEDM and SFMCGK took around nine hours and 13 hours, respectively, for "Compound" consisting of 1.3-million strings in the setting of large D = 16, 382.
Figure 4 shows amounts of memory consumed for training linear/non-linear SVM for each method, where Here, GAK, LAK, EDMKernel, CGKKernel and STK17 are represented as "Kernel"."Kernel" required a small amount of memory for the small datasets (namely, "Protein", "DNA" and "Music"), but it required a huge amount of memory for the large datasets (namely, "Sports" and "Compound").For example, it consumed 654 GB and 1.3 TB of memory for "Sports" and "Compound", respectively.The memories for SFMEDM, SFMCGK and D2KE were at least one order of magnitude smaller than those for "Kernel".SFMEDM, SFMCGK and D2KE required 36GB and 166GB of memory for "Sports" and "Compound" in the case of large D = 16, 382, respectively.These results demonstrated the high memory efficiency of SFMEDM and SFMCGK.Although training linear SVM with vectors built by D2KE was space-efficient, prediction accuracies were not high, which is presented next.
Figure 5 shows the classification accuracy of each method, where the results for the methods not finished with 48 hours were not plotted.The prediction accuracies of SFMEDM and SFMCGK were improved for larger D. The prediction accuracy of SFMEDM was higher than that of SFMCGK for any D on all datasets and was also higher than those of all the kernel methods (namely, LAK, GAK, ESPKernel and CGKKernel and STK17).The prediction accuracies of D2KE were worse than those of SFMEDM and were not improved for even large D. These results suggest that SFMEDM can achieve the highest classification accuracy and it is much more efficient than the other methods in terms of memory and time for building RFFs and training SVM.

VIII. CONCLUSION
We have presented the first feature maps for alignment kernels, which we call SFMEDM, presented SFMs for computing RFFs space-efficiently, and demonstrated its ability to learn SVM for large-scale string classifications with various massive string data, and we demonstrate the superior performance of SFMEDM with respect to prediction accuracy, scalability and computation efficiency.Our SFMEDM has the following appealing properties: 1) Scalability: SFMEDM is applicable to massive string data (see Section VII).2) Fast training: SFMEDM trains SVMs fast (see Section VII-C).3) Space efficiency: SFMEDM trains SVMs spaceefficiently (see Section VII-C).4) Prediction accuracy: SFMEDM can achieve high prediction accuracy (see Section VII-C).SFMEDM opens the door to new application domains such as Bioinformatics and natural language processing, in which large-scale string processing with kernel methods was too restrictive so far.

Fig. 2 .Fig. 3 .
Fig. 2. Memory in megabytes for building vectors of RFFs for various dimensions D. Protein DNA Music Sports Compound

TABLE I SUMMARY
OF STRING ALIGNMENT KERNELS.

TABLE II SUMMARY
OF DATASETS.

TABLE III EXECUTION
TIME IN SECONDS, MEMORY IN MEGA BYTES AND DIMENSION d OF CHARACTERISTIC VECTORS BY ESP AND CGK FOR EACH DATASET.

TABLE IV AVERAGE
ERROR BY SFMEDM AND FMEDM FOR EACH DATASET.ALL VALUES ARE MULTIPLIED BY 10 2 .

TABLE V AVERAGE
ERROR BY SFMCGK AND FMCGK FOR EACH DATASET.ALL VALUES ARE MULTIPLIED BY 10 2 .

TABLE VI EXECUTION
TIME IN SECONDS FOR BUILDING FEATURE VECTORS AND COMPUTING KERNEL MATRICES IN ADDITION TO TRAINING LINEAR/NON-LINEAR SVM FOR EACH METHOD.
Fig. 5. AUC score for each method.