## Abstract

We propose a new formulation of multiple-instance learning (MIL), in which a unit of data consists of a set of instances called a bag. The goal is to find a good classifier of bags based on the similarity with a “shapelet” (or pattern), where the similarity of a bag with a shapelet is the maximum similarity of instances in the bag. In previous work, some of the training instances have been chosen as shapelets with no theoretical justification. In our formulation, we use all possible, and thus infinitely many, shapelets, resulting in a richer class of classifiers. We show that the formulation is tractable, that is, it can be reduced through linear programming boosting (LPBoost) to difference of convex (DC) programs of finite (actually polynomial) size. Our theoretical result also gives justification to the heuristics of some previous work. The time complexity of the proposed algorithm highly depends on the size of the set of all instances in the training sample. To apply to the data containing a large number of instances, we also propose a heuristic option of the algorithm without the loss of the theoretical guarantee. Our empirical study demonstrates that our algorithm uniformly works for shapelet learning tasks on time-series classification and various MIL tasks with comparable accuracy to the existing methods. Moreover, we show that the proposed heuristics allow us to achieve the result in reasonable computational time.

## 1 Introduction

Multiple-instance learning (MIL) is a fundamental framework of supervised learning with a wide range of applications, such as prediction of molecular activity, and image classification. It has been extensively studied in both theoretical and work (Gärtner et al., 2002; Andrews, Tsochantaridis, & Hofmann, 2003; Sabato & Tishby, 2012; Zhang, He, Si, & Lawrence, 2013; Doran & Ray, 2014; Carbonneau, Cheplygina, Granger, & Gagnon, 2018), since the notion of MIL was first proposed by Dietterich, Lathrop, and Lozano-Pérez (1997).

*bags*; each contains multiple instances. In the training phase, each bag is labeled, but instances are not labeled individually. The goal of the learner is to obtain a hypothesis that predicts the labels of unseen bags correctly.

^{1}One of the most common hypotheses used in practice has the following form,

*shapelet*. In many applications, $u$ is interpreted as a particular pattern in the feature space and the inner product as the similarity of $\Phi (x)$ from $u$. Note that we use the term

*shapelets*by following the terminology of shapelet learning (SL), which is a framework for time-series classification, although it is often called

*concepts*in the literature of MIL. Intuitively, this hypothesis evaluates a given bag by the maximum similarity among the instances in the bag and the shapelet $u$. The multiple-instance support vector machine (MI-SVM), proposed by Andrews et al. (2003), is a widely used algorithm that employs this hypothesis class and learns $u$. It is well known that MIL algorithms using this hypothesis class perform empirically better in various multiple-instance data sets. Moreover, a generalization error bound of the hypothesis class is given by Sabato and Tishby (2012).

### 1.1 Our Contributions

In this letter, we propose an MIL formulation with the hypothesis class 1.2 for sets $U$ of infinitely many shapelets.

The proposed learning framework is theoretically motivated and practically effective. We show the generalization error bound based on the Rademacher complexity (Bartlett & Mendelson, 2003) and large margin theory. The result indicates that we can achieve a small generalization error by keeping a large margin for a large training sample.

The learning framework can be applied to various kinds of data and tasks because of our unified formulation. The existing shapelet-based methods are formulated for their target domains. More precisely, the existing shapelet-based methods are formulated using a fixed similarity measure (or distance), and the generalization ability is shown empirically in their target domains. For example, Chen et al. (2006) and Sangnier, Gauthier, and Rakotomamonjy (2016) calculated the feature vectors based on the similarity between every instance using the gaussian kernel. In the time-series domain, shapelet-based methods (Ye & Keogh, 2009; Keogh & Rakthanmanon, 2013; Hills et al., 2014) usually use Euclidean distance as a similarity measure (or distance). By contrast, our framework employs a kernel function as a similarity measure. Therefore, our learning framework can be uniformly applied if we can set a kernel function as a similarity measure according to a target learning—for example, the gaussian kernel (which behaves like the Euclidean distance) and dynamic time warping (DTW) kernel (Shimodaira, Noma, Nakai, & Sagayama, 2001). Our framework can be also applied to non-real-valued sequence data (e.g., text and a discrete signal) using a string kernel. Moreover, our generalization performance is guaranteed theoretically. The experimental results demonstrate that the approach uniformly works for SL and MIL tasks without introducing domain-specific parameters and heuristics, and it compares with the state-of-the-art shapelet-based methods.

We show that the formulation is tractable. The algorithm is based on linear programming boosting (LPBoost; Demiriz, Bennett, & Shawe-Taylor, 2002), which solves the soft margin optimization problem via a column generation approach. Although the weak learning problem in the boosting becomes an optimization problem over an infinite-dimensional space, we can show that an analog of the representer theorem holds on it and allows us to reduce it to a nonconvex optimization problem (difference of convex program) over a finite-dimensional space. While it is difficult to solve the subproblems exactly because of nonconvexity, it is possible to find good approximate solutions with in reasonable time in many practical cases (Le Thi & Pham Dinh, 2018).

### 1.2 Comparison to Related Work for MIL

There are many MIL algorithms with hypothesis classes that are different from equations 1.1 or 1.2. (e.g., Auer & Ortner, 2004; Gärtner et al., 2002; Andrews & Hofmann, 2004; Zhang, Platt, & Viola, 2006; Chen et al., 2006). For example, these algorithms adopted diverse approaches for the bag-labeling hypothesis from shapelet-based hypothesis classes (e.g., Zhang et al., 2006, used a noisy-OR based hypothesis and Gärtner et al., 2002, proposed a new kernel called a *set kernel*). Shapelet-based hypothesis classes have a practical advantage of being applicable to SL in the time-series domain (see section 1.3).

Sabato and Tishby (2012) proved generalization bounds of hypotheses classes for MIL including those of equations 1.1 and 1.2 with infinitely large sets $U$. The generalization bound we provid in this letter is incomparable to the bound provided by Sabato and Tishby. When some data-dependent parameter is regarded as a constant, our bound is slightly better in terms of the sample size $m$ by the factor of $O(logm)$. They also proved the PAC learnability of the class 1.1 using the boosting approach under some technical assumptions. Their boosting approach is different from our work in that they assume that labels are consistent with some hypothesis of the form 1.1, while we consider arbitrary distributions over bags and labels.

### 1.3 Connection between MIL and Shapelet Learning for Time-Series Classification

Note also that in the SL framework, each $z\u2208M$ is called a shapelet, while in this letter, we assume that $K$ is a kernel $K(z,x)=\u2329\Phi (z),\Phi (x)\u232a$ and any $u$ (not necessarily $\Phi (z)$ for some $z$) in the Hilbert space is called a shapelet.

Sangnier et al. (2016) proposed an MIL-based anomaly detection algorithm for time-series data. They showed an algorithm based on LPBoost and the generalization error bound based on the Rademacher complexity (Bartlett & Mendelson, 2003). Their hypothesis class is same as the of Chen et al. (2006). However, they did not analyze the theoretical justification to use finite set $U$ made from training instances (however, they mentioned it as future work). By contrast, we consider a hypothesis class based on infinitely many shapelets, and our representer theorem guarantees that our learning problem over the infinitely large set is still tractable. As a result, our study justifies the previous heuristics of their approach.

There is another work that treats shapelets not appearing in the training set. The learning time-series shapelets (LTS) algorithm (Grabocka et al., 2014) tries to solve a nonconvex optimization problem of learning effective shapelets in an infinitely large domain. However, there is no theoretical guarantee of its generalization error. In fact, our generalization error bound applies to their hypothesis class.

For SL tasks, many researchers focus on improving efficiency (Keogh & Rakthanmanon, 2013; Renard et al., 2015; Grabocka, Wistuba, & Schmidt-Thieme, 2015; Wistuba, Grabocka, & Schmidt-Thieme, 2015; Hou et al., 2016; Karlsson, Papapetrou, & Boström, 2016). However, these methods are specialized in the time-series domain, and the generalization performance has never been theoretically discussed.

Curiously, although MIL and SL share similar motivations and hypotheses, the relationship between them has not yet been pointed out. From the shapelet-perspective in MIL, hypothesis 1.1 is regarded as a “single shapelet”–based hypothesis, and hypothesis 1.2 is regarded as a “multiple-shapelets”–based hypothesis. In this study, we refer to a linear combination of maximum similarities based on shapelets such as equations 1.2 and (1.3) as *shapelet-based classifiers*.

## 2 Preliminaries

Let $X$ be an instance space. A bag $B$ is a finite set of instances chosen from $X$. The learner receives a sequence of labeled bags $S=((B1,y1),\u2026,(Bm,ym))\u2208(2X\xd7{-1,1})m$ called a *sample*, where each labeled bag is independently drawn according to some unknown distribution $D$ over $2X\xd7{-1,1}$. Let $PS$ denote the set of all instances that appear in the sample $S$. That is, $PS=\u22c3i=1mBi$. Let $K$ be a kernel over $X$, which is used to measure the similarity between instances, and let $\Phi :X\u2192H$ denote a feature map associated with the kernel $K$ for a Hilbert space $H$, that is, $K(z,z')=\u2329\Phi (z),\Phi (z')\u232a$ for instances $z,z'\u2208X$, where $\u2329\xb7,\xb7\u232a$ denotes the inner product over $H$. The norm induced by the inner product is denoted by $\u2225\xb7\u2225H$ defined as $\u2225u\u2225H=\u2329u,u\u232a$ for $u\u2208H$.

*shapelet-based classifier*denoted by $hu$, as the function that maps a given bag $B$ to the maximum of the similarity scores between shapelet $u$ and $\Phi (x)$ over all instances $x$ in $B$. More specifically,

*empirical margin loss*of $g$ over $S$, that is, $E\rho (g)=|{i\u2223yig(Bi)<\rho}|/m$.

## 3 Optimization Problem Formulation

*column generation part*), and repeat the procedure with $U'=U'\u222a{u}$ until a certain stopping criterion is met. In particular, we use LPBoost (Demiriz et al., 2002), a well-known and practically fast algorithm of column generation. Since the solution $w$ is expected to be sparse due to the 1-norm regularization, the number of iterations is expected to be small.

(Representer Theorem). The solution $u*$ of equation 3.3 can be written as $u*=\u2211z\u2208PS\alpha z\Phi (z)$ for some real numbers $\alpha z$.

Our theorem can be derived from a nontrivial application of the standard representer theorem (see, e.g., Mohri, Rostamizadeh, & Talwalkar, 2012). Intuitively, we prove the theorem by decomposing the optimization problem 3.3 into a number of subproblems, so that the standard representer theorem can be applied to each of the subproblems. The details of the proof are given in appendix A.

This result gives justification to the simple heuristics in the standard approach: choosing the shapelets based on the training instances. More precisely, the hypothesis class used in the standard approach (Chen et al., 2006; Sangnier et al., 2016) corresponds to the special case where $u\u2208Utrain={\Phi (z)\u2223z\u2208PS}$. Thus, our representer theorem would suggest that the standard approach of using $Utrain$ is reasonable.

Theorem ^{1} says that the weak learning problem can be rewritten in the following tractable form:

- $OP$
**1. Weak Learning Problem**$min\alpha -\u2211i=1mdiyimaxx\u2208Bi\u2211z\u2208PS\alpha zKz,xsub.to\u2211z\u2208PS\u2211v\u2208PS\alpha z\alpha vKz,v\u22641.$

Unlike the primal solution $w$, the dual solution $\alpha $ is not expected to be sparse. To obtain a more interpretable hypothesis, we propose another formulation of weak learning where 1-norm regularization is imposed on $\alpha $, so that a sparse solution of $\alpha $ will be obtained. In other words, instead of $U$, we consider the feasible set $U^=\u2211z\u2208PS\alpha z\Phi (z):\u2225\alpha \u22251\u22641$, where $\u2225\alpha \u22251$ is the 1-norm of $\alpha $.

- $OP$
**2. Sparse Weak Learning Problem**$min\alpha -\u2211i=1mdiyimaxx\u2208Bi\u2211z\u2208PS\alpha zKz,xsub.to\u2225\alpha \u22251\u22641$

Note that when running LPBoost with a weak learner for $OP$ 2, we obtain a final hypothesis that has the same form of generalization bound as the one stated in theorem ^{2}, which is of a final hypothesis obtained when used with a weak learner for $OP$ 1. To see this, consider a feasible space $U^\Lambda =\u2211z\u2208PS\alpha z\Phi (z):\u2225\alpha \u22251\u2264\Lambda $ for a sufficiently small $\Lambda >0$, so that $U^\Lambda \u2286U$. Then, since $HU^\Lambda \u2286HU$, a generalization bound for $HU$ also applies to $HU^\Lambda $. On the other hand, since the final hypothesis $sign\u2218g$ for $g\u2208conv(HU^\Lambda )$ is invariant to the scaling factor $\Lambda $, the generalization ability is independent of $\Lambda $.

## 4 Algorithms

One might be concerned concern that a kernel matrix could become large when a sample consists a large number of bags and instances. However, note that the kernel matrix of $K(z,x)$, which is used in algorithm 2, needs to be computed only once at the beginning of algorithm 1, not at every iteration.

## 5 Generalization Bound of the Hypothesis Class

In this section, we provide a generalization bound of hypothesis classes $conv(HU)$ for various $U$ and $K$.

Then we have the following generalization bound on the hypothesis class of equation 1.2:

We show the proof in appendix B.

### 5.1 Comparison with the Existing Bounds

^{2}in general, as ours uses the parameter $d\Phi ,S*$ and the other has the extra $log\u2211i=1m|Bi|log(m)$ term. However, our bound is better in terms of the sample size $m$ by the factor of $O(logm)$ when other parameters are regarded as constants.

## 6 SL by MIL

### 6.1 Time-Series Classification with Shapelets

In the following, we introduce a framework of time-series classification problem based on shapelets (i.e., the SL problem). As mentioned in the previous section, a time-series $\tau =(\tau [1],\u2026,\tau [L])\u2208RL$ can be identified with a bag $B\tau ={(\tau [j],\u2026,\tau [j+\u2113-1])\u22231\u2264j\u2264L-\u2113+1}$ that consists of all subsequences of $\tau $ of length $\u2113$. The learner receives a labeled sample $S=((B\tau 1,y1),\u2026,(B\tau m,ym))\u2208(2R\u2113\xd7{-1,1})m$, where each labeled bag (i.e., labeled time series) is independently drawn according to some unknown distribution $D$ over a finite support of $2R\u2113\xd7{-1,+1}$. The goal of the learner is to predict the labels of an unseen time series correctly. In this way, the SL problem can be viewed as an MIL problem, and thus we can apply our algorithms and theory.

Note that for time-series classification, various similarity measures can be represented by a kernel—for example, the gaussian kernel (behaves like the Euclidean distance) and the dynamic time warping (DTW) kernel. Moreover, our framework can generally apply to non-real-valued sequence data (e.g., text, and a discrete signal) using a string kernel.

### 6.2 Our Theory and Algorithms for SL

By theorem ^{2}, we can immediately obtain the generalization bound of our hypothesis class in SL as follows:

To the best of our knowledge, this is the first result on the generalization performance of SL.

Theorem ^{1} gives justification to the heuristics that choose the shapelets extracted from the instances appearing in the training sample (i.e., the sub-sequences for SL tasks). Moreover, several methods using a linear combination of shapelet-based classifiers (e.g., Hills et al., 2014; Grabocka et al., 2014) are supported by corollary ^{6}.

For time-series classification problems, shapelet-based classification has a greater advantage of the interpretability or visibility than other time-series classification methods (see, e.g., Ye & Keogh, 2009). Although we use a nonlinear kernel function, we can observe important sub-sequences that contribute to effective shapelets by solving OP 2 because of the sparsity (see also the experimental results). Moreover, for unseen time-series data, we can observe the types of sub-sequences that contribute to the predicted class by observing maximizer $x\u2208B$.

### 6.3 Learning Shapelets of Different Lengths

For time-series classification, many existing methods take advantage of using shapelets of various lengths. Below, we show that our formulation can be easily applied to the case.

A time series $\tau =(\tau [1],\u2026,\tau [L])\u2208RL$ can be identified with a bag $B\tau ={(\tau [j],\u2026,\tau [j+\u2113-1])\u22231\u2264j\u2264L-\u2113+1,\u2200\u2113\u2208Q}$ that consists of all length $\u2113\u2208Q\u2286{1,\u2026,L}$ of sub-sequences of $\tau $. That is, this is also a special case of MIL that a bag contains different dimensional instances.

There is a simple way to apply our learning algorithm to this case. We employ some kernels $K(z,x)$ that support different dimensional instance pairs $z$ and $x$. Fortunately, such kernels have been studied well in the time-series domain. For example, the DTW kernel and global alignment kernel (Cuturi, 2011) are well-known kernels that support time series of different lengths. However, the size of the kernel matrix of $K(z,x)$ becomes $m(\u2211\u2113\u2208Q(L-\u2113+1))2$. In practice, it requires a high memory cost for large time-series data. Moreover, in general, the above kernel requires a higher computational cost than standard kernels.

### 6.4 Heuristics for Computational Efficiency

For the practical applications, we introduce some heuristics for improving efficiency in our algorithm.

#### 6.4.1 Reduction of $PS$

Especially for time-series data, the size $|PS|$ often becomes large because $|PS|=O(mL)$. Therefore, constructing a kernel matrix of $|PS|\xd7|PS|$ has high computational costs for time-series data. For example, when we consider sub-sequences as instances for time-series classification, we have a large computational cost because of the number of sub-sequences of training data (e.g., approximately $106$ when the sample size is 1000 and the length of each time series is 1000, which results in a similarity matrix of size $1012$). However, in most cases, many sub-sequences in time-series data are similar to each other. Therefore, we only use representative instances $P^S$ instead of the set of all instances $PS$. In this letter, we use $k$-means clustering to reduce the size of $|PS|$. Note that our heuristic approach is still supported by our theoretical generalization error bound. This is because the hypothesis set $HU'$ with the reduced shapelets $U'$ is the subset of $HU$, and the Rademacher complexity of $HU'$ is exactly smaller than the Rademacher complexity of $HU$. Thus, theorem ^{2} holds for the hypothesis class considering the set $HU$ of all possible shapelets $U$, and thus that theorem also holds for the hypothesis class using the set $HU'$ of some reduced shapelets $U'$. Although this approach may decrease the training classification accuracy in practice, it drastically decreases the computational cost for a large data set.

#### 6.4.2 Initialization in Weak Learning Problem

## 7 Experiments

In this section, we show some experimental results implying that our algorithm performs comparably to the existing shapelet-based classifiers for both SL and MIL tasks.

### 7.1 Results for Time-Series Data

We use several binary labeled data sets^{2} in UCR data sets (Chen et al., 2015), which are often used as benchmark data sets for time-series classification methods. We used a weak learning problem OP 2 because the interpretability of the obtained classifier is required in shapelet-based time-series classification.

We compare the following three shapelet-based approaches:

Below we show the detailed condition of the experiment. For ST, we set the shapelet lengths ${2,\u2026,L/2}$, where $L$ is the length of each time series in the data set. ST also requires a parameter of a time limit for searching shapelets, and we set it as 5 hours for each data set. For LTS, we used the hyperparameter sets (e.g., regularization parameter, number of shapelets) that the authors recommended in their website,^{3} and we found an optimal hyperparameter by 3-fold cross-validation for each data set. For our algorithms, we implemented a weak learning algorithm that supports shapelets of different lengths (see section 6.3). In this experiment, we consider the case that each bag contains lengths ${0.05,0.1,0.15,\u2026,0.5}\xd7L$ of the sub-sequences. We used the gaussian kernel $K(x,x')=exp(-\u2225x-x'\u22252\u2113\sigma 2)$ and chose $1/\sigma 2$ from ${0.01,0.05,0.1,\u2026,50}$. We chose $\nu $ from ${0.1,0.2,0.3,0.4}$. We use 100-means clustering with respect to each class to reduce $PS$. The parameters we should tune are only $\nu $ and $\sigma $. We tuned these parameters via a procedure we give in appendix B.1. As an LP solver for WeakLearn and LPBoost, we used the CPLEX software. In addition to Ours, LTS employs $k$-means clustering to set the initial shapelets in the optimization algorithm. Therefore, we show the average accuracies for LTS and Ours considering the randomness of $k$-means clustering.

The classification accuracy results are shown in Table 1. We can see that our algorithms achieve performance comparable to that of ST and LTS. We conducted the Wilcoxon signed-rank test between Ours and the others. The $p$-value of the Wilcoxon signed-rank test for Ours and ST is 0.1247. The $p$-value of the Wilcoxon signed-rank test for Ours and LTS is 0.6219. The $p$-values are higher than 0.05, and thus we cannot rejcect that there is no significant difference between the medians of the accuracies. We can say that our MIL algorithm works well for time-series classification tasks without using domain-specific knowledge.

Data Set . | ST . | LTS . | Ours . |
---|---|---|---|

BeetleFly | 0.8 | 0.765 | 0.835 |

BirdChicken | 0.9 | 0.93 | 0.935 |

Coffee | 0.964 | 1 | 0.964 |

Computers | 0.704 | 0.619 | 0.623 |

DistalPhalanxOutlineCorrect | 0.757 | 0.714 | 0.802 |

Earthquakes | 0.741 | 0.748 | 0.728 |

ECG200 | 0.85 | 0.835 | 0.872 |

ECGFiveDays | 0.999 | 0.961 | 1 |

FordA | 0.856 | 0.914 | 0.89 |

FordB | 0.74 | 0.9 | 0.786 |

GunPoint | 0.987 | 0.971 | 0.987 |

Ham | 0.762 | 0.782 | 0.698 |

HandOutlines | 0.919 | 0.892 | 0.87 |

Herring | 0.594 | 0.652 | 0.588 |

ItalyPowerDemand | 0.947 | 0.951 | 0.943 |

Lightning2 | 0.639 | 0.695 | 0.779 |

MiddlePhalanxOutlineCorrect | 0.794 | 0.579 | 0.632 |

MoteStrain | 0.927 | 0.849 | 0.845 |

PhalangesOutlinesCorrect | 0.773 | 0.633 | 0.792 |

ProximalPhalanxOutlineCorrect | 0.869 | 0.742 | 0.844 |

ShapeletSim | 0.994 | 0.989 | 1 |

SonyAIBORobotSurface1 | 0.932 | 0.903 | 0.841 |

SonyAIBORobotSurface2 | 0.922 | 0.895 | 0.887 |

Strawberry | 0.941 | 0.844 | 0.947 |

ToeSegmentation1 | 0.956 | 0.947 | 0.906 |

ToeSegmentation2 | 0.792 | 0.886 | 0.823 |

TwoLeadECG | 0.995 | 0.981 | 0.949 |

Wafer | 1 | 0.993 | 0.991 |

Wine | 0.741 | 0.487 | 0.72 |

WormsTwoClass | 0.831 | 0.752 | 0.608 |

Yoga | 0.847 | 0.69 | 0.804 |

Data Set . | ST . | LTS . | Ours . |
---|---|---|---|

BeetleFly | 0.8 | 0.765 | 0.835 |

BirdChicken | 0.9 | 0.93 | 0.935 |

Coffee | 0.964 | 1 | 0.964 |

Computers | 0.704 | 0.619 | 0.623 |

DistalPhalanxOutlineCorrect | 0.757 | 0.714 | 0.802 |

Earthquakes | 0.741 | 0.748 | 0.728 |

ECG200 | 0.85 | 0.835 | 0.872 |

ECGFiveDays | 0.999 | 0.961 | 1 |

FordA | 0.856 | 0.914 | 0.89 |

FordB | 0.74 | 0.9 | 0.786 |

GunPoint | 0.987 | 0.971 | 0.987 |

Ham | 0.762 | 0.782 | 0.698 |

HandOutlines | 0.919 | 0.892 | 0.87 |

Herring | 0.594 | 0.652 | 0.588 |

ItalyPowerDemand | 0.947 | 0.951 | 0.943 |

Lightning2 | 0.639 | 0.695 | 0.779 |

MiddlePhalanxOutlineCorrect | 0.794 | 0.579 | 0.632 |

MoteStrain | 0.927 | 0.849 | 0.845 |

PhalangesOutlinesCorrect | 0.773 | 0.633 | 0.792 |

ProximalPhalanxOutlineCorrect | 0.869 | 0.742 | 0.844 |

ShapeletSim | 0.994 | 0.989 | 1 |

SonyAIBORobotSurface1 | 0.932 | 0.903 | 0.841 |

SonyAIBORobotSurface2 | 0.922 | 0.895 | 0.887 |

Strawberry | 0.941 | 0.844 | 0.947 |

ToeSegmentation1 | 0.956 | 0.947 | 0.906 |

ToeSegmentation2 | 0.792 | 0.886 | 0.823 |

TwoLeadECG | 0.995 | 0.981 | 0.949 |

Wafer | 1 | 0.993 | 0.991 |

Wine | 0.741 | 0.487 | 0.72 |

WormsTwoClass | 0.831 | 0.752 | 0.608 |

Yoga | 0.847 | 0.69 | 0.804 |

Note: The best accuracies are highlighted in bold.

To compare the computation time of these methods, we selected the data sets for which these three methods have achieved similar performance. The experiments were performed on Intel Xeon Gold 6154, 36 core CPU, and 192 GB memory. Table 2 compares the running times of the training. Note that again, for ST, we set the limitation of the running time as 5 hours for finding good shapelets. This running time limitation is a hyperparameter of the code, and it is difficult to estimat it before experiments. LTS efficiently worked compared with ST and Ours. However, it seems that LTS achieved lower performance than ST and Ours on accuracy. Table 3 shows the testing time of the methods. LTS also efficiently worked, simply because it finds effective shapelets of a fixed number (hyperparameter). ST and Ours may find a large number of shapelets, and this increases the computation time of prediction. For the Wafer data set, ST and Ours required a large computation time compared with LTS.

Data Set . | Number of Training Data . | Length . | ST . | LTS . | Ours . |
---|---|---|---|---|---|

Earthquakes | 322 | 512 | 18,889.8 | 250.5 | 1339.2 |

GunPont | 50 | 150 | 18,016.2 | 22.3 | 36.9 |

ItalyPowerDemand | 67 | 24 | 18,000.8 | 11.5 | 8.6 |

ShapeletSim | 20 | 180 | 18,011.6 | 30.4 | 32.8 |

Wafer | 1000 | 152 | 18,900.8 | 91.5 | 431.7 |

Data Set . | Number of Training Data . | Length . | ST . | LTS . | Ours . |
---|---|---|---|---|---|

Earthquakes | 322 | 512 | 18,889.8 | 250.5 | 1339.2 |

GunPont | 50 | 150 | 18,016.2 | 22.3 | 36.9 |

ItalyPowerDemand | 67 | 24 | 18,000.8 | 11.5 | 8.6 |

ShapeletSim | 20 | 180 | 18,011.6 | 30.4 | 32.8 |

Wafer | 1000 | 152 | 18,900.8 | 91.5 | 431.7 |

Data Set . | Number of Test Data . | Length . | ST . | LTS . | Ours . |
---|---|---|---|---|---|

Earthquakes | 139 | 512 | 389.7 | 2.75 | 11.55 |

GunPont | 150 | 150 | 48.0 | 1.1 | 3.9 |

ItalyPowerDemand | 1029 | 24 | 3.3 | 0.5 | 10.7 |

ShapeletSim | 180 | 180 | 104.0 | 1.8 | 1.1 |

Wafer | 6164 | 152 | 5688.2 | 4.3 | 173.1 |

Data Set . | Number of Test Data . | Length . | ST . | LTS . | Ours . |
---|---|---|---|---|---|

Earthquakes | 139 | 512 | 389.7 | 2.75 | 11.55 |

GunPont | 150 | 150 | 48.0 | 1.1 | 3.9 |

ItalyPowerDemand | 1029 | 24 | 3.3 | 0.5 | 10.7 |

ShapeletSim | 180 | 180 | 104.0 | 1.8 | 1.1 |

Wafer | 6164 | 152 | 5688.2 | 4.3 | 173.1 |

We cannot fairly compare the efficiency of these methods because the implementation environments (e.g., programming languages) are different. However, we can say that the proposed method achieved high classification accuracy with reasonable running time for training and prediction.

#### 7.1.1 Interpretability of Our Method

We would like to show the interpretability of our method. We use the CBF data set, which contains three classes (cylinder, bell, and funnel) of time series. The reason is that it is known that the discriminative patterns are clear, and thus we can easily ascertain if the obtained hypothesis can capture the effective shapelets. For simplicity, we obtain a binary classification model for each class preparing one-versus-others training set. We used Ours with fixed shapelet length $\u2113=25$. We now introduce two types of visualization approaches to interpret a learned model.

One is the visualization of the characteristic sub-sequences of an input time series. When we predict the label of the time series $B$, we calculate a maximizer $x*$ in $B$ for each $hu$, that is, $x*=argmaxx\u2208B\u2329u,\Phi (x)\u232a$. For image recognition tasks, the maximizers are commonly used to observe the subimages that characterize the class of the input image (e.g., Chen et al., 2006). In time-series classification tasks, the maximizers also can be used to observe some characteristic sub-sequences. Figure 1 is an example of a visualization of maximizers. Each value in the legend indicates $wumaxx\u2208B\u2329u,\Phi (x)\u232a$. That is, sub-sequences with positive values contribute to the positive class, and sub-sequences with negative values contribute to the negative class. Such visualization provides the sub-sequences that characterize the class of the input time series. For the cylinder class, although both positive and negative patterns match almost the same sub-sequence, the positive pattern is stronger than the negative, and thus the hypothesis can correctly discriminate the time series. For the bell and funnel classes, we can observe that the highlighted sub-sequences clearly indicate the discriminative patterns.

The other is the visualization of a final hypothesis $g(B)=\u2211j=1twjhj(B)$, where $hj(B)=maxx\u2208B\u2211zj\u2208P^S\alpha j,zjK(zj,x)$ ($P^S$ is the set of representative sub-sequences obtained by $k$-means clustering). Figure 2 is an example of the visualization of a final hypothesis obtained by our algorithm. The colored lines are all the $zj$s in $g$ where both $wj$ and $\alpha j,zj$ were nonzero. Each legend value shows the multiplication of $wj$ and $\alpha j,zj$ corresponding to $zj$. That is, positive values of the colored lines indicate the contribution rate for the positive class, and negative values indicate the contribution rate for the negative class. Note that because it is difficult to visualize the shapelets over the Hilbert space associated with the gaussian kernel, we plotted each of them to match the original time series based on the Euclidean distance. Unlike the previous visualization analyses (see, e.g., Ye & Keogh, 2009), our visualization does not exactly interpret the final hypothesis because of the nonlinear feature map. However, we can deduce that the colored lines represent “important patterns,” which make significant contributions to classification.

### 7.2 Results for Multiple-Instance Data

We selected the baselines of MIL algorithms as mi-SVM and MI-SVM (Andrews et al., 2003) and MILES (Chen, Bi, & Wang, 2006). mi-SVM and MI-SVM are classic methods in MIL that still perform favorably compared with state-of-the-art methods for standard multiple-instance data (see, e.g., Doran, 2015). The details of the data sets are shown in Table 4.

Data Set . | Sample Size . | Number of Instances . | Dimension . |
---|---|---|---|

MUSK1 | 92 | 476 | 166 |

MUSK2 | 102 | 6598 | 166 |

elephant | 200 | 1391 | 230 |

fox | 200 | 1320 | 230 |

tiger | 200 | 1220 | 230 |

Data Set . | Sample Size . | Number of Instances . | Dimension . |
---|---|---|---|

MUSK1 | 92 | 476 | 166 |

MUSK2 | 102 | 6598 | 166 |

elephant | 200 | 1391 | 230 |

fox | 200 | 1320 | 230 |

tiger | 200 | 1220 | 230 |

We used the implementation provided by Doran^{4} for mi-SVM and MI-SVM. We combined the gaussian kernel with mi-SVM and MI-SVM. Parameter $C$ was chosen from ${1,10,100,1000,10,000}$. For our method and MILES,^{5} we chose $\nu $ from ${0.5,0.3,0.2,0.15,0.1}$, and we used only the gaussian kernel. Furthermore, we chose $\sigma $ from ${0.005,0.01,0.05,0.1,0.5,1.0}$. We use 100-means clustering with respect to each class to reduce $PS$. To avoid the randomness of $k$-means, we ran training 30 times and selected the model that achieved the best training accuracy. For efficiency, we demonstrated the weak learning problem $OP$ 2. For all these algorithms, we estimated an optimal parameter set via 5-fold cross-validation. We used well-known multiple-instance data, as shown on the left-hand side of Table 5. The accuracies resulted from 10 times of 5-fold cross-validation.

Data Set | mi-SVM | MI-SVM | MILES | Ours |

MUSK1 | $0.834\xb10.084$ | $0.820\xb10.081$ | $0.865\xb10.068$ | $0.844\xb10.076$ |

MUSK2 | $0.749\xb10.082$ | $0.840\xb10.074$ | $0.871\xb10.072$ | $0.879\xb10.067$ |

elephant | $0.785\xb10.070$ | $0.823\xb10.056$ | $0.796\xb10.068$ | $0.828\xb10.061$ |

fox | $0.618\xb10.069$ | $0.578\xb10.075$ | $0.675\xb10.071$ | $0.646\xb10.063$ |

tiger | $0.752\xb10.078$ | $0.815\xb10.055$ | $0.827\xb10.057$ | $0.817\xb10.058$ |

Data Set | mi-SVM | MI-SVM | MILES | Ours |

MUSK1 | $0.834\xb10.084$ | $0.820\xb10.081$ | $0.865\xb10.068$ | $0.844\xb10.076$ |

MUSK2 | $0.749\xb10.082$ | $0.840\xb10.074$ | $0.871\xb10.072$ | $0.879\xb10.067$ |

elephant | $0.785\xb10.070$ | $0.823\xb10.056$ | $0.796\xb10.068$ | $0.828\xb10.061$ |

fox | $0.618\xb10.069$ | $0.578\xb10.075$ | $0.675\xb10.071$ | $0.646\xb10.063$ |

tiger | $0.752\xb10.078$ | $0.815\xb10.055$ | $0.827\xb10.057$ | $0.817\xb10.058$ |

Note: The best accuracies are highlighted in bold.

The results are shown in Table 5. MILES and Ours achieve significantly better performance than mi- and MI-SVM. Ours achieves comparable performance to MILES. Table 6 shows the training accuracies of MILES and Ours. It can be seen that Ours achieves higher training accuracy. This result is theoretically reasonable because our hypothesis class is richer than that of MILES. However, this means that Ours has a higher overfitting risk than does MILES.

Data Set . | MILES . | Ours . |
---|---|---|

MUSK1 | 0.987 | 0.985 |

MUSK2 | 0.980 | 0.993 |

elephant | 0.963 | $0.993$ |

fox | 0.987 | $0.995$ |

tiger | 0.973 | $0.993$ |

Data Set . | MILES . | Ours . |
---|---|---|

MUSK1 | 0.987 | 0.985 |

MUSK2 | 0.980 | 0.993 |

elephant | 0.963 | $0.993$ |

fox | 0.987 | $0.995$ |

tiger | 0.973 | $0.993$ |

Table 7 shows the training time of the five methods. It is clear that MILES and Ours are more efficient than mi- and MI-SVM. The main reason is that mi- and MI-SVM solve quadratic programming (QP) problems, while MILES and Ours solve LP problems. On average, MILES worked more efficiently than Ours. However, for MUSK2, which has a large number of instances, Ours worked more efficiently than MILES.

Data Set . | mi-SVM . | MI-SVM . | MILES . | Ours . |
---|---|---|---|---|

MUSK1 | 29.6 | 28.1 | 0.584 | 5.57 |

MUSK2 | 3760.1 | 3530.0 | 103.1 | 80.5 |

elephant | 240.6 | 130.3 | 5.84 | 8.30 |

fox | 201.9 | 139.2 | 5.4 | 26.4 |

tiger | 158.5 | 118.0 | 4.6 | 9.8 |

Data Set . | mi-SVM . | MI-SVM . | MILES . | Ours . |
---|---|---|---|---|

MUSK1 | 29.6 | 28.1 | 0.584 | 5.57 |

MUSK2 | 3760.1 | 3530.0 | 103.1 | 80.5 |

elephant | 240.6 | 130.3 | 5.84 | 8.30 |

fox | 201.9 | 139.2 | 5.4 | 26.4 |

tiger | 158.5 | 118.0 | 4.6 | 9.8 |

The testing time of each algorithm is shown in Table 8. We can see that Ours is comparable to the other algorithms.

Data Set . | mi-SVM . | MI-SVM . | MILES . | Ours . |
---|---|---|---|---|

MUSK1 | 0.010 | 0.004 | 0.011 | 0.045 |

MUSK2 | 0.577 | 0.063 | 0.129 | 0.083 |

elephant | 0.053 | 0.015 | 0.067 | 0.115 |

fox | 0.078 | 0.025 | 0.118 | 0.145 |

tiger | 0.059 | 0.012 | 0.065 | 0.118 |

Data Set . | mi-SVM . | MI-SVM . | MILES . | Ours . |
---|---|---|---|---|

MUSK1 | 0.010 | 0.004 | 0.011 | 0.045 |

MUSK2 | 0.577 | 0.063 | 0.129 | 0.083 |

elephant | 0.053 | 0.015 | 0.067 | 0.115 |

fox | 0.078 | 0.025 | 0.118 | 0.145 |

tiger | 0.059 | 0.012 | 0.065 | 0.118 |

## 8 Conclusion and Future Work

We proposed a new MIL formulation that provides a richer class of the final classifiers based on infinitely many shapelets. We derived the tractable formulation over infinitely many shapelets with theoretical support and provided an algorithm based on LPBoost and the DC (difference of convex) algorithm. Our result gives theoretical justification for some existing shapelet-based classifiers (e.g., Chen et al., 2006; Hills et al., 2014). The experimental results demonstrate that our approach uniformly works for SL and MIL tasks without introducing domain-specific parameters and heuristics and compares with the baselines of shapelet-based classifiers.

Especially for time-series classification, the number of instances usually becomes large. Although we took a heuristic approach in the experiment, we think it is not an essential solution to improve efficiency. We preliminarily implemented $OP$ 1 with orthogonal random features (Yu et al., 2016) that can approximate the gaussian kernel accurately. It allows us to solve the primal problem of $OP$ 1 directly and to avoid constructing a large kernel matrix. The implementation vastly improved the efficiency however, it did not achieve high accuracy as compared with solutions of $OP$ 2 with the heuristics. For SL tasks, there are many successful efficient methods using some heuristics specialized in the time-series domain (Keogh & Rakthanmanon, 2013; Renard et al., 2015; Grabocka et al., 2015; Wistuba et al., 2015; Hou et al., 2016; Karlsson et al., 2016). We will explore many ways to improve efficiency for SL tasks.

We would also like to improve the generalization error bound. The generalization error bound that we provided in this letter is incomparable to the existing bound. We would like to show the tighter bound than the existing bound. Since we think it requires a more complex analysis, we reserve this for future work. Our heuristics might reduce the model complexity (i.e., the risk of overfitting); however, we do not know how the complexity can be reduced by our heuristics theoretically. To apply our method to various domains, we would like to explore the general techniques for reducing the overfitting risk of our method.

## Appendix A: Proof of Theorem ^{1}

First, we give a definition for convenience.

Following is the proof of theorem ^{1}.

## Appendix B: Proof of Theorem ^{2}

We use $\theta $ and $\Theta $ of definition ^{4}.

(The Rademacher and the Gaussian complexity; Bartlett & Mendelson, 2003). Given a sample $S=(x1,\u2026,xm)\u2208Xm$, the empirical Rademacher complexity $R(H)$ of a class $H\u2282{h:X\u2192R}$ with regard to $S$ is defined as $RS(H)=1mE\sigma suph\u2208H\u2211i=1m\sigma ih(xi)$, where $\sigma \u2208{-1,1}m$, and each $\sigma i$ is an independent uniform random variable in ${-1,1}$. The empirical gaussian complexity $GS(H)$ of $H$ with regard to $S$ is defined similarly, but each $\sigma i$ is drawn independently from the standard normal distribution.

The following bounds are well known:

(Lemma ^{9} of Bartlett & Mendelson, 2003). $RS(H)=O(GS(H))$.

To derive a generalization bound based on the Rademacher or the gaussian complexity is quite standard in the statistical learning theory literature and applicable to our classes of interest as well. However, a standard analysis provides us suboptimal bounds.

Thus, it suffices to bound the size $|\Theta |$. The basic idea to get our bound is the following geometric analysis. Fix any $i\u2208[m]$ and consider points ${\Phi (x)\u2223x\u2208Bi}$. Then we define equivalence classes of $u$ such that $\theta u(i)$ is in the same class, which defines a Voronoi diagram for the points ${\Phi (x)\u2223x\u2208Bi}$. Note here that the similarity is measured by the inner product, not a distance. More precisely, let ${Vi(x)\u2223x\u2208Bi}$ be the Voronoi diagram, with each region defined as $Vi(x)={u\u2208H\u2223\theta u(Bi)=x}$ Let us consider the set of intersections $\u22c2i\u2208[m]Vi(xi)$ for all combinations of $(x1,\u2026,xm)\u2208B1\xd7\cdots \xd7Bm$. The key observation is that each nonempty intersection corresponds to a mapping $\theta u\u2208\Theta $. Thus, we obtain $|\Theta |=(thenumberofintersections\u22c2i\u2208[m]Vi(xi))$. In other words, the size of $\Theta $ is exactly the number of rooms defined by the intersections of $m$ Voronoi diagrams $V1,\u2026,Vm$. From now on, we will derive the upper bound based on this observation.

We will reduce the problem of counting intersections of the Voronoi diagrams to that of counting possible labelings by hyperplanes for some set. Note that for each neighboring Voronoi region, the border is a part of hyperplane since the closeness is defined in terms of the inner product. Therefore, by simply extending each border to a hyperplane, we obtain intersections of half-spaces defined by the extended hyperplanes. Note that the size of these intersections gives an upper bound of intersections of the Voronoi diagrams. More precisely, we draw hyperplanes for each pair of points in $\Phi (PS)$ so that each point on the hyperplane has the same inner product between two points. Note that for each pair $\Phi (z),\Phi (z')\u2208PS$, the normal vector of the hyperplane is given as $\Phi (z)-\Phi (z')$ (by fixing the sign arbitrary). Thus, the set of hyperplanes obtained by this procedure is exactly $\Phi diff(PS)$. The size of $\Phi diff(PS)$ is $|PS|2$, which is at most $|PS|2$. Now, we consider a dual space by viewing each hyperplane as a point and each point in $U$ as a hyperplane. Points $u$ (hyperplanes in the dual) in an intersection give the same labeling on the points in the dual domain. Therefore, the number of intersections in the original domain is the same as the number of the possible labelings on $\Phi diff(PS)$ by hyperplanes in $U$. By the classical Sauer's lemma and the VC dimension of hyperplanes (see, e.g., theorem 5.5 in Schölkopf & Smola, 2002), the size is at most $O((|PS|2)d\Phi ,S*)$.$\u25a1$

For any $\Phi $, $|\Theta |=O(|PS|8(R/\mu *)2)$.

If $X\u2286R\u2113$ and $\Phi $ is the identity mapping over $PS$, then $|\Theta |=O(|PS|min{8(R/\mu *)2,2\u2113}})$.

If $X\u2286R\u2113$ and $\Phi $ satisfies that $\Phi (z),\Phi (x)$ is monotone decreasing with respect to $\u2225z-x\u22252$ (e.g., the mapping defined by the gaussian kernel) and $U={\Phi (z)\u2223z\u2208X\u2286R\u2113,\u2225\Phi (z)\u2225H\u22641}$, then $|\Theta |=O(|PS|min{8(R/\mu *)2,2\u2113}})$.

(i) We follow the argument in lemma ^{9}. For the set of classifiers $F={f:\Phi diff(PS)\u2192{-1,1}\u2223f=sign(\u2329u,v\u232a),\u2225u\u2225H\u22641,minv\u2208\Phi diff(PS)|\u2329u,v\u232a|=\mu}$, its VC dimension is known to be at most $R2/\mu 2$ for $\Phi diff(PS)\u2286{v\u2223\u2225v\u2225H\u22642R}$ (see, e.g., Schölkopf & Smola, 2002). By the definition of $\mu *$, for each intersection given by hyperplanes, there always exists a point $u$ whose inner product between each hyperplane is at least $\mu *$. Therefore, the size of the intersections is bounded by the number of possible labelings in the dual space by $U''={u\u2208H\u2223\u2225u\u2225H\u22641,minv\u2208\Phi diff(PS)|\u2329u,v\u232a|=\mu *}$. Thus, we obtain that $d\Phi ,S*$ is at most $8(R/\mu *)2$, and by lemma ^{9}, we complete the proof of case i.

(ii) In this case, the Hilbert space $H$ is contained in $R\u2113$. Then, by the fact that VC dimension $d\Phi ,S*$ is at most $\u2113$ and lemma ^{9}, the statement holds.

Now we are ready to prove theorem ^{2}.

^{2}.

By using lemmas ^{6}, and ^{7}, we obtain the generalization bound in terms of the gaussian complexity of $H$. Then, by applying lemma ^{8} and theorem ^{10}, we complete the proof.$\u25a1$

### B.1 Hyperparameter Tuning for Time-Series Classification

In the experiment for time-series classification, we roughly tuned $\nu $ and $\sigma 2$ of the gaussian kernel. As we mentioned before, we need high computation time when learning very large time series. The main computational cost is to iteratively solve weak learning problems by using an LP (or QP) solver. The number of constraints of the optimization problem 5.1 depends on the total number of instances in negative bags. Therefore, in the hyperparameter tuning phase, we finish solving each weak learning problem by obtaining the solution of the optimization problem 6.1. Using the rough weak learning problem, we tuned $\nu $ and $\sigma $ through a grid search via three runs of 3-fold cross-validation.

## Notes

^{1}

Although there are settings where instance label prediction is also considered, we focus only on bag-label prediction in this letter.

^{2}

Note that our method is applicable to multiclass classification tasks by easy expansion (e.g., Platt, Cristianini, & Shawe-Taylor, 2000).

^{5}

MILES uses 1-norm SVM to obtain a final classifier. We implemented 1-norm SVM by using the formulation of Warmuth, Glocer, and Rätsch (2008).

## Acknowledgments

This work is supported by JST CREST (grant JPMJCR15K5) and JSPS KAKENHI (grant JP18K18001). In the experiments, we used the computer resource offered under the category of General Projects by the Research Institute for Information Technology, Kyushu University.

## References

*Duality in D.C. (difference of convex functions) optimization. Subgradient methods*. In