Original: F EW -S HOT O NE -C LASS C LASSIFICATION VIA M ETAL EARNING
Revised: F EW -S HOT O NE -C LASS C LASSIFICATION VIA M ETAL EARNING

Original: Anonymous authors
Revised: Anonymous authors

Original: Paper under double-blind review
Revised: Paper under double-blind review

Original: A BSTRACT
Revised: A BSTRACT

Original: Although few-shot learning(Wang & Yao, 2019) and one-class classiﬁcation (Khan & Madden, 2014) have been separately well studied, their intersection remains rather unexplored.
Revised: Although few-shot learning and one-class classiﬁcation (OCC), i.e. learning a binary classiﬁer with data from only one class, have been separately well studied, their intersection remains rather unexplored.

Original: Our work addresses the few-shot one-class classiﬁcation problem and presents a meta-learning approach that requires only few data examples from only one class to adapt to unseen tasks.
Revised: Our work addresses the few-shot OCC problem and presents a meta-learning approach that requires only few data examples from only one class to adapt to unseen tasks.

Original: The proposed method builds upon the model-agnostic meta-learning (MAML) algorithm
Revised: The proposed method builds upon the model-agnostic meta-learning (MAML) algorithm

Original: (Finn et al., 2017) and explicitly trains for few-shot class-imbalance learning, aiming to learn a model initializationthat is particularly suited for learning one-class classiﬁcation tasks after observing only a  few examples of one class.
Revised: (Finn et al., 2017) and learns a model initialization particularly suited for learning few-shot OCC tasks. This is done by explicitly optimizing for a parameter initialization from which taking few gradient steps with one-class minibatches results in a performance increase on class-balanced data.

Original:  Experimental results on  datasets from the imagedomain andthe time-series domain show that our method substantially outperforms the baselines, including MAML, and demonstrate the ability to  learn new tasks from only few majority class samples.
Revised: We provide a theoretical analysis that explains why our approach works in the few-shot OCC scenario, while other metalearning algorithms, including MAML, fail. Experimental results on six datasets from the image and time-series domains show that our method substantially outperforms both, classical OCC and few-shot classiﬁcation approaches, and demonstrate the ability to quickly learn unseen tasks from only few normal class samples.

Original: Moreover, we successfully learn anomaly detectors for a real world application involving sensor readings recorded during industrial manufacturing of workpieces with a CNC milling machine using only few examples from the normal class.
Revised: Moreover, we successfully learn anomaly detectors for a real world application involving sensor readings recorded during industrial manufacturing of workpieces with a CNC milling machine using only few examples from the normal class.

Original:  I NTRODUCTION
Revised:  I NTRODUCTION

Original: The anomaly detection (AD) task (Chandola et al., 2009; Aggarwal, 2015) consists in differentiating between normal and abnormal data samples.
Revised: The anomaly detection (AD) task (Chandola et al., 2009; Aggarwal, 2015) consists in differentiating between normal and abnormal data samples.

Original: AD applications are common in various domains that involve different data types, including medical diagnosis (Prastawa et al., 2004), cybersecurity (Garcia-Teodoro et al., 2009) and quality control in industrial manufacturing (Scime & Beuth, 2018).
Revised: AD applications are common in various domains that involve different data types, including medical diagnosis (Prastawa et al., 2004), cybersecurity (Garcia-Teodoro et al., 2009) and quality control in industrial manufacturing (Scime & Beuth, 2018).

Original: Due to the rarity of anomalies, the data underlying AD problems exhibits high class-imbalance.
Revised: Due to the rarity of anomalies, the data underlying AD problems exhibits high class-imbalance.

Original: Therefore, AD problems are usually formulated as one-class classiﬁcation (OCC) problems (Moya et al., 1993), where either only few or no anomalous data samples are available for training the model (Khan & Madden, 2014).
Revised: Therefore, AD problems are usually formulated as one-class classiﬁcation (OCC) problems (Moya et al., 1993), where either only few or no anomalous data samples are available for training the model (Khan & Madden, 2014).

Original: While most of the developed approaches (Khan & Madden, 2014) require a substantial amount of normal data to yield good generalization, in many real-world applications, e.g. in industrial manufacturing, only small datasets are available.
Revised: While most of the developed approaches (Khan & Madden, 2014) require a substantial amount of normal data to yield good generalization, in many real-world applications, e.g. in industrial manufacturing, only small datasets are available.

Original: Data scarcity can have many reasons: data collection itself might be expensive, e.g. in healthcare, or happen only gradually, such as in a cold-start situation.
Revised: Data scarcity can have many reasons: data collection itself might be expensive, e.g. in healthcare, or happen only gradually, such as in a cold-start situation.

Original: To enable learning from few examples, various viable meta-learning approaches (Lake et al., 2011; Ravi & Larochelle, 2016; Finn et al., 2017) have been developed.
Revised: To enable learning from few examples, various viable meta-learning approaches (Lake et al., 2011; Ravi & Larochelle, 2016; Finn et al., 2017) have been developed.

Original: However, they rely on having examples from each of the classiﬁcation task’s classes, which prevents their application to OCC tasks.
Revised: However, they rely on having examples from each of the classiﬁcation task’s classes, which prevents their application to OCC tasks.

Original: To the best of our knowledge, the few-shot one-class classiﬁcation (FS-OCC) problem has only been addressed by Kozerawski & Turk (2018) in the imagedata domain (see Section 3). 
Revised: To the best of our knowledge, the few-shot OCC (FS-OCC) problem has only been addressed by Kozerawski & Turk (2018) in the image domain (see Section 3). The contribution of the present work is threefold: (1) We show that classical OCC approaches fail in the few-shot data regime.

Revised: (2) We demonstrate theoretically and analytically that classical gradient-based meta-learning algorithms do not yield initializations suitable for OCC tasks and that second-order derivatives are needed to optimize for such an initialization.

Original: In this work, we introduce One-class model-agnostic meta-learning (OC-MAML), an algorithm that quickly learns FS-OCC tasks.
Revised: (3) We propose One-class model-agnostic meta-learning (OC-MAML), a data-domain-agnostic algorithm that quickly learns FS-OCC tasks, to serve as a ﬁrst, simple and strong baseline for future research in the understudied FS-OCC problem.

Original: It builds upon Model-agnostic meta-learning (MAML)
Revised: OC-MAML builds upon Model-agnostic meta-learning (MAML)

Original: (Finn et al., 2017), which is a meta-learning method that explicitly optimizes for few-shot learning and yields a model initialization that enables quick adaptation to a new task using only few of its datapoints.
Revised: (Finn et al., 2017), which is a meta-learning method that explicitly optimizes for few-shot learning and yields a model initialization that enables quick adaptation to a new task using only few of its datapoints.

Original: Like MAML, OC-MAML yields model parameters that are easily adaptable to unseen tasks.
Revised: Like MAML, OCMAML yields model parameters that are easily adaptable to unseen tasks.

Original: The difference is that the model initialization delivered by OC-MAML is particularly suited for adaptation to OCC tasks and henceonly requires  examples from  one class of the target task for good adaptation.
Revised: The difference is that the model initialization delivered by OC-MAML is particularly suited for adaptation to OCC tasks and hence requires few examples from only one class of the target task for good adaptation.

Revised: We provide a theoretical analysis that shows that OC-MAML explicitely optimizes for a parameter initialization from which taking few gradient steps with one-class minibatches results in a performance increase on class-balanced data.

Original: To ﬁnd such model parameters, we modify the class-imbalance rate of the inner loop data to match the one of the target task, as we detail in Section 2.3.
Revised: This is done by maximizing the inner product of gradients computed on different minibatches with different class-imbalance rates.

Original: While recent meta-learning approaches focused on the few-shot learning problem, i.e. learning to learn with few examples, we extend their use to the OCC problem, i.e. learning to learn with examples from only one class.
Revised: While recent meta-learning approaches focused on the few-shot learning problem, i.e. learning to learn with few examples, we extend their use to the OCC problem, i.e. learning to learn with examples from only one class.

Original: We ﬁnd that OC-MAML yields signiﬁcantly higher generalization performance and faster convergence than the baselines in learning FS-OCC tasks, including MAML (Finn et al., 2017).

Original: We evaluate our approach on four datasets from the image andthe time-series domains, and demonstrate its robustness and maturity  for real-world application by successfully validating it on a  dataset of sensor readings recorded during manufacturing of metal workpieces with a CNC milling machine.
Revised: We empirically validate our theoretical analysis on six datasets from the image and time-series domains, and demonstrate the robustness and maturity of our approach for real-world application by successfully testing it on a real-world dataset of sensor readings recorded during manufacturing of metal workpieces with a CNC milling machine.

Original:  A PPROACH 2. P ROBLEM STATEMENT
Revised:  A PPROACH 2. P ROBLEM STATEMENT

Original: Our goal is to learn a one-class classiﬁcation (OCC) task using only few examples from its majority class.
Revised: Our goal is to learn a one-class classiﬁcation (OCC) task using only few examples from the normal class.

Original: For this, we formulate a meta-learning problem.
Revised: For this we formulate a meta-learning problem.

Original: We assume access to data from classiﬁcation tasks T traini sampled from  a task distribution p ( T ) related to the one of  our target OCC task(s).
Revised: Our approach aims to learn a parameter initialization from which taking few gradient steps using few datapoints from only one class yields a high generalization to unseen examples of both classes. The meta-learned model initialization is required to acquire a sufﬁciently general prior that is able to approximate a generalized decision boundary for a particular class, in our case the normal class, given only few of its examples. In the following, we ﬁrst discuss the unique challenges of the few-shot one-class classiﬁcation (FS-OCC) problem.

Original:  In  the few-shot classiﬁcation context, N -way K -shot learning tasks are usually used totest the learning procedure yielded by the meta-learning algorithm.
Revised: Subsequently, we formulate the FS-OCC problem as a meta-learning problem. In order to perform one-class classiﬁcation, i.e. differentiate between in-class and out-of-class examples, approximating a generalized decision boundary for the normal class is necessary. Learning such a class decision boundary in the few-shot regime can be especially challenging for the following reasons. On the one hand, if the model overﬁts to the few available datapoints, the class decision boundary would be too tight, which would prevent generalization to unseen examples.

Original: An N -way K -shot classiﬁcation task includes
Revised: As a result, some normal samples would be predicted as anomalies. On the other hand, if the model overﬁts to the majority class, e.g. predicting almost everything as normal, the class decision boundary would be too big, and out-of-class (anomalous) examples would not be detected. In our meta-learning problem formulation, we assume access to data from classiﬁcation tasks T traini sampled from a task distribution p ( T ) related to our target OCC tasks. In the few-shot classiﬁcation context, N -way K -shot learning tasks are usually used to test the learning procedure, in our case a model initialization, yielded by the meta-learning algorithm.

Original:  K examples from each of the N classes available for learning this task, after which  a disjoint set of datais used to test the trained classiﬁer (Vinyals et al., 2016).
Revised: An N -way K -shot classiﬁcation task includes K examples from each of the N classes that are used for learning this task, after which the trained classiﬁer is tested on a disjoint set of data (Vinyals et al., 2016).

Original: When the test task is an OCC task, only examples from one class are available for learning, which can be viewed as a 1 -way Kshot classiﬁcation task.
Revised: When the target task is an OCC task, only examples from one class are available for learning, which can be viewed as a 1way K -shot classiﬁcation task.

Original: In order to align with the anomaly detection problem, the available examples have to belong to the normal (majority) class, which usually has a lower variance than the anomalous (minority) class.
Revised: In order to align with the anomaly detection problem, the available examples have to belong to the normal (majority) class, which usually has a lower variance than the anomalous (minority) class.

Original: As a result, the meta-learned model needs to acquire a sufﬁciently general prior that is able to approximate a generalized decision boundary for a particular class, in our case the normal class, given only few of its examples.

Original: Learning such a class decision boundary in the few-shot one-class regime can be especially challenging.

Original: On the one hand, if the model overﬁts to the few available datapoints, the class decision boundary would be too tight, and some normal samples would be predicted as anomalies.

Original: On the other hand, if the model overﬁts to the majority class, e.g. predicting almost everything as normal, the class decision boundary would be too big, and out-of-distribution (anomalous) samples would not be detected.

Original: This problem formulation is our prototype for a practical use case in which an application-speciﬁc anomaly detector is needed and only few data samples from the normal class are available.
Revised: This problem formulation is our prototype for a practical use case in which an application-speciﬁc anomaly detector is needed and only few data samples from the normal class are available.

Original: 2. M ODEL A GNOSTIC M ETA -L EARNING 
Revised: 2. M ODEL -A GNOSTIC M ETA -L EARNING Model-

Original: Model-agnostic meta-learning (MAML)
Revised: agnostic meta-learning (MAML

Original: (Finn et al., 2017) is an optimization-based meta-learning algorithm upon which we build in our present work.
Revised: (Finn et al., 2017) is an optimization-based meta-learning algorithm upon which we build in our present work.

Original: MAML learns a model initialization that enables quick adaptation to unseen tasks using only few data samples.
Revised: MAML learns a model initialization that enables quick adaptation to unseen tasks using only few data samples.

Original: For that, MAML trains a model explicitly for few-shot learning on tasks T i coming from the same task distribution p ( T ) as the unseen target task T test .
Revised: For that, MAML trains a model explicitly for few-shot learning on tasks T i coming from the same task distribution p ( T ) as the unseen target task T test .

Original: To assess the model’s adaptation ability to unseen tasks, the available tasks are divided into mutually disjoint task sets: one for meta-training S tr , one for meta-validation S val and one for meta-testing
Revised: To assess the model’s adaptation ability to unseen tasks, the available tasks are divided into mutually disjoint task sets: one for meta-training S tr , one for meta-validation S val and one for meta-testing

Original: S test .
Revised: S test .

Original: Each task T i is divided into two disjoint sets of data, each of which is used for a particular
Revised: Each task T i is divided into two disjoint sets of data, each of which is used for a particular

Original: MAML operation: D tr is used for adaptation and D val is used for validation, i.e. evaluating the adaptation.
Revised: MAML operation: D tr is used for adaptation and D val is used for validation, i.e. evaluating the adaptation.

Original: The adaptation procedure of a model f θ to a particular task T i consists in taking one (or more) gradient descent step(s) using few datapoints sampled from D tr , and can be expressed as:
Revised: The adaptation procedure of a model f θ to a particular task T i consists in taking one (or more) gradient descent step(s) using few datapoints sampled from D tr , and can be expressed as:

Original: [Equation]
Revised: [Equation]

Original: (1) where α denotes the learning rate.
Revised: where α denotes the learning rate.

Original: Usually, multiple gradient descent updates are applied for adaptation.
Revised: Usually, multiple gradient descent updates are applied for adaptation.

Original: We also refer to the adaptation updates as inner loop updates .
Revised: We also refer to the adaptation updates as inner loop updates .

Original: A good measure for the suitability of the initialization parameters θ for few-shot adaptation to a considered task T i is the loss L valT i ( f θ (cid:48) i ) , which is computed on the validation set D val using the task-speciﬁc adapted model f θ (cid:48)
Revised: A good measure for the suitability of the initialization parameters θ for few-shot adaptation to a considered task T i is the loss L valT i ( f θ (cid:48) i ) , which is computed on the validation set D val using the task-speciﬁc adapted model f θ (cid:48)

Original: i .
Revised: i .

Original: In order to optimize for few-shot learning, the model parameters θ are updated by minimizing the aforementioned loss across all meta-training tasks.
Revised: In order to optimize for few-shot learning, the model parameters θ are updated by minimizing the aforementioned loss across all meta-training tasks.

Original: This update, called the outer loop update , can be expressed as:
Revised: This update, called the outer loop update , can be expressed as:

Original: [Equation]
Revised: [Equation]

Original: where β is the learning rate used for the outer loop.
Revised: where β is the learning rate used for the outer loop.

Original: To avoid meta-overﬁtting, i.e. overﬁtting to the meta-training tasks, model selection can be done via conducting validation episodes using tasks from S val throughout meta-training.
Revised: To avoid meta-overﬁtting, i.e. overﬁtting to the meta-training tasks, model selection can be done via conducting validation episodes using tasks from S val throughout meta-training.

Original: At meta-test time, the few-shot adaptation to unseen tasks from S test is evaluated.
Revised: At meta-test time, the few-shot adaptation to unseen tasks from S test is evaluated.

Original: We note that, in the case of fewshot classiﬁcation, K datapoints from each class are sampled from D tr for the adaptation, during meta-training, meta-validation and meta-testing.
Revised: We note that, in the case of fewshot classiﬁcation, K datapoints from each class are sampled from D tr for the adaptation, during meta-training, meta-validation and meta-testing.

Original: 2. O NE -C LASS M ODEL A GNOSTIC M ETA -L EARNING 
Revised: 2. O NE -C LASS M ODEL -A GNOSTIC M ETA -L EARNING 2.3. A LGORITHM

Original: The primary contribution of our work is to show that  gradient-based meta-learning is a viable approach to the underexplored few-shot one-class classiﬁcation (FS-OCC) problem.
Revised: The primary contribution of our work is to show that second-order gradient-based meta-learning is a viable approach to the underexplored few-shot one-class classiﬁcation (FS-OCC) problem.

Original: We achieve this by adequately modifying the objective of the adaptation step, i.e. the inner loop updates, of the MAML algorithm.
Revised: We achieve this by adequately modifying the objective of the adaptation step, i.e. the inner loop updates, of the MAML algorithm.

Original: We choose to build upon gradient-based meta-learning algorithms, because these were shown to be universal learning algorithm approximators (Finn & Levine, 2017), which means that they could approximate a learning algorithm tailored for FS-OCC.
Revised: We choose to build upon gradient-based meta-learning algorithms, because these were shown to be universal learning algorithm approximators (Finn & Levine, 2017), which means that they could approximate a learning algorithm tailored for FS-OCC.

Original: Moreover, MAML outperforms RNN-based meta-learning algorithms when faced with out-of-domain tasks (Finn & Levine, 2017).

Original: This characteristic is important for applications on industrial sensor data due to the high domain diversity induced by the high diversity of the sensors, machines and manufacturing processes.

Original: As explained in Section 2.2, MAML optimizes explicitly for few-shot adaptation by creating and using auxiliary tasks that have the same characteristic as the target tasks, in this case tasks that include only few datapoints for training.
Revised: As explained in Section 2.2, MAML optimizes explicitly for few-shot adaptation by creating and using auxiliary tasks that have the same characteristic as the target tasks, in this case tasks that include only few datapoints for training.

Original: Analogously, OC-MAML trains explicitly for quick adaptation to OCC tasks by creating OCC auxiliary tasks for meta-training.
Revised: Analogously, OC-MAML trains explicitly for quick adaptation to OCC tasks by creating OCC auxiliary tasks for meta-training.

Original: Concretely, this is done by modifying the class-imbalance rate (CIR) of the inner loop data batches to match the one of the test task.
Revised: Concretely, this is done by modifying the class-imbalance rate (CIR) of the inner loop data batches to match the one of the test task.

Original: The meta-training procedure of OC-MAML is described by the pseudo-code in Algorithm 1.
Revised: The meta-training procedure of OC-MAML is described by the pseudo-code in Algorithm 1 in Appendix

Original: Require: S tr : Set of meta-training tasks

Original: Require: α, β : Learning rates Require: K, Q : Batch size for the inner and outer updates Require: c : CIR for the inner-updates 1: Randomly initialize θ 2: while not done do 3: Sample batch of tasks T i from S tr Let { D tr , D val } =
Revised: A.

Original: T i 4: for all sampled T i do 5:

Original: Sample K datapoints B = { x ( l ) , y ( l ) } from D tr such that CIR = c 6:

Original: Initialize θ (cid:48)

Original: i

Original: = θ 7: for number of adaptation steps do 8:

Original: Compute adaptation loss L trT i ( f θ (cid:48) i ) using B 9:

Original: Compute adapted parameters with gradient descent: θ (cid:48)

Original: i

Original: = θ (cid:48)

Original: i − α ∇ θ (cid:48)

Original: i L trT i f θ (cid:48) i ) 10: end for 11:

Original: Sample Q datapoints B

Original: = { x

Original: , y l ) from D val 12:

Original: Compute outer loop loss L valT i f i ) using B

Original: 13: end for 14:

Original: Update

Original: 15: end while 16: return meta learned parameters θ

Original: As described in Section 1, OCC problems are binary classiﬁcation scenarios where only few or no minority class samples are available.
Revised: As described in Section 1, OCC problems are binary classiﬁcation scenarios where only few or no minority class samples are available.

Original: In order to address both of theses cases, we introduce the hyperparameter  c  which sets the CIR of the batch sampled for the inner updates.
Revised: In order to address both of theses cases, we introduce a hyperparameter ( c ) which sets the CIR of the batch sampled for the inner updates.

Original: Hereby, c gives the percentage of the samples belonging to the minority (anomalous) class w.r.t.
Revised: Hereby, c gives the percentage of the samples belonging to the minority (anomalous) class w.r.t.

Original: the total number of samples, e.g. setting c = 0% means only majority class samples are contained in the data batch.
Revised: the total number of samples, e.g. setting c = 0% means only majority class samples are contained in the data batch.

Revised: We focus on this latter extreme case, where no anomalous samples are available for learning.

Original: The key difference between MAML and OC-MAML is in the sampling operation of the inner loop batch (operation 5 in algorithm 1).
Revised: The key difference between MAML and OC-MAML is in the sampling operation of the inner loop batch (operation 5 in algorithm 1 in Appendix A).

Original: By reducing the size of the batch used for the adaptation (via the hyperparameter K ), MAML trains for few-shot adaptation.
Revised: By reducing the size of the batch used for the adaptation (via the hyperparameter K ), MAML trains for few-shot adaptation.

Original: OC-MAML extends this approach to train for few-shot one-class adaptation by reducing the CIR of the batch used for adaptation (via the hyperparameter c ).
Revised: OC-MAML extends this approach to train for few-shot one-class adaptation by reducing the CIR of the batch used for adaptation (via the hyperparameter c ).

Original: In order to evaluate the performance of the adapted model on both classes, we use a class-balanced validation batch B (cid:48) for the outer loop updates.
Revised: In order to evaluate the performance of the adapted model on both classes, we use a class-balanced validation batch B (cid:48) for the outer loop updates.

Original: This way, we maximize the performance of the model in recognizing both classes after having seen examples from only one class during adaptation.
Revised: This way, we maximize the performance of the model in recognizing both classes after having seen examples from only one class during adaptation.

Original: Using OCC tasks for adaptation during meta-training favors model initializations that enable a quick adaptation to OCC tasks over those that require class-balanced tasks.
Revised: Using OCC tasks for adaptation during meta-training favors model initializations that enable a quick adaptation to OCC tasks over those that require classbalanced tasks.

Original: From a representation learning standpoint, OC-MAML learns representations that are not only broadly suitable for the data underlying p ( T ) , but also particularly suited for OCC tasks.
Revised: From a representation learning standpoint, OC-MAML learns representations that are not only broadly suitable for the data underlying p ( T ) , but also particularly suited for OCC tasks.

Original: During meta-training, meta-validation episodes are conducted to perform model selection.
Revised: In Section 2.3.2, we discuss the unique characteristics of the model initializations yielded by OC-MAML and explain why adapting ﬁrst-order meta-learning algorithms to the OCC scenario does not yield the targeted results. 2.3. T HEORETICAL A NALYSIS : W HY DOES OC-MAML WORK ? In this section we give a theoretical explanation of why OC-MAML works and why it is a more suitable approach than MAML for the few-shot one-class classiﬁcation (FS-OCC) problem. We remind the reader that to address this latter problem, we aim to ﬁnd a model parameter initialization, from which adaptation, i.e. performing few gradient steps, using few data examples from only one class yields a good performance on both classes, i.e. good generalization to the class-balanced task.

Original: In order tomimic the adaptation to unseen FS-OCC tasks withCIR c = c target at test time, the CIR of the batches used for adaptation during meta-validation episodes is also set to c = c target .
Revised: We additionally demonstrate that adapting ﬁrst-order meta-learning algorithms, e.g. FirstOrder MAML (FOMAML) (Finn et al., 2017) and Reptile (Nichol & Schulman, 2018), to the OCC scenario as done in OC-MAML, does not yield initializations with the desired characteristics, as it is the case for OC-MAML. By using a Taylor series expansion, Nichol & Schulman (2018) approximate the gradient used in the MAML update.

Original: We note that the hyperparameter K denotes the total number of datapoints, i.e. batch size, used to perform the adaptation updates, and not the number of datapoints per class as done by Finn et al. Hence, a task with size K = 10 and CIR c = 50% is equivalent to a 2-way 5-shot classiﬁcation task.
Revised: [Equation] For simplicity of exposition, in Equation 3 we give their results for the case where only 2 gradientbased updates are performed, i.e. one adaptation update on a minibatch including K datapoints from D tr and one meta-update on a minibatch including Q datapoints from D val . We use the same notation used by Nichol & Schulman (2018), where g i and H i denote the gradient and Hessian computed on the i th minibatch at the initial parameter point φ 1 , and α gives the learning rate.

Revised: Here it is assumed that the same learning rate is used for the adaptation and meta-updates.

Revised: In Equation 3 Nichol & Schulman (2018) demonstrate that MAML partially optimizes for increasing the inner product of the gradients computed on different minibatches, which leads to parameter initializations that enable few-shot learning.

Revised: In fact, when gradients from different minibatches have a positive inner product, taking a gradient step using one of them yields a performance increase on the other (Nichol & Schulman, 2018).

Revised: Equation 3 holds also for OC-MAML.

Revised: However, in

Revised: OC-MAML the minibatches 1 and 2 have different class-imbalance rates (CIRs), since the ﬁrst minibatch includes data from only one class and the second minibatch is class-balanced.

Revised: Hence, it optimizes for increasing the inner product of the gradients computed on different minibatches with different CIRs, while MAML does the same for different class-balanced minibatches, i.e. with the same CIR c = 50% .

Revised: Consequently, OC-MAML optimizes for a parameter initialization from which taking one (or few) gradient step(s) with one-class minibatch(es) results in a performance increase on class-balanced data.

Revised: In contrast, MAML optimizes for a parameter initialization that requires class-balanced minibatches to yield the same effect.

Revised: When adapting to OCC tasks, however, only examples from one class are available.

Revised: We conclude, therefore, that using minibatches with different CIRs for meta-training, as done in OC-MAML, yields parameter initializations that are more suitable for adapting to OCC tasks.

Revised: A natural question that could arise is whether applying our modiﬁcation of MAML, i.e. using only data from the normal class for adaptation during meta-training, to other gradient-based metalearning algorithms would yield the same desired effect.

Revised: We investigate this for First-Order MAML (FOMAML)

Revised: (Finn et al., 2017) and Reptile (Nichol & Schulman, 2018).

Revised: FOMAML is a ﬁrst-order approximation of MAML, which ignores the second derivative terms.

Revised: Reptile is also a ﬁrst-order gradient-based meta-learning algorithm that learns an initialization that enables fast adaptation to test tasks using only few examples from each class.

Revised: In the following we demonstrate that adapting the FOMAML and Reptile algorithms to the one-class classiﬁcation scenario, to which we will refer as OC-FOMAML and OC-Reptile, does not result in optimizing for an initialization suitable for

Revised: OCC tasks, as it is the case for OC-MAML.

Revised: We note that for OC-Reptile, the ﬁrst ( N − 1) batches contain examples from only one class and the last ( N th ) batch is class-balanced.

Revised: [Equation]

Revised: The approximations of the gradients used in the FOMAML and Reptile updates are given by Equations 4 and 5 (Nichol & Schulman, 2018), respectively.

Revised: We note that these Equations hold also for

Revised: OC-FOMAML and OC-Reptile.

Revised: By taking the expectation over minibatch sampling E τ, 1 , 2 for a meta-training task τ and class-balanced minibatches 1 and 2 , Nichol & Schulman (2018) establish that E τ, 1 , 2 [ H 1 g 2 ] =

Revised: E τ, 1 , 2 [ H 2 g 1 ] .

Revised: Averaging the two sides of this latter equation results in the following equation:

Revised: [Equation]

Revised: Equation 6 shows that, in expectation, FOMAML and Reptile, like MAML, optimize for increasing the inner product of the gradients computed on different minibatches with the same CIR.

Revised: However, when the minibatches 1 and 2 have different CIRs, which is the case for OC-FOMAML and

Revised: OC-Reptile, E τ, 1 , 2 [ H 1 g 2 ] (cid:54) =

Revised: E τ, 1 , 2 [ H 2 g 1 ] and therefore E τ, 1 , 2 [ H 2 g 1 ] (cid:54) = 12 E τ, 1 , 2 [ ∂ ( g 1 .g 2 ) ∂φ 1 ] .

Revised: Hence, even though, similarly to OC-MAML, OC-FOMAML and OC-Reptile use minibatches with different CIRs for meta-training, contrarily to OC-MAML, they do not optimize for increasing the inner product of the gradients computed on different minibatches with different CIRs.

Revised: The second derivative term H 1 g 2 is, thus, necessary to optimize for an initialization from which performance increase on a class-balanced task is yielded by taking few gradient steps using only data from one class.

Original:  R ELATED WORKS
Revised:  R ELATED WORKS

Original: The method we propose aims to address the few-shot one-class classiﬁcation (FS-OCC) problem, i.e. solving binary classiﬁcation problems using only few datapoints from only one class.
Revised: The method we propose aims to address the few-shot one-class classiﬁcation (FS-OCC) problem, i.e. solving binary classiﬁcation problems using only few datapoints from only one class.

Original: To the best of our knowledge, this problem was only addressed by Kozerawski & Turk (2018), and exclusively in the image data domain.
Revised: To the best of our knowledge, this problem was only addressed by Kozerawski & Turk (2018), and exclusively in the image data domain.

Original: Kozerawski & Turk (2018) train a feed-forward neural network (FFNN) to learn a transformation from feature vectors, extracted by a CNN pre-trained on ILSVRC(Russakovsky et al., 2015), to SVM decision boundaries.
Revised: Kozerawski & Turk (2018) train a feed-forward neural network (FFNN) to learn a transformation from feature vectors, extracted by a CNN pre-trained on ILSVRC(Russakovsky et al., 2015), to SVM decision boundaries.

Original: Hereby, the FFNN is trained on ILSVRC 2012.
Revised: Hereby, the FFNN is trained on ILSVRC 2012.

Original: At test time, a SVM boundary is inferred by using one image of one class from the test task, and then used to classify the query examples.
Revised: At test time, a SVM boundary is inferred by using one image of one class from the test task, and then used to classify the query examples.

Original: This approach is speciﬁc to the image domain since it relies on the availability of very large, well annotated datasets and uses data augmentation techniques speciﬁc to the image domain, e.g. mirroring.
Revised: This approach is speciﬁc to the image domain since it relies on the availability of very large, well annotated datasets and uses data augmentation techniques speciﬁc to the image domain, e.g. mirroring.

Original: OC-MAML offers a more general approach to FSOCC since it is data-domain-agnostic.
Revised: OC-MAML offers a more general approach to FSOCC since it is data-domain-agnostic.

Original: In fact, it does not require a pre-trained feature extraction model, which might not be available for some data domains, e.g. sensor readings.
Revised: In fact, it does not require a pre-trained feature extraction model, which might not be available for some data domains, e.g. sensor readings.

Original: Instead, we learn a parameter initialization of a single model such that gradient-based ﬁnetuning using only few datapoints from unseen OCC tasks leads to good generalization.
Revised: Instead, we learn a parameter initialization of a single model such that gradient-based ﬁnetuning using only few datapoints from unseen OCC tasks leads to good generalization.

Original: We successfully validate our approach on datasets from the image and the time-series domains.
Revised: We successfully validate our approach on datasets from the image and the time-series domains.

Original: In the following, we present works related to few-shot classiﬁcation and one-class classiﬁcation separately, since the intersection of these two ﬁelds remains rather unexplored.
Revised: In the following, we present works related to few-shot classiﬁcation and one-class classiﬁcation separately, since the intersection of these two ﬁelds remains rather unexplored.

Original: 3. F EW - SHOT CLASSIFICATION
Revised: 3. F EW - SHOT CLASSIFICATION

Original: The most recent approaches for few-shot classiﬁcation may be broadly categorized in optimizationbased methods (Ravi & Larochelle, 2016; Finn et al., 2017; Li et al., 2017; Nichol & Schulman, 2018) and metric-based methods (Koch, 2015;
Revised: The most recent approaches for few-shot classiﬁcation may be broadly categorized in optimizationbased methods (Ravi & Larochelle, 2016; Finn et al., 2017; Li et al., 2017; Nichol & Schulman, 2018) and metric-based methods (Koch, 2015;

Original: Vinyals et al., 2016;
Revised: Vinyals et al., 2016;

Original: Snell et al., 2017; Sung et al., 2018).
Revised: Snell et al., 2017; Sung et al., 2018).

Original: The optimization-based approaches aim to learn an optimization algorithm (Ravi &
Revised: The optimization-based approaches aim to learn an optimization algorithm (Ravi &

Original: Larochelle, 2016) and/or a parameter initialization (Finn et al., 2017; Li et al., 2017; Nichol &
Revised: Larochelle, 2016) and/or a parameter initialization (Finn et al., 2017; Li et al., 2017; Nichol &

Original: Schulman, 2018), that is tailored for few-shot learning.
Revised: Schulman, 2018), that is tailored for few-shot learning.

Original: Metric-based techniques learn a metric space where samples belonging to the same class are close together, which facilitates few-shot classiﬁcation (Koch, 2015; Vinyals et al., 2016; Snell et al., 2017; Sung et al., 2018).
Revised: Metric-based techniques learn a metric space where samples belonging to the same class are close together, which facilitates few-shot classiﬁcation (Koch, 2015; Vinyals et al., 2016; Snell et al., 2017; Sung et al., 2018).

Original: Rusu et al.
Revised: Rusu et al.

Original: (2018) develops a hybrid method that combines the advantages of both categories.
Revised: (2018) develops a hybrid method that combines the advantages of both categories.

Original: Prior meta-learning approaches to few-shot classiﬁcation addressed the N -way K -shot classiﬁcation problem described in Section 2.1.
Revised: Prior meta-learning approaches to few-shot classiﬁcation addressed the N -way K -shot classiﬁcation problem described in Section 2.1.

Original: Consequently, they only consider neatly class-balanced test classiﬁcation tasks.
Revised: Consequently, they only consider neatly class-balanced test classiﬁcation tasks.

Original: Optimization-based techniques require these samples for ﬁnetuning during the adaptation phase (Ravi & Larochelle, 2016; Finn et al., 2017; Li et al., 2017; Nichol & Schulman, 2018).
Revised: Optimization-based techniques require these samples for ﬁnetuning during the adaptation phase (Ravi & Larochelle, 2016; Finn et al., 2017; Li et al., 2017; Nichol & Schulman, 2018).

Original: As for the metric-based methods, these samples are necessary to compute the class proto- types (Snell et al., 2017), the embeddings needed for veriﬁcation (Koch, 2015) or the relation scores (Sung et al., 2018).
Revised: As for the metric-based methods, these samples are necessary to compute the class prototypes (Snell et al., 2017), the embeddings needed for veriﬁcation (Koch, 2015) or the relation scores (Sung et al., 2018).

Original: Our approach, however, requires only samples from one of the test task’s classes for learning.
Revised: Our approach, however, requires only samples from one of the test task’s classes for learning.

Original: Moreover, while the evaluation of the previous approaches in the classiﬁcation context was limited to the image domain, we validate OC-MAML on datasets from both, the image and time-series domains.
Revised: Moreover, while the evaluation of the previous approaches in the classiﬁcation context was limited to the image domain, we validate OC-MAML on datasets from both, the image and time-series domains.

Original: Some metric-based meta-learning methods can perform zero-shot classiﬁcation, i.e. they do not require any samples from the test task to learn it (Snell et al., 2017; Sung et al., 2018).
Revised: Some metric-based meta-learning methods can perform zero-shot classiﬁcation, i.e. they do not require any samples from the test task to learn it (Snell et al., 2017; Sung et al., 2018).

Original: To do so, however, they rely on having meta-data from each of the test task’s classes, which is available only for few datasets and requires domain knowledge.
Revised: To do so, however, they rely on having meta-data from each of the test task’s classes, which is available only for few datasets and requires domain knowledge.

Original: 3. O NE - CLASS CLASSIFICATION
Revised: 3. O NE - CLASS CLASSIFICATION

Original: Classical OCC approaches rely on SVMs (Sch¨olkopf et al., 2001; Tax & Duin, 2004) to distinguish between normal and abnormal samples.
Revised: Classical OCC approaches rely on SVMs (Sch ¨ olkopf et al., 2001; Tax & Duin, 2004) to distinguish between normal and abnormal samples.

Original: However, a series of classiﬁcation analyses conducted by
Revised: However, a series of classiﬁcation analyses conducted by

Original: Pal & Foody (2010) shows that the classiﬁcation accuracy of SVMs decreases with an increasing number of input features, particularly when small datasets are available for training.
Revised: Pal & Foody (2010) shows that the classiﬁcation accuracy of SVMs decreases with an increasing number of input features, particularly when small datasets are available for training.

Original: Hybrid approaches combining SVM-based techniques with feature extractors were developed to compress the input samples in lower dimensional representations (Xu et al., 2015; Erfani et al., 2016; Andrews et al., 2016).
Revised: Hybrid approaches combining SVM-based techniques with feature extractors were developed to compress the input samples in lower dimensional representations (Xu et al., 2015; Erfani et al., 2016; Andrews et al., 2016).

Original: Fully deep methods that jointly perform the feature extraction step and the OCC step have also been developed (Ruff et al., 2018).
Revised: Fully deep methods that jointly perform the feature extraction step and the OCC step have also been developed (Ruff et al., 2018).

Original: Another category of approaches to OCC use the reconstruction error of antoencoders (Hinton & Salakhutdinov, 2006) trained with only normal class examples as an anomaly score (Hawkins et al., 2002; An & Cho, 2015; Chen et al., 2017).
Revised: Another category of approaches to OCC use the reconstruction error of antoencoders (Hinton & Salakhutdinov, 2006) trained with only normal class examples as an anomaly score (Hawkins et al., 2002; An & Cho, 2015; Chen et al., 2017).

Original: Yet, determining a decision threshold for such an anomaly score requires labeled data from both classes.
Revised: Yet, determining a decision threshold for such an anomaly score requires labeled data from both classes.

Original: Further more recent techniques rely on GANs (Goodfellow et al., 2014) to perform OCC (Schlegl et al., 2017; Ravanbakhsh et al., 2017; Sabokrou et al., 2018).
Revised: Further more recent techniques rely on GANs (Goodfellow et al., 2014) to perform OCC (Schlegl et al., 2017; Ravanbakhsh et al., 2017; Sabokrou et al., 2018).

Original: The aforementioned hybrid and fully deep approaches require a considerable amount of data from the target OCC task to train the typically highly parametrized models and, by these means, learn features speciﬁc to the normal class.
Revised: The aforementioned hybrid and fully deep approaches require a considerable amount of data from the target OCC task to train the typically highly parametrized models and, by these means, learn features speciﬁc to the normal class.

Original: By leveraging auxiliary OCC tasks and explicitly optimizing for few-shot learning, OC-MAML learns a representation that can be easily adapted to the target
Revised: By leveraging auxiliary OCC tasks and explicitly optimizing for few-shot learning, OC-MAML learns a representation that can be easily adapted to the target

Original: OCC task, requiring only few of its datapoints.
Revised: OCC task, requiring only few of its datapoints.

Original:  E XPERIMENTAL EVALUATION
Revised:  E XPERIMENTAL EVALUATION

Original: We evaluate our approach on four different datasets. The conducted experiments 1 aim to address the following key questions: ( a ) How does OC-MAML perform for different class-imbalance rates (CIRs) and adaptation set sizes ( K ), and particularly how good is the adaptation to OCC tasks in the few-shot  regime?
Revised: The conducted experiments 1 aim to address the following key questions: ( a ) How does OC-MAML perform compared to classical one-class classiﬁcation (OCC) approaches in the few-shot (FS) data regime?

Original: ( b ) Does using OCC tasks for meta-training improve  adaptation to such tasks, as it is the case for few-shot tasks (Finn et al., 2017)?
Revised: ( b ) Does using OCC tasks for meta-training improve the adaptation to such tasks, as it is the case for few-shot tasks (Finn et al., 2017), and do our theoretical ﬁndings (Section 2.3.2) about the differences between the MAML and OC-MAML initializations hold in practice?

Original: ( c ) How does OC-MAML  perform in few-shot one-class classiﬁcation (FS-OCC) problems from the time-series data domain, and how mature is it for industrial real-world applications?
Revised: ( c ) How does OC-MAML compare to the ﬁrst-order meta-learning algorithms adapted to the OCC scenario, i.e. OC-FOMAML and OC-Reptile (Section 2.3.2)? ( d ) How does OC-MAML perform in FSOCC problems from the time-series data domain, which is underexplored in the few-shot learning literature?

Original: 4. B ASELINES 
Revised: 4. B ASELINES AND D ATASETS

Original: MAML:
Revised: This section provides information about the baselines and datasets we use in our experimental evaluation. We compare OC-MAML to the classical one-class classiﬁcation (OCC) approaches One-Class SVM (OC-SVM) (Sch¨olkopf et al., 2001) and Isolation Forest (IF) (Liu et al., 2008)

Original: In order toaddress the second question and investigate the beneﬁt ofour modiﬁcation to the MAML’s adaptation objective, we compare to MAML (Finn et al., 2017) which optimizes for class-balanced adaptation, independently of the CIR of the target task.
Revised: (Question ( a ) ), which we ﬁt to the adaptation set of the test task. Here, we apply PCA to reduce the dimensionality of the data, by choosing the minimum number of eigenvectors so that at least 95% of the variance is preserved as done by Erfani et al. We additionally tune the inverse length scale γ by using 10% of the test set, as done by Ruff et al. (2018), which gives OC-SVM a supervised advantage, compared to the other methods.

Original: Multi-task learning (MTL): This baseline uses thetasks available for meta-training S tr to train a feature extractor in a multi-task setting andthen learns a classiﬁer for the target task on top of it, via transfer learning. Single task learning (STL): This baseline is trainedfrom scratch usingonly the target task’s data.
Revised: For a fairer comparison to OC-MAML, where these latter methods also beneﬁt from the meta-training and meta-validation tasks, we additionally train them on embeddings inferred by feature extractors learned on these tasks. Here, we train two types of feature extractors on the meta-training tasks: one is trained in a Multi-Task-Learning (MTL) setting and the other trained using the ”Finetune” baseline (FB)

Original: In allbaseline experiments, we balance the classes  of the target task(s) by randomly oversampling the minority class.
Revised: (Triantaﬁllou et al., 2019). FB is a few-shot classiﬁcation approach, where one multi-class classiﬁer is trained with all the classes available in all meta-training tasks, after which, an output layer is ﬁnetuned with the few available examples of the target task on top of the learned feature extractor.

Original: We use the same convolutional neural network architecture for OC-MAML, MAML and STL. For MTL, an additional fully connected layer is used for each task.
Revised: Moreover, we compare OC-MAML to class-balanced meta-learning algorithms, namely MAML, FOMAML and Reptile, as well as ﬁrstorder meta-learning algorithms adapted to the OCC scenario, i.e. OC-FOMAML and OC-Reptile (Questions ( b ) and ( c ) ).

Original: Experimental details including hyperparameters and model architectures are provided in Appendix A.
Revised: Experimental details including hyperparameters and model architectures are provided in Appendix B.

Original: In this Section we provide information about the datasets used and  the task creation procedures.
Revised: We evaluate our approach on six datasets, including 3 from the image domain and 3 from the timeseries domain.

Original: Multi-task MNIST (MT-MNIST): We derive 10 binary classiﬁcation tasks from the MNIST dataset (LeCun et al., 2010), where every task consists in recognizing one of the digits. This is a classical one-class classiﬁcation benchmark  dataset.
Revised: In the image domain we use 2 few-shot learning benchmark datasets, namely MiniImageNet (Ravi & Larochelle, 2016) and Omniglot (Lake et al., 2015), and one OCC benchmark dataset, namely the Multi-Task MNIST (MT-MNIST) dataset.

Original: For a particular task T i , images of the digit i are labeled as normal samples, while out-of-distribution samples, i.e. the other digits, are labeled as anomalous samples. We use 8 tasks for meta-training, 1 for meta-validation and 1 for meta-testing. Hereby, images of digits tobe recognized in the validation and test tasks are not used as anomalies in the meta-training tasks. This ensures that themodel is not exposed to normal samples from  the test task during meta-training.
Revised: To adapt the datasets to the OCC scenario, we create binary classiﬁcation tasks, where the normal class contains examples from one class of the initial dataset and the anomalous class contains examples from multiple other classes.

Original: Moreover, the sets of anomalous samples of the meta-training, meta-validation and meta-testing tasks are mutually disjoint. We conduct experiments on 9MTMNIST datasets, each of which involves a different target task ( T 0 − T 8 ).
Revised: We create 9 different datasets based on MNIST, where the meta- testing task of each dataset consists in differentiating between a certain digit and the others.

Original: The task T 9 is used as a meta-validation task  across all experiments.
Revised: We use the same ( 10 th ) task for meta validation across all datasets.

Original: MiniImageNet: This dataset was proposed by Ravi & Larochelle (2016) and includes 64 classes for training, 16 for validation and 20 for testing, and is a classical challenging benchmark dataset for few-shot learning. To adapt it to the few-shot one-class classiﬁcation setting, we create 64 binary classiﬁcation tasks for meta-training, each of which consists in differentiating one of the training classes from  the others, i.e. the anomalous examples of a task T i are randomly sampled from theclasses with labels differentfrom i . We do the same to create 16 meta-validation and 20 meta-testing tasks using the corresponding classes. Synthetic time-series (STS):
Revised: Since most of the time-series datasets for anomaly detection include data from only one domain and only one normal class, adapting them to the meta-learning problem formulation where several different tasks are required is not possible.

Original: In order to investigate the applicability of OC-MAML to time-series (question ( c ) ), we created two  datasets, each including 30 synthetically generated time-series that underlie 30 different anomaly detection tasks.
Revised: Therefore, we create two synthetic time-series (STS) datasets, each including 30 synthetically generated time-series that underlie 30 different anomaly detection tasks, to assess the suitability of OC-MAML to time-series data (Question ( d ) ).

Original: The time-series underlying the datasets are sawtooth waveforms (STS-Sawtooth) and sine functions (STS-Sine).
Revised: The time-series underlying the datasets are sawtooth waveforms (STS-Sawtooth) and sine functions (STS-Sine).

Original: Each time-series is generated with random frequencies, amplitudes, noise boundaries, as well as anomaly width and height boundaries. Additionally, the width of the rising ramp as a proportion of the total cycle is sampled randomly for the sawtooth dataset, which results intasks having rising and falling ramps with different steepness values. The data samples of a particular task are generated by randomly cropping windows of length 128 from the corresponding time-series. We generate 200 normal and 200 anomalous data examples for each task.
Revised: We propose the STS-datasets as benchmark datasets for the few-shot (one-class) classiﬁcation problem in the time-series domain.

Original: Details about the data generation procedure as well as ﬁgures of exemplary signals are presented in Appendix B.1. For each dataset, we randomly choose 20 tasks for meta-training,for meta-validation and 5 for meta-testing. We propose the STS-datasets as benchmark datasets for the few-shot one-class classiﬁcation problem in the time-series domain, and will make them public upon paper acceptance. CNC Milling Machine Data (CNC-MMD): This datasetconsists of ca.
Revised: Finally, we validate OC-MAML on a real-world anomaly detection dataset of sensor readings recorded during industrial manufacturing using a CNC milling machine.

Original: 100 aluminum workpieces on which various consecutive roughing and ﬁnishing operations (pockets, edges, holes, surface ﬁnish) are performed.
Revised: Various consecutive roughing and ﬁnishing operations (pockets, edges, holes, surface ﬁnish) were performed on ca.

Original: The sensor readings which were recorded at a rate of 500Hz measure various quantities that are important for the process monitoring including the torques of the various axes. Each run of machining a single workpiece can be seen as a multivariate time-series. We segmented the data of each run in the various operations performed on the workpieces. E.g. one segment would describe the milling of a pocket where another describes a surface ﬁnish operation on the workpiece.
Revised: 100 aluminium workpieces to record the CNC Milling Machine Data (CNCMMD).

Original: Since most manufacturing processes are highly efﬁcient, anomalies are quite rare but can be very costly if undetected. For this reason, anomalies were provoked for 6 operations during manufacturing to provide a better basis for the analysis.
Revised: We give details about all 6 dataset, the task creation procedures adopted to adapt them to the OCC case, as well as the generation of the STS-datasets in Appendix C.

Original: The data was labeled by domain experts from Siemens Digital Industries. It should be noted that this dataset more realistically reﬂects the data situation in many real application scenarios from industry where anomalies are rare and data is scarce and for this reason training models on huge class-balanced datasets is not an option. For our experiments, we created 30 tasks per operation by randomly cropping windows of length 2048 from the corresponding time-series of each operation.
Revised: 4. R ESULTS AND D ISCUSSION

Original: As a result, the data samples ofa particular task T i cropped from a milling operation O j correspond to the same trajectory part of O j , but to different workpieces.
Revised: Our results of the comparison between OC-MAML and the classical OCC approaches on the 3 image datasets and on the STS-Sawtooth dataset are summarized in Table 1.

Original: The task creation procedure ensures that at least two anomalous data samples are available for each task.
Revised: OC-MAML consistently outperforms all baselines across all datasets and on both adaptation set sizes.

Original: The resulting tasks include between 15 and 55 normal samples, and between 2 and 4 (9 and 22) anomalous samples for ﬁnishing (roughing) operations. We validate our approach on all 6 milling operations in the case where only 10 samples belonging to the normal class (K = 10 , c = 0% ) are available. Given the type of the target milling operation,e.g. ﬁnishing,
Revised: While FB and MTL yield relatively good performance when adapting to class-balanced tasks ( c = 50% ), they completely fail in adapting to OCC tasks.

Original: [Table] we use the tasks from the other operations of the same type for meta-training. We note that the model is not exposed to any sample belonging to any task of the target operation during training. 4. R ESULTS
Revised: Test accuracies close to 50% show that the baselines overﬁt to the few adaptation examples and are, hence, not able to generalize to unseen examples.

Original: Our results on MT-MNIST with T test = T 0 , on MiniImageNet andon STS-Sawtooth are summarized in Table 1. The results on the MT-MNIST datasets of the other digits and on the STS-Sine (see Appendix C) are consistent with the results in Table 1.
Revised: On the MT-MNIST dataset and the STS-Sawtooth dataset, some of the baselines that combine a feature extractor and a shallow model yield high performance, when an adaptation set size of K = 10 is used.

Original: We note that in the class-balanced case ( c target = 50% ), OC-MAML is equivalent to MAML. We choose the F1-score metric as evaluation metric, since it focuses on the model performance on the minority class, i.e. in detecting anomalies, which is more important in the anomaly detection applications.
Revised: We explain that by the lower variance between the meta-training and meta-testing tasks in these datasets.

Original: OC-MAML consistently outperforms all the baseline by a signiﬁcant margin in all OCC experiments, i.e. c target ∈ { 0% , 1% } , across all target task sizes K , on all datasets. The performance gap between  the MAML and OC-MAML models shows that explicitly optimizing for high classimbalance learning, i.e. learning with few or no anomalous samples, yields an initialization that enables a more successful adaptation to unseen OCC tasks. While MAML learns relatively good model initializations when the target OCC task size is small ( K ∈ { 2 , 10 } ) , it completely fails at doing so for higher task sizes ( K = 100) , particularly in the absence of anomalous samples ( c = 0%) .
Revised: Our results of the comparison between OC-MAML and the classical few-shot classiﬁcation approaches on the 3 image datasets and on the STS-Sawtooth dataset are summarized in Table 2.

Original: This holds for all 9 MT-MNIST, MiniImageNet and  STS-Sine datasets.
Revised: The results of the OCC and few-shot classiﬁcation baselines on the other 8 MT-MNIST datasets and on the STS-Sine dataset are presented in Appendix D and are consistent with the results in Tables 1 and 2.

Original: We note that, when the target task is class-balanced, MAML’s performance increases with an increasing task size
Revised: We observe that OC-MAML consistently outperforms the other meta-learning algorithms with a substantial margin on all datasets and for both adaptation set sizes. This conﬁrms our theoretical

Original: K .
Revised: [Table]

Original: Two questions can arise from this observation: (1) How can MAML learn a good initialization for adapting to OCC tasks, despite optimizing for few-shot class-balanced classiﬁcation? and (2) Why does this only happen in the few-shot regime ( K ∈ { 2 , 10 } ) ?
Revised: [Table] ﬁndings (Section 2.3.2) that the initializations yielded by class-balanced meta-learning algorithms as well as OC-FOMAML and OC-Reptile are not optimized for adaptation using data from only one class.

Original: In the following, we give a potential explanation for these questions. In a gradient descent update, using fewer datapoints tocompute the loss gradient leads to a higher stochasticity in the direction ofthis latter. This is due to the noise introduced by the sampling operation ofthese datapoints from all datapoints deﬁning the task considered (Goodfellow et al., 2016).
Revised: These latter yield test accuracies close to 50% showing that they overﬁtted to the normal class. In an attempt to increase the performance of the other meta-learning algorithms in the OCC scenario, we add a batch normalization (BN) (Ioffe & Szegedy, 2015) layer immediately before the output layer of the network.

Original: During meta-training, MAML optimizes for good generalization on a given task, independently of which Kof its datapoints are used for adaptation. Hence, lower values of K lead to learning initializations that tolerate higher loss gradient stochasticities at adaptation time.
Revised: This BN operation standardizes the latent features using the mean and standard deviation of the K datapoints available for adaptation, which all belong to the normal class. As a result, this layer would output features with mean close to 0 and standard deviation close to 1 for normal class examples.

Original: Since datapoints from different classes yield different loss gradient directions, we can say that changing the CIR of a batch of  datasamples also induces gradient stochasticity. We explain MAML’s ability to adapt to OCC tasks, despite being trained for class-balanced learning, by its ability to tolerate gradient stochasticity acquired during few-shot meta-training. In other words, the resistance to gradient stochasticity
Revised: In contrast, anomalous examples would yield features with other statistics, which simpliﬁes their detection. We hypothesize that by enforcing a mapping of the data to a latent space standardized only by examples from the normal class, the anomalies would clearly fall out

Original: [Table]
Revised: [Table]

Original: acquired by few-shot learning is used to enable class-imbalance learning.
Revised: of the normal-class-distribution, making their detection easier. We note that the BN layer is used during meta-training as well.

Original: Since this ability is only acquired when optimizing for few-shot learning ( K ∈ { 2 , 10 } ) , MAML fails at adapting to OCC tasks when K = 100 . The model initializations learned by OC-MAML, however, enable quick adaptation to OCC tasks in both, the few-shot and the many-shot data regimes.
Revised: Hereby, we ﬁx the learnable scaling ( γ ) and centering ( β ) parameters of the BN layer to 1 and 0 , respectively, to prevent it from shifting the standard distribution. We ﬁnd that this simple modiﬁcation substantially increases the performance of the other metalearning algorithms on all image datasets.

Original: The superior performance of OC-MAML shows the beneﬁt of explicitly optimizing for OCC.
Revised: However, OC-MAML without BN still yields the highest results, with only one exception.

Original: Besides outperforming
Revised: The higher performance increase when a bigger adaptation set is available ( K = 10 ) conﬁrms our hypothesis that enforcing a mapping of the data to a latent space standardized only by examples from the normal class makes the detection of the anomalies easier.

Original: MAML in terms of adapted model’s performance, OC-MAML enables a faster and more stable meta-training, in the absence ofanomalous examples, in the few-shot and many-shot data regimes.
Revised: In fact, using more examples yields more accurate mean and standard deviation measures, which enables a better approximation of the distribution of the normal class, and hence leads to an improved detection of the anomalies.

Original: The faster learning is indicated by the higher steepness of the validation F1-score curves at the beginning of meta-training in Figure 4.3.
Revised: We also tested these algorithms on networks including a trainable BN layer after each convolutional layer. This yielded comparable results to just adding one non-trainable BN layer before the output layer.

Original: The results of OC-MAML experiments on the CNC-MMD dataset are presented in Table 2.
Revised: The results of OC-MAML experiments on the CNC-MMD dataset are presented in Table 3.

Revised: Here, we choose the F1-score as evaluation metric since the test sets are class-imbalanced.

Original: OCMAML consistently achieves high F1-scores between, ca.
Revised: OC-MAML consistently achieves high F1-scores between, ca.

Original: 80% and ca.
Revised: 80% and ca.

Original: 96% , across the 6 different milling processes.
Revised: 96% , across the 6 different milling processes.

Original: This high model performance on the minority class, i.e. in detecting anomalous data samples, is reached by using only K = 10 non-anomalous data samples ( c = 0% ).
Revised: This high model performance on the minority class, i.e. in detecting anomalous data samples, is reached by using only K = 10 non-anomalous data samples ( c = 0% ).

Original: These results show that OC-MAML yielded a parameter initialization suitable for learning OCC tasks in the time-series data domain.
Revised: These results show that OC-MAML yielded a parameter initialization suitable for learning OCC tasks in the timeseries data domain.

Original: Moreover, the high performance reached show the maturity of this method for industrial real-world applications.
Revised: Moreover, the high performance reached show the maturity of this method for industrial real-world applications.

Original:  C ONCLUSION
Revised:  C ONCLUSION

Original: This work addressed the novel and challenging problem of few-shot one-class classiﬁcation (FSOCC). We introduced OC-MAML, a meta-learning approach to FS-OCC problems that learns model parameters which are easily adaptable to unseen tasks using few datapoints from only one class.
Revised: This work addressed the novel and challenging problem of few-shot one-class classiﬁcation (FSOCC) and introduced OC-MAML, a meta-learning approach to FS-OCC problems that learns model parameters which are easily adaptable to unseen tasks using few datapoints from only one class.

Original: We demonstrated the viability of our method on four datasets from the imageand time-series domain, including a real-world dataset of industrial sensor readings.
Revised: We demonstrated the viability of our method on six datasets from the image time-series domains, including a real-world dataset of industrial sensor readings, where it signiﬁcantly outperformed classical

Original: Our approach is simple, fast and data domain agnostic.
Revised: OCC and few-shot classiﬁcation methods.

Original: Future works could focus on designing an unsupervised approach to the FS-OCC problem, as done by Hsu et al.
Revised: Future works could focus on designing an unsupervised approach to the FS-OCC problem, as done by Hsu et al.

Original: (2018) for thefew-shot class-balanced classiﬁcation problem.
Revised: (2018) in the class-balanced scenario. A A LGORITHM

Revised: In this section we present a detailed pseudo-code of OC-MAML in Algorithm 1.

Revised: Require: S tr : Set of meta-training tasks

Original: A E XPERIMENT D ETAILS
Revised: Require: α, β : Learning rates Require: K, Q : Batch size for the inner and outer updates Require: c : CIR for the inner-updates 1: Randomly initialize θ 2: while not done do 3: Sample batch of tasks T i from S tr Let { D tr , D val } =

Revised: T i 4: for all sampled T i do 5:

Revised: Sample K datapoints B = { x ( l ) , y ( l ) } from D tr such that CIR = c 6:

Revised: Initialize θ (cid:48)

Revised: i

Revised: = θ 7: for number of adaptation steps do 8:

Revised: Compute adaptation loss L trT i ( f θ (cid:48) i ) using B 9:

Revised: Compute adapted parameters with gradient descent: θ (cid:48)

Revised: i

Revised: = θ (cid:48)

Revised: i − α ∇ θ (cid:48)

Revised: i

Revised: L trT i ( f θ (cid:48) i ) 10: end for 11:

Revised: Sample Q datapoints B (cid:48)

Revised: = { x (cid:48) ( l ) , y (cid:48)

Revised: ( l ) } from D val 12:

Revised: Compute outer loop loss L valT i ( f θ (cid:48) i ) using B (cid:48) 13: end for 14:

Revised: Update θ : θ ← θ − β ∇ θ (cid:80) T

Revised: [Table]

Revised: valT i (

Revised: [Table]

Revised: (cid:48) i ) 15: end while 16: return meta-learned parameters θ

Original: For MT-MNIST, we use the same 4-block convolutional architecture as used by Hsu et al.
Revised: For MT-MNIST, we use the same 4-block convolutional architecture as used by Hsu et al.

Original: (2018) for their multi-class MNIST experiments, where each block includes a 3 x 3 convolutional layer with 32 ﬁlters, a 2 x 2 pooling, a batch normalization layer (Ioffe & Szegedy, 2015) and a ReLU nonlinearity.
Revised: (2018) for their multi-class MNIST experiments, where each block includes a 3 x 3 convolutional layer with 32 ﬁlters, a 2 x 2 pooling, a batch normalization layer (Ioffe & Szegedy, 2015) and a ReLU nonlinearity.

Original: The same model architecture is used for the MiniImageNet experiments as done by Ravi &
Revised: The same model architecture is used for the MiniImageNet experiments as done by Ravi &

Original: Larochelle (2016).
Revised: Larochelle (2016).

Original: On the STS datasets, the model architecture used is composed of 3 modules, each including a 5 x 5 convolutional layer with 32 ﬁlters, a 2 x 2 pooling and a ReLU non-linearity.
Revised: On the STS datasets, the model architecture used is composed of 3 modules, each including a 5 x 5 convolutional layer with 32 ﬁlters, a 2 x 2 pooling and a ReLU non-linearity.

Original: The model architecture used for the CNC-MMD experiments is composed of 4 of these aforementioned modules, except that the convolutional layers in the last two modules include 64 ﬁlters.
Revised: The model architecture used for the CNC-MMD experiments is composed of 4 of these aforementioned modules, except that the convolutional layers in the last two modules include 64 ﬁlters.

Original: The last layer of all architectures is a linear layer followed by softmax.
Revised: The last layer of all architectures is a linear layer followed by softmax.

Original: We note that in the experiments on the time-series datasets (STS and CNC-MMD) 1-D convolutional ﬁlters are used.[Table]
Revised: We note that in the experiments on the time-series datasets (STS and CNC-MMD) 1-D convolutional ﬁlters are used.

Original: Table 3 shows the hyperparameters used in the experiments of each model on the different datasets.
Revised: Table 4 shows the hyperparameters used in the experiments of each model on the different datasets.

Original: We note that we did not ﬁx the outer loop size Q in the experiments on the CNC-MMD dataset, because the sizes and CIRS of the validation sets D val differ across the different tasks.
Revised: We note that we did not ﬁx the outer loop size Q in the experiments on the CNC-MMD dataset, because the sizes and CIRS of the validation sets D val differ across the different tasks.

Original: In the
Revised: In the

Original: MAML and OC-MAML experiments, we used vanilla SGD in the inner loop and the Adam optimizer (Kingma & Ba, 2014) in the outer loop, as done by Finn et al.
Revised: MAML and OC-MAML experiments, we used vanilla SGD in the inner loop and the Adam optimizer (Kingma & Ba, 2014) in the outer loop, as done by Finn et al.

Original: The STL and MTL baselines are also trained with the Adam optimizer. 
Revised: The STL and MTL baselines are also trained with the Adam optimizer. [Table]

Original: In the following, we provide details about the meta-training procedure adopted in the MAML and OC-MAML experiments.
Revised: In the following, we provide details about the meta-training procedure adopted in the MAML and OC-MAML experiments.

Original: We use disjoint sets of data for adaptation ( D tr ) and validation ( D val ) on the meta-training tasks, as it was empirically found to yield better ﬁnal performance (Nichol & Schulman, 2018).
Revised: We use disjoint sets of data for adaptation ( D tr ) and validation ( D val ) on the meta-training tasks, as it was empirically found to yield better ﬁnal performance (Nichol & Schulman, 2018).

Original: Hereby, the same sets of data are used in the MAML and OC-MAML experiments.
Revised: Hereby, the same sets of data are used in the MAML and OC-MAML experiments.

Original: In the MT-MNIST, MiniImageNet and STS experiments, the aforementioned sets of data are class-balanced.
Revised: In the MT-MNIST, MiniImageNet and STS experiments, the aforementioned sets of data are class-balanced.

Original: The sampling of the batch used for adaptation B ensures that this latter has the appropriate CIR ( c = 50% for MAML and c = c target for OC-MAML).
Revised: The sampling of the batch used for adaptation B ensures that this latter has the appropriate CIR ( c = 50% for MAML and c = c target for OC-MAML).

Original: In the OC-MAML experiments, where c target = 0% , i.e. no anomalous samples of the target task are available, only normal examples are sampled from D tr during meta-training.
Revised: In the OC-MAML experiments, where c target = 0% , i.e. no anomalous samples of the target task are available, only normal examples are sampled from D tr during meta-training.

Original: In order to ensure that MAML and
Revised: In order to ensure that MAML and

Original: OC-MAML are exposed to the same data during meta-training, we move the anomalous examples from the adaptation set of data ( D tr ) to the validation set of data ( D val ).
Revised: OC-MAML are exposed to the same data during meta-training, we move the anomalous examples from the adaptation set of data ( D tr ) to the validation set of data ( D val ).

Original: We note that this is only done in the OC-MAML experiments, where c target = 0% .
Revised: We note that this is only done in the OC-MAML experiments, where c target = 0% .

Revised: During meta-training, meta-validation episodes are conducted to perform model selection.

Revised: In order to mimic the adaptation to unseen FS-OCC tasks with CIR c = c target at test time, the CIR of the batches used for adaptation during meta-validation episodes is also set to c = c target .

Revised: We note that the hyperparameter K denotes the total number of datapoints, i.e. batch size, used to perform the adaptation updates, and not the number of datapoints per class as done by Finn et al.

Revised: Hence, a task with size K = 10 and CIR c = 50% is equivalent to a 2-way 5-shot classiﬁcation task.

Original: In the following, we provide details about the adaptation to the target task(s) and the subsequent evaluation.
Revised: In the following, we provide details about the adaptation to the target task(s) and the subsequent evaluation.

Original: In the MT-MNIST and MiniImageNet experiments, we randomly sample 20 adaptation sets from the target task(s)’ data, each including K examples with the CIR corresponding to the experiment considered.
Revised: In the MT-MNIST and MiniImageNet experiments, we randomly sample 20 adaptation sets from the target task(s)’ data, each including K examples with the CIR corresponding to the experiment considered.

Original: After each adaptation episode conducted using one of these sets, the adapted model is evaluated on a disjoint class-balanced test set that includes 4,000 images for MT-MNIST and 600 for MiniImageNet.
Revised: After each adaptation episode conducted using one of these sets, the adapted model is evaluated on a disjoint class-balanced test set that includes 4,000 images for MT-MNIST and 600 for MiniImageNet.

Original: We note that the samples included in the test sets of the test tasks are not used nor for meta-training neither for meta-validation.
Revised: We note that the samples included in the test sets of the test tasks are not used nor for meta-training neither for meta-validation.

Original: This results in 20 and 400 (20 adaptation sets created from each of the 20 test classes) different test tasks for MT-MNIST and MiniImageNet, respectively.
Revised: This results in 20 and 400 (20 adaptation sets created from each of the 20 test classes) different test tasks for MT-MNIST and MiniImageNet, respectively.

Original: The results presented in Tables 4 and 5, i.e. mean and 95% conﬁdence intervals, are computed over all adaptation episodes.
Revised: The results presented in Tables ?? and ?? , i.e. mean and 95% conﬁdence intervals, are computed over all adaptation episodes.

Original: Likewise, in the STS experiments, we evaluate the model on 10 different adaptation sets from each of the 5 test tasks.
Revised: Likewise, in the STS experiments, we evaluate the model on 10 different adaptation sets from each of the 5 test tasks.

Original: In the CNC-MMD experiments, thetasks created from the target operation are used for adaptation and subsequent evaluation.
Revised: In the CNC-MMD experiments, thetasks created from the target operation are used for adaptation and subsequent evaluation.

Original: For each of these target tasks, we randomly sample K datapoints belonging to the normal class that we use for adaptation, and use the rest of the datapoints for testing.
Revised: For each of these target tasks, we randomly sample K datapoints belonging to the normal class that we use for adaptation, and use the rest of the datapoints for testing.

Original: We do this 5 times for each target task, which results in 150 testing tasks.
Revised: We do this 5 times for each target task, which results in 150 testing tasks.

Original: In the MT-MNIST and MiniImageNet experiments, where batch normalization (Ioffe & Szegedy, 2015) is used, we ensure that no information is shared between the test samples via batch normalization statistics.
Revised: In the MT-MNIST and MiniImageNet experiments, where batch normalization (Ioffe & Szegedy, 2015) is used, we ensure that no information is shared between the test samples via batch normalization statistics.

Original: We do so, by computing the batch normalization statistics using only the K datapointsavailable for adaptation.
Revised: We do so, by computing the batch normalization statistics using only the K datapoints

Original: These statistics are then used to evaluate the adapted model on the test set.

Original: Nichol & Schulman (2018) refer to this experiment setting as non-transductive.
Revised: Nichol & Schulman (2018) refer to this experiment setting as non-transductive.

Original: In our MTL baseline experiments, we use the meta-validation task(s) for model choice, like in the MAML and OC-MAML experiments.
Revised: In our MTL baseline experiments, we use the meta-validation task(s) for model choice, like in the MAML and OC-MAML experiments.

Original: Hereby, for each validation task, we ﬁnetune a fully connected layer on top of the shared multi-task learned layers, as it is done at test time.
Revised: Hereby, for each validation task, we ﬁnetune a fully connected layer on top of the shared multi-task learned layers, as it is done at test time.

Original: B D ETAILS ABOUT THE TIME - SERIES DATASETS STS AND CNC-MMD B. STS
Revised: C D ATASETS AND TASK CREATION PROCEDURES

Revised: In this Section we provide information about the datasets used and the task creation procedures. Multi-task MNIST (MT-MNIST): We derive 10 binary classiﬁcation tasks from the MNIST dataset (LeCun et al., 2010), where every task consists in recognizing one of the digits.

Revised: This is a classical one-class classiﬁcation benchmark dataset.

Revised: For a particular task T i , images of the digit i are labeled as normal samples, while out-of-distribution samples, i.e. the other digits, are labeled as anomalous samples.

Revised: We use 8 tasks for meta-training, 1 for meta-validation and 1 for meta-testing.

Revised: Hereby, images of digits to be recognized in the validation and test tasks are not used as anomalies in the meta-training tasks.

Revised: This ensures that the model is not exposed to normal samples from the test task during meta-training.

Revised: Moreover, the sets of anomalous samples of the meta-training, meta-validation and meta-testing tasks are mutually disjoint.

Revised: We conduct experiments on 9 MTMNIST datasets, each of which involves a different target task ( T 0 − T 8 ).

Revised: The task T 9 is used as a meta-validation task across all experiments.

Revised: MiniImageNet: This dataset was proposed by Ravi & Larochelle (2016) and includes 64 classes for training, 16 for validation and 20 for testing, and is a classical challenging benchmark dataset for few-shot learning.

Revised: To adapt it to the few-shot one-class classiﬁcation setting, we create 64 binary classiﬁcation tasks for meta-training, each of which consists in differentiating one of the training classes from the others, i.e. the anomalous examples of a task T i are randomly sampled from theclasses with labels different from i .

Revised: We do the same to create 16 meta-validation and 20 meta-testing tasks using the corresponding classes.

Revised: Synthetic time-series (STS):

Revised: In order to investigate the applicability of OC-MAML to time-series (question ( c ) ), we created two datasets, each including 30 synthetically generated time-series that underlie 30 different anomaly detection tasks.

Revised: The time-series underlying the datasets are sawtooth waveforms (STS-Sawtooth) and sine functions (STS-Sine).

Revised: Each time-series is generated with random frequencies, amplitudes, noise boundaries, as well as anomaly width and height boundaries.

Revised: Additionally, the width of the rising ramp as a proportion of the total cycle is sampled randomly for the sawtooth dataset, which results in tasks having rising and falling ramps with different steepness values.

Revised: The data samples of a particular task are generated by randomly cropping windows of length 128 from the corresponding time-series.

Revised: We generate 200 normal and 200 anomalous data examples for each task.

Original: In this Section, we give details about the  generation procedure adopted to create the STS-Sawtooth dataset.
Revised: Details about the data generation procedure as well as ﬁgures of exemplary signals are presented in Appendix C.1. For each dataset, we randomly choose 20 tasks for meta-training,for meta-validation and 5 for meta-testing. We propose the STS-datasets as benchmark datasets for the few-shot one-class classiﬁcation problem in the time-series domain, and will make them public upon paper acceptance. CNC Milling Machine Data (CNC-MMD): This dataset consists of ca.

Revised: 100 aluminum workpieces on which various consecutive roughing and ﬁnishing operations (pockets, edges, holes, surface ﬁnish) are performed.

Revised: The sensor readings which were recorded at a rate of 500Hz measure various quantities that are important for the process monitoring including the torques of the various axes.

Revised: Each run of machining a single workpiece can be seen as a multivariate time-series.

Revised: We segmented the data of each run in the various operations performed on the workpieces.

Revised: E.g. one segment would describe the milling of a pocket where another describes a surface ﬁnish operation on the workpiece.

Revised: Since most manufacturing processes are highly efﬁcient, anomalies are quite rare but can be very costly if undetected.

Revised: For this reason, anomalies were provoked for 6 operations during manufacturing to provide a better basis for the analysis.

Revised: The data was labeled by domain experts from Siemens

Revised: Digital Industries.

Revised: It should be noted that this dataset more realistically reﬂects the data situation in many real application scenarios from industry where anomalies are rare and data is scarce and for this reason training models on huge class-balanced datasets is not an option.

Revised: For our experiments, we created 30 tasks per operation by randomly cropping windows of length 2048 from the corresponding time-series of each operation.

Revised: As a result, the data samples of a particular task T i cropped from a milling operation

Revised: O j correspond to the same trajectory part of O j , but to different workpieces.

Revised: The task creation procedure ensures that at least two anomalous data samples are available for each task.

Revised: The resulting tasks include between 15 and 55 normal samples, and between 2 and 4 (9 and 22) anomalous samples for ﬁnishing (roughing) operations.

Revised: We validate our approach on all 6 milling operations in the case where only 10 samples belonging to the normal class ( K = 10 , c = 0% ) are available.

Revised: Given the type of the target milling operation,e.g. ﬁnishing, we use the tasks from the other operations of the same type for meta-training.

Revised: We note that the model is not exposed to any sample belonging to any task of the target operation during training.

Revised: C. STS

Revised: In this Section, we give details about the generation procedure adopted to create the STS-Sawtooth dataset.

Original: The same steps were conducted to generate the STS-Sine dataset.
Revised: The same steps were conducted to generate the STS-Sine dataset.

Original: First, we generate the sawtooth waveforms underlying the different tasks by using the Signal package of the Scipy library (Jones et al., 2001–).
Revised: First, we generate the sawtooth waveforms underlying the different tasks by using the Signal package of the Scipy library (Jones et al., 2001–).

Original: Thereafter, a randomly generated noise is applied to each signal.
Revised: Thereafter, a randomly generated noise is applied to each signal.

Original: Subsequently, signal segments with window length l = 128 are randomly sampled from each noisy signal.
Revised: Subsequently, signal segments with window length l = 128 are randomly sampled from each noisy signal.

Original: These represent the normal, i.e. non-anomalous, examples of the corresponding task.
Revised: These represent the normal, i.e. non-anomalous, examples of the corresponding task.

Original: Then, some of the normal examples are randomly chosen, and anomalies are added to them to produce the anomalous examples.
Revised: Then, some of the normal examples are randomly chosen, and anomalies are added to them to produce the anomalous examples.

Original: Figure 2 shows exemplary normal and anomalous samples from the STS-Sawtooth and STS-Sine datasets.
Revised: Figure 1 shows exemplary normal and anomalous samples from the STS-Sawtooth and STS-Sine datasets.

Original: In order to increase the variance between the aforementioned synthetic signals underlying the different tasks, we randomly sample the frequency, i.e. the number of periods within the window length l , with which each waveform is generated, as well as the amplitude and the vertical position (see Figure 2).
Revised: In order to increase the variance between the aforementioned synthetic signals underlying the different tasks, we randomly sample the frequency, i.e. the number of periods within the window length l , with which each waveform is generated, as well as the amplitude and the vertical position (see Figure 1).

Original: For sawtooth waveforms, we also randomly sample the width of the rising ramp as a proportion of the total cycle between 0% and 100% , for each task.
Revised: For sawtooth waveforms, we also randomly sample the width of the rising ramp as a proportion of the total cycle between 0% and 100% , for each task.

Original: Setting this value to 100% and to 0% produces sawtooth waveforms with rising and falling ramps, respectively.
Revised: Setting this value to 100% and to 0% produces sawtooth waveforms with rising and falling ramps, respectively.

Original: Setting it to 50% corresponds to triangle waveforms.
Revised: Setting it to 50% corresponds to triangle waveforms.

Original: We note that the noise applied to the tasks are randomly sampled from task-speciﬁc intervals, the boundaries of which are also randomly sampled.
Revised: We note that the noise applied to the tasks are randomly sampled from task-speciﬁc intervals, the boundaries of which are also randomly sampled.

Original: Likewise, the width and height of each anomaly is sampled from a random task speciﬁc-interval.
Revised: Likewise, the width and height of each anomaly is sampled from a random task speciﬁc-interval.

Original: Moreover, we generate the anomalies of each task, such that half of them have a height between the signal’s minimum and maximum (e.g. anomalies ( a ) and ( d ) in Figure 2), while the other half can surpass these boundaries, i.e. the anomaly is higher than the normal signal’s maximum or lower than its minimum at least at one time step (e.g. anomalies ( b ) and ( c ) in Figure 2).
Revised: Moreover, we generate the anomalies of each task, such that half of them have a height between the signal’s minimum and maximum (e.g. anomalies ( a ) and ( d ) in Figure 1), while the other half can surpass these boundaries, i.e. the anomaly is higher than the normal signal’s maximum or lower than its minimum at least at one time step (e.g. anomalies ( b ) and ( c ) in Figure 1).

Original: We note that an anomalous sample can have more than one anomaly.
Revised: We note that an anomalous sample can have more than one anomaly.

Original: We preprocess the data by removing the mean and scaling to unit variance.
Revised: We preprocess the data by removing the mean and scaling to unit variance.

Original: Hereby, only the available normal examples are used for the computation of the mean and the variance.
Revised: Hereby, only the available normal examples are used for the computation of the mean and the variance.

Original: This means that in the experiments, where the target task’s size K = 2 and only normal samples are available c = 0% , only two examples are used for the mean and variance computation.
Revised: This means that in the experiments, where the target task’s size K = 2 and only normal samples are available c = 0% , only two examples are used for the mean and variance computation.

Original: We note that the time-series in
Revised: We note that the time-series in

Original: Figure 2 are not preprocessed.
Revised: Figure 1 are not preprocessed.

Original: B. CNC-MMD
Revised: C. CNC-MMD

Original: We preprocess each of the three signals separately by removing the mean and scaling to unit variance, as done for the STS datasets.
Revised: We preprocess each of the three signals separately by removing the mean and scaling to unit variance, as done for the STS datasets.

Original: Likewise, only the available normal examples are used for the computation of the mean and the variance.
Revised: Likewise, only the available normal examples are used for the computation of the mean and the variance.

Original: Exemplary anomalous signals recorded from a ﬁnishing and a roughing operations are shown in
Revised: Exemplary anomalous signals recorded from a ﬁnishing and a roughing operations are shown in

Original: Figure 3.
Revised: Figure 2.

Original: These signals are not mean centered and scaled to unit variance.
Revised: These signals are not mean centered and scaled to unit variance.

Original: We note that we do not use the labels per time-step, but rather the label ”anomalous” is assigned to each time-series that contains at least an anomalous time-step.
Revised: We note that we do not use the labels per time-step, but rather the label ”anomalous” is assigned to each time-series that contains at least an anomalous time-step.

Original: C E XPERIMENTAL R ESULTS
Revised: D E XPERIMENTAL R ESULTS

Original: In this Section, we present the complete results of the experiments on the two STS datasets and the 9 MT-MNIST datasets, including conﬁdence intervals 95% .

Original: [Table]

Original: 4 : C

Original: o m p

Original: [Table]

Original: N

Original: [Table]

Original: [Table]

Original: % 94 .± 0 .

Original: M TM N I

Original: S T ( T 1 )

Original: K =

Original: K =

Original: K =

Original: M o d e l \ c 50 % 0 % 50 % 0 % 50 % 1 % 0 %

Original: S TL 45 .± 12 .% 0 .±

Original: [-1 .% 89 .± 3 .% 0 .± 
-]
Revised: [-1 .% 89 .± 3 .% 0 .± 
-]

Original: .% 96 .± 1 .% 57 .±

Original: [-7 .% 0 .± 
-]
Revised: [-7 .% 0 .± 
-]

Original: M

Original: TL 45 .± 10 .% 44 .± 10 .% 90 .± 2 .% 9 .± 6 .% 97 .± 1 .% 26 .± 7 .% 14 .± 0 .%

Original: M A

Original: M L 88 .± 2 .

Original: 5 % 86 .± 2 .% 95 .± 0 .

Original: 7 % 70 .± 3 .% 98 .± 0 .

Original: 1 % 40 .± 8 .% 0 .± 0 .%

Original: O CM A

Original: M L ( ou r s ) — 92 .± 1 .

Original: 4 % — 95 .± 0 .

Original: 8 % — 92 .± 1 .

Original: 0 % 91 .± 2 .

Original: M TM N I

Original: S T ( T 2 )

Original: K =

Original: K =

Original: K =

Original: M o d e l \ c 50 % 0 % 50 % 0 % 50 % 1 % 0 %

Original: [-S TL 58 .± 8 .% 1 .± 1 .% 76 .± 4 .% 0 .± 
-]
Revised: [-S TL 58 .± 8 .% 1 .± 1 .% 76 .± 4 .% 0 .± 
-]

Original: .% 92 .±

Original: [Table]

Original: 2 .% 89 .± 1 .

Original: 0 % 79 .± 3 .%

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: O CM A

Original: M L ( ou r s ) — 82 .± 2 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M TM N I

Original: S T ( T 4 )

Original: K =

Original: K =

Original: [Table]

Original: M o d e l \ c 50 % 0 % 50 % 0 %

Original: [Table]

Original: [Table]

Original: [-S TL 36 .± 10 .% 0 .± 
-]
Revised: [-S TL 36 .± 10 .% 0 .± 
-]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M T L 35 .± 9 .% 29 .± 12 .% 81 .± 2 .%

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M A

Original: M L 77 .± 2 .

Original: 7 % 60 .± 3 .%

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: O CM A

Original: M L ( ou r s ) — 82 .± 2 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: T a b l e 5 : C

Original: o m p l e t e r e

Original: s u lt s on t h e M

Original: T - M

Original: N I S

Original: T d a t a s e t s ( T t a r g e t = T− T) .

Original: T h e ± s ho w s 95 % c on ﬁ d e n ce

Original: i n t e r v a l c o m pu t e d ov e r 20 t

Original: e s t t a s k s .

Original: M TM N I

Original: S T ( T 5 )

Original: K =

Original: K =

Original: K =

Original: M o d e l \ c 50 % 0 % 50 % 0 % 50 % 1 % 0 %

Original: S TL 59 .± 6 .% 1 .

Original: [Table]

Original: ± 1 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M

Original: [Table]

Original: L

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M A

Original: M L

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: O CM A

Original: M L ( ou r s ) —

Original: [Table]

Original: ±

Original: [Table]

Original: [Table]

Original: ± 0 .

Original: [Table]

Original: [Table]

Original: M TM N I

Original: S T ( T 6 )

Original: K

Original: [Table]

Original: [Table]

Original: =

Original: [Table]

Original: M od e l \ c

Original: [Table]

Original: S TL 55 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: M

Original: [Table]

Original: M A

Original: M L 86 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: O CM A

Original: M L ( ou r s ) —

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M T

Original: [Table]

Original: M N I

Original: S

Original: [Table]

Original: [Table]

Original: M o d e l \ c

Original: [Table]

Original: S

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M

Original: [Table]

Original: L 46 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M

Original: [Table]

Original: M L

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: CM A

Original: M L ( ou r s ) — 87 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M TM N I

Original: S T ( T 8 )

Original: K =

Original: [Table]

Original: =

Original: [Table]

Original: M o d e l \ c

Original: [Table]

Original: S TL 52 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: [Table]

Original: M

Original: [Table]

Original: L 80 .

Original: [Table]

Original: [Table]

Original: [Table]

Original: T a b l e 6 : C

Original: o m p l e t e r e

Original: s u lt s on t h e M

Original: i n i

Original: I m a g e

Original: N e t d a t a s e t .

Original: T h

Original: e ± s ho

Original: w s 95 % c on ﬁ d e n ce

Original: i n t e r v a l c o m pu t e d ov e r t

Original: e s t t a s k s .

Original: M i n i

Original: I m a g e

Original: N e t

Original: K =

Original: K =

Original: K =

Original: M od e l \ c 50 % 0 % 50 % 0 % 50 % 1 % 0 %

Original: [-S TL 47 .± 1 .% 8 .± 1 .% 56 .± 1 .% 0 .± 
-]
Revised: [-S TL 47 .± 1 .% 8 .± 1 .% 56 .± 1 .% 0 .± 
-]

Original: [-.% 68 .± 1 .% 5 .± 
-]
Revised: [-.% 68 .± 1 .% 5 .± 
-]

Original: .% 0 .±

Original: M

Original: [-TL 52 .± 1 .% 40 .± 1 .% 62 .± 1 .% 32 .± 1 .% 72 .± 
-]
Revised: [-TL 52 .± 1 .% 40 .± 1 .% 62 .± 1 .% 32 .± 1 .% 72 .± 
-]

Original: [-.% 45 .± 
-]
Revised: [-.% 45 .± 
-]

Original: .% 41 .± 0 .%

Original: M A

Original: M L 58 .± 1 .

Original: 0 % 55 .± 1 .% 70 .± 0 .

Original: 7 % 55 .± 1 .% 78 .± 0 .

Original: 5 % 51 .± 1 .% 27 .± 1 .%

Original: O CM A

Original: M L ( ou r s ) — 60 .± 0 .

Original: 7 % — 72 .± 0 .

Original: 5 % — 73 .± 0 .

Original: 5 % 74 .± 0 .

Original: T a b l e 7 : C

Original: o m p l e t e r e

Original: s u lt s on t h e S T

Original: S - S a w t

Original: o o t h ( t op ) a nd

Original: S T S - S i n e ( bo tt o m )

Original: d a t a s e t s .

Original: T h

Original: e ± s ho

Original: w s 95 % c on ﬁ d e n ce

Original: i n t e r v a l c o m pu t e d ov e r 50 t e s t t a s k s .

Original: S T S ( S a w t oo t h )

Original: K =

Original: K =

Original: K =

Original: M od e l \ c 50 % 0 % 50 % 0 % 50 % 1 % 0 %

Original: [-S TL 38 .± 5 .% 0 .± 
-]
Revised: [-S TL 38 .± 5 .% 0 .± 
-]

Original: .% 46 .±

Original: [-4 .% 0 .± 
-]
Revised: [-4 .% 0 .± 
-]

Original: [-.% 65 .± 2 .% 0 .± 
-]
Revised: [-.% 65 .± 2 .% 0 .± 
-]

Original: .% 0 .± 0 .%

Original: M

Original: [-TL 38 .± 8 .% 0 .± 
-]
Revised: [-TL 38 .± 8 .% 0 .± 
-]

Original: .% 61 .±

Original: [-5 .% 0 .± 
-]
Revised: [-5 .% 0 .± 
-]

Original: .% 93 .± 2 .

Original: [-2 % 0 .± 
-]
Revised: [-2 % 0 .± 
-]

Original: .% 0 .± 0 .%

Original: M A

Original: M L 90 .± 2 .

Original: 7 % 78 .± 6 .% 96 .± 1 .

Original: 4 % 79 .± 6 .% 87 .±

Original: 3 .% 81 .± 5 .% 74 .± 5 .%

Original: O CM A

Original: M L ( ou r s ) — 96 .± 1 .

Original: 1 % — 97 .± 1 .

Original: 3 % — 97 .± 0 .

Original: 4 % 93 .± 1 .

Original: S T S ( S i n e )

Original: K =

Original: K =

Original: K =

Original: M od e l \ c 50 % 0 % 50 % 0 % 50 % 1 % 0 %

Original: [-S TL 33 .± 6 .% 0 .± 
-]
Revised: [-S TL 33 .± 6 .% 0 .± 
-]

Original: [-.% 35 .± 3 .% 0 .± 
-]
Revised: [-.% 35 .± 3 .% 0 .± 
-]

Original: [-.% 75 .± 3 .% 0 .± 
-]
Revised: [-.% 75 .± 3 .% 0 .± 
-]

Original: .% 0 .± 0 .%

Original: M

Original: [-TL 54 .± 4 .% 0 .± 
-]
Revised: [-TL 54 .± 4 .% 0 .± 
-]

Original: [-.% 90 .± 1 .% 0 .± 
-]
Revised: [-.% 90 .± 1 .% 0 .± 
-]

Original: .% 95 .± 1 .% 47 .±

Original: 2 .% 13 .± 0 .%

Original: M A

Original: M L 99 .± 0 .

Original: 1 % 98 .± 0 .% 99 .± 0 .

Original: 1 % 95 .± 0 .% 99 .± 0 .

Original: 2 % 99 .± 0 .% 0 .± 0 .%

Original: O CM A

Original: M L ( ou r s ) — 99 .± 0 .

Original: 1 % — 99 .± 0 .

Original: 1 % — 99 .± 0 .

Original: 1 % 98 .± 1 .