Manifold learning for novelty detection and its application in gesture recognition

As a state-of-the-art novelty detection method, Kernel Null Foley–Sammon Transform (KNFST) could identify multiple known classes and detect novelties from an unknown class via a single model. However, KNFST only captures the global information of the training set. The local geometrical structure is neglected. In this paper, a manifold is incorporated into KNFST to solve this issue. First, we use manifold graphs to depict the local structure for within-class scatter and total scatter. Second, the training samples from the same class are mapped into a single point in null space via null projected directions (NPDs). The proposed method can overcome the weakness of KNFST caused by ignoring local geometrical structure in the class. The experimental results on several toy and benchmark datasets show that manifold learning novelty detection (MLND) is superior to KNFST.


Introduction
In many real-world applications, a test sample may be from an unknown class that is not available in the training set. These samples can be regarded as novelties or anomalies for known classes as they are far away from the distributions of known classes [1,2]. The problem is termed as novelty detection or anomaly detection. When the known classes are more than one, it is called multi-class supervised novelty detection [3,4]. Novelty detection is widely used in the community of pattern recognition. For instance, traffic police wants to find The Laboratory Center for Basic Medical Sciences, Nanjing Medical University, Nanjing 211169, People's Republic of China 3 The School of Computer Engineering, Jinling Institute of Technology, Nanjing 211169, People's Republic of China the illegal traffic flow [5], ophthalmologist wants to detect retinal damage [6], cyber security expert needs to monitor cyber-intrusion from massive visiting [7,8], engineer needs to analyze big data in Internet of Things (IoT) [9], abrupt changes in air temperature [10], unknown pixels in hyperspectral image [11], and medical ultrasound image analysis [12,13] to name just a few. During the past several decades, the works about supervised novelty detection mainly focus on the training set that only contains one known class [14,15]. It is called one-class classification [16,17]. The one-class classifier can only tell us whether a test sample is normal or not [18,19]. When the training set contains more than one known class, it requires to treat all known classes as a superclass [20] or learn several one-class classifiers [21]. For the former way, it still requires to learn a multi-class classifier to tell us which class a test sample is from if it is not a novelty.
Kernel null Foley-Sammon Transform (KNFST) [3] can deal with one-class classification as well as multi-class supervised novelty detection. For multi-class supervised novelty detection, KNFST only learns a single model which can tell us a test sample whether is a novelty or which class it comes from if it is a normal sample. KNFST maps the samples from the same class to a single point in reproducing kernel Hilbert space (RKHS) via null projection directions. Let c represent the number of classes. Then, the label of a test sample is determined by the minimum distance to the mapping points. If the distances to mapping points are all very large, it is a novelty. However, KNFST can only capture the global information and neglects the local geometrical structure. It may fail when the local geometrical structure is complex, which also exists in classification [22] or ordinal regression [23]. In order to address this issue, we propose a manifold learning-novelty detection (MLND) method in which a manifold graph is introduce to regularize withinand between-class scatter matrices, respectively. The manifold graph is used to depict local geometrical structure. The experimental results demonstrate that MLND is superior to KNFST on several toy and benchmark datasets. The main contributions are summarized as following three points.
-First, we introduce a manifold into within-class scatter and total scatter to depict local structure in class for Foley-Sammon transform (or Fisher discriminant analysis). -Second, a new criteria for the projected directions is proposed, which requires the regularized within-class scatter to be zero and the regularized total scatter to be greater than zero in the projected space. -Third, the manifold regularized Foley-Sammon transform is used as a detect novelty method and evaluated on several toy and benchmark datasets.
The rest of this paper is organized as follows. A simple review of supervised novelty detection and kernel null Foley-Sammon transformation (KNFST) is provided in "Related work". A manifold regularized null Foley-Sammon transformation (NFST) is proposed in "Manifold regularized NFST". In "Experiments and simulations", we evaluate manifold learning-novelty detection (MLND) on two toy datasets, eight benchmark datasets, and Gestures dataset. The last section is "Discussion and conclusion".

A review of supervised novelty detection
The supervised novelty detection is used to predict the test sample whether is from an unknown class by learning a model from a training set which consists of massive labelled samples. When the labelled samples follow i.i.d. assumption, they can be considered to be from the same class and the supervised novelty detection is a one-class classification problem [2]. For instance, Scholkopf et al. [16] proposed to find a decision hyperplane which could make the minimum margin between the samples in reproducing kernel Hilbert space (RKHS) and the origin be maximized; David and Robert [17] proposed to find a hypersphere which could enclose most of the training samples with minimum volume; Ruff et al. [24] proposed a one-class classifier based on deep learning; Iosifidis et al. [25] used extreme learning to do one-class classification, to name just a few.
When the labelled samples are from a mixture of distributions, they are from several known classes. Then, it is a multi-class supervised novelty detection problem [3]. Compared with multi-class classification, multi-class supervised novelty detection can identify whether a test sample is from an unknown class or which class the test sample is from if it comes from a known class. One way to solve multi-class supervised novelty detection is to treat all known classes as a superclass and learn a one-class classifier to detect the test sample whether is from an unknown class. If the test sample is not from an unknown class, then we train a multi-class classifier to predict which class it comes from [20]. Obviously, this way needs two models: a one-class classifier and a multiclass classifier. Additionally, the one-class classifier would be effected by the complex structure of the superclass. Another way to solve multi-class supervised novelty detection is to train several one-class classifiers. Each one-class classifier is associated with a known class [21]. It has many issues to train several models, such as more training time, more parameters to tune et al. To solve the issues in previous ways, some researchers proposed to learn a single model that can identify a test sample whether is from an unknown class and which class the test sample comes from if it is from a known class, simultaneously. For instance, Bodesheim et al. [3] proposed a multi-class supervised novelty detection method in which the samples from the same class are mapped to a single point in reproducing kernel Hilbert space (RKHS) via null projected directions (NPDs). Zhang et al. [26] proposed a semi-supervised version of KNFST and used it in person reidentification problem. Liu et al. [27] proposed a kernel null space discriminant analysis for incremental supervised novelty detection. Huang et al. [28] used incremental KNFST in person re-identification problem. T Ali and Chaudhuri [29] combined maximum margin metric learning with null space to do supervised novelty detection. The common ground of these methods is that they all adopt null space skill. However, null space only considers the global information and neglects the local geometrical structure. To solve this issue, we propose a manifold learning-based supervised novelty detection method in which the local geometrical structure is depicted by a manifold.

Recap of Kernel null Foley-Sammon transform (KNFST)
Foley-Sammon transform, also called Fisher transform or linear discriminant analysis (LDA), maximizes the betweenclass scatter and minimizes the within-class scatter, simultaneously. Let X j , j = 1, . . . , c represent the set consisting of the samples which belong to class j; the S w , S b , S t represent the within-class scatter, between-class scatter, and total scat-ter matrices, respectively; ϕ ∈ R D be one direction in the discriminant subspace. Then, the Fisher discriminant criterion is written as follows.
In null Foley-Sammon transform (NFST), the direction should make the within-class scatter be zero and betweenclass scatter be positive. Therefore, Eq. (1) becomes J (ϕ) = ∞, which has the best separability. The solution in NFST should satisfy The directions satisfying Eq. (3) are called null projection directions (NPDs). The Eq. (3) is equivalent to Here, S t is the total scatter, S t = S w + S b . The samples in the same class are mapped to a single point due to ϕ T S w ϕ = 0. An illustration of NFST is shown in Fig. 1. Figure 1 is a three-class problem. The c1, c2, and c3 are the mapped points of class 1, class 2, and class 3 in null space. For a test sample, the associated label is decided by the minimum distance to the points, c1, c2, and c3. If the test sample is far away from all points, it comes from an unknown class.
In both FST and NFST, within-class scatter and betweenclass scatter only capture global information and neglect local geometrical structure. In this paper, we adopt a manifold to regularize the within-class scatter and between-class scatter to describe the local structure in a class.

Manifold learning for novelty detection
In manifold learning, it assumes that if two data points are close in the original distribution, they are also close in the projected subspace. In this paper, we use the neighborhood preserving embedding (NPE) to describe the local geometrical structure in within-class scatter and total scatter. Then, we propose a regularized within-class scatter and a regularized total scatter instead of within-class scatter and local total scatter, respectively. Definition 1 (Regularized within-class scatter) Given a dataset X ∈ R N ×D . The associated label is Y (y i ∈ {1, . . . , c}). X j consists of all samples belonging to class j. The local within-class scatter is defined as Here, W is an adjacency graph. If x p is one of the k-nearest neighbors of x i and has the same label as that of x i , there is an edge between x i and x p (W i, p = 0); otherwise, W i, p = 0.
The Eq. (5) can be rewritten as follows Let I be a N × N identity matrix and L be a block diagonal matrix whose block size is N j and elements are 1 N j . The Then, the regularized within-class scatter is rewritten as S wreg = X w X T w . The weights are computed by minimizing the following objective function.
min : The term, can be regarded as the weighted mean of k-nearest neighbors of x j . The stars, x-marks, and pluses belong to class 1, class 2, and class 3, respectively. The left sub-figure is the original space and the right-subfigure is null space. The samples from the same class in original space are mapped to a single point in null space The details to solve formula (7) can refer to the reference [30].
Definition 2 (Regularized total scatter) Given a dataset X ∈ R N ×D . The associated label is Y (y i ∈ {1, . . . , c}). X j consists of all samples belonging to class j. The regularized total scatter is defined as Here, μ and μ j are defined as Eq. (9) and (10), respectively.
The Eq. (8) can be rewritten as follows: The NPDs for regularized within-class scatter and regularized total scatter satisfy the following conditions.
Since S wreg is a semipositive definite matrix and can be represented as By multiplying both sides of the equation from the left with matrix X w , then we can obtain X w X w T ϕ = 0 ⇒ S wreg ϕ = 0 holds. On the other hand, the solution of S wreg ϕ = 0 exactly satisfies ϕ T S wreg ϕ = 0. The S wreg ϕ = 0 ⇐ ϕ T S wreg ϕ = 0 holds.
From the above two points, we can obtain ϕ T S wreg ϕ = 0 ⇔ S wreg ϕ = 0.
Let Z w = z|S wreg z = 0 be the null space of S wreg , Z t = z|S treg z = 0 be the null space of S treg , and Z ⊥ t be the orthogonal complement space of Z t . The NPDs satisfy In order to ensure ϕ ∈ Z ⊥ t , each ϕ can be represented as Here, Due to X w = X (I − (αL + (1 − α) W)) and S wreg = X w X T w , the Eq. (15) can be rewritten as follows.
In Eq. (14), the matrix Q is obtained from PCA. The column vectors of Q are orthogonalized. We can obtain ϕ T i ϕ j = Qγ i T Qγ j = γ T i Q T Qγ j = γ T i γ j = 0. Therefore, the directions obtained from Eq. (14) are orthogonalized as well.
Let P be a matrix whose columns are null projection directions ϕ 1 , . . . , ϕ l (l < N ). A test sample x is mapped into null space via Eq. (17) and scored via Eq. (18).
Here, t j is the mapped point of class j in null space. The Score(x) is the novelty score of x, which reflects the probability of a test sample from an unknown class. When it is very large, x is a novelty with high probability.
The procedure to find NPDs is summarized as the following Algorithm 1 Compared with null space Foley-Sammon transform (NFST), the extra cost of MLND includes solving Eq. (7) and calculating regularized within-class scatter and regularized total scatter. The rest cost of MLND is the same as that of NFST.

Kernel form manifold learning for novelty detection
In MLND, it assumes that S wreg is singular. When S wreg is full rank, the samples are mapped into a reproducing Hilbert space (RKHS) via kernel trick to avoid the null space Z w being empty. The mapping of a sample x in RKHS is represented as Φ(x) where Φ(x) is an implicit function. The inner product of the mappings of two samples can be calculated via kernel function which is defined as k Obviously, S wreg is a high dimensional space other than a d × d matrix any more. For instance, S wreg is a in f × in f matrix when RBF kernel is adopted.
Then, S treg in RKHS is rewritten as follows The eigenvector θ j in high dimensional feature space lies in the space of Φ(x 1 ), . . . , Φ(x N ) and there exist coefficients δ 1, j , . . . , δ N , j satisfying the following equation.
The eigenvalues and eigenvectors of S treg satisfy Then, Substituting Eqs. (20) and (21) into Eq. (22), we can obtain Here, δ j is the vector form of δ 1, j , . . . , δ N , j and can be obtained by solving the following eigenvalue problem Since θ j , θ j = δ T j Kδ j = λ j δ j , δ j , the orthonormal basis of S treg in high dimensional space is represented as follows: Here (25) can be solved implicitly. By introducing Eq. (25) and inner products in reproducing kernel Hilbert space (RKHS), the matrix H is rewritten as follows.
Here, V = {θ 1 , . . . , θ l }. Then, substituting Eq. (26) into Eq. (16), we can obtain γ j in RKHS. The final null space directions in RKHS are obtained by the Let P = [ϕ 1 , . . . , ϕ l ]. In kernel MLND, the test sample x is mapped into null space through K T P. The K T is the vector form of [k(x 1 , x ); . . . ; k(x n , x )]. The novelty score of x is the minimum distance between the mapped point to each class. The procedure of kernel MLND is summarized as Algorithm 2.

Algorithm 2 (Kernel MLND)
Input: • The training set X and the label Y

Experiments and simulations
In this section, manifold learning novelty detection (MLND) will be evaluated on several datasets. Here, we use the kernel MLND. The code of MLND is implemented by Matlab 2018b. To verify the validity of MLND, we compare MLND with some state-of-the-art null space methods, including KNFST [3], Local KNFST [31], and NK3ML [29]. The codes of KNFST, Local KNFST, and NK3ML are provided by the authors.
The generalized histogram intersection kernel (HIK) is used as kernel function in KNFST, Local KNFST, and NK3ML. For fair comparision, the HIK is used as kernel function, which is defined as k( First, we adopt an EMG dataset to demonstrate the effectiveness of MLND on real dataset; then, two toy datasets are used to further evaluate MLND; lastly several benchmark datasets which are collected by UCI 1 or Libsvm website [32] are adopted to further evaluate MLND. The experimental results are reported in terms of AUC value, ROC curve and accuracy. The AUC value and ROC curve are used to evaluate novelty detection methods. The higher AUC value is, the better the novelty detector is. Accuracy is defined as the ratio of correctly predicted normal samples to all normal samples. It is used to measure the classification performance of multi-class supervised novelty detection for normal samples.

Experiments on EMG dataset
In this section, we use Gestures, which is an electromyogram signal (EMG) dataset, to verify MLND. The signals are collected via MYO Thalmic bracelet which is worn on user's forarm. The bracelet is equipped with 8 sensors to collect myographic signals simultaneously. The raw signals are from 36 subjects. Each subject performs 2 series. Each series contains 6 or 7 basic gestures: hand at rest, hand clenched in a fist, wrist flexion, wrist extension, radial deviations, ulnar deviations, and extended palm. In this experiment, we only consider former six gestures since the extended palm is not performed in some subjects. An illustration of the signals of former six gestures is shown in Fig. 2. The label of horizontal axis is the channel which the signal are collected from. A channel is associated with a sensor in MYO Thalmic bracelet.
Different from previous gesture recognition work [33], this paper converts the gesture recognition as a multi-class supervised novelty detection problem to identify unknown gesture. Except seven basic gestures, some of the signals are not marked as basic gestures. In this section, we use hand at rest, hand clenched in a fist, wrist flexion, wrist extension, radial deviations, and ulnar deviations as normal classes. The extended palm and unmarked signals are used as anomalies. Therefore, the task of Gesture recognition becomes to recognize whether the EMG signal are from basic hand gestures or which basic hand gesture the EMG signal comes from if it belongs to one of the basic hand gestures. Obviously, it is a multi-class supervised novelty detection problem. The gesture recognition can be widely used in robot control [34,35] and traffic control [36,37].
We set a 200 ms window for sampling. The window overlaps with a 100 ms step. Then, we generate 30,240 normal samples (5,040 samples per class) and 10,000 abnormal samples as novelties. The normal samples are divided into two parts equally. One part is used as a training set, the other part and abnormal samples are used as a test set. The features from eight channels are reorganized as an 800*1 vector.
In MLND, we directly set parameters as (α = 0.5, β = 0.5). The number of nearest neighbors in Definition 1 and Fig. 2 The signals of hand gestures. In the first row, the signals are from hand at rest, hand clenched in a fist, and wrist flexion, respectively. In the second row, the signals are from wrist extension, radial deviations, and ulnar deviations, respectively. The ch1 to ch8 are associated with eight sensors on MYO Thalmic bracelet Definition 2 is directly set as 20 to avoid extra cost to tune parameters. To avoid randomness, we repeat the experiment 30 times. The results are reported as mean ± std. form in terms of AUC value and accuracy. The results are reported in Table 1.
From Table 1, it can be found the average AUC value of MLND reaches 0.9251 which is higher than KNFST, Local KNFST, and NK3ML; the average accuracy of MLND reaches 93.87% which is also higher than KNFST, Local KNFST, and NM3ML. The ROC curve of one trail is drawn in Fig. 3. From Fig. 3, the ROC curve of MLND is still superior to that of KNFST, Local KNFST, and NK3ML. MLND per-forms better than KNFST, Local KNFST, and NK3ML on Gesture.
Furthermore, we also consider the influence of different parameter k in Definitions 1 and 2 on the performance of MLND. The parameter k is in the range from 10 to 100 steps by 10. Here, the parameters α and β are both set as 0.5 directly. The curve between AUC value and the parameter k is shown in the left sub-figure of Fig. 4. The curve between accuracy and the parameter k is shown in the right sub-figure of Fig. 4.
From the results in Fig. 4, it can be found that both AUC value and accuracy decrease with the increasing of the number of k nearest neighbors in MLND when k > 30. The reason is that the manifold is used to depict a small region. When the neighborhood is too large, the manifold is invalid. When k = 20, the AUC value reaches the peak (AU C = 0.9152). When k = 30, the accuracy reaches the peak (accuracy = 94.65%). In our experience, the parameter k in MLND cannot be set too large. In the following experiments, the parameter k is set as 20 directly.

Experiments on toy datasets
In this subsection, we will evaluate MLND on two toy datasets. The first one contains 3 normal classes and the second one contains 2 normal classes. In toy 1, the samples in X j , j = 1, 2, 3 follows the below distributions: Here  Fig. 5a.
In toy 2, the samples in X j , j = 1, 2 follows the below distributions: Here,  Table 2.
In Table 2, the sixth column represents the results of MLND via fine-tuned parameters α, β. The parameters α, β are tuned via grid search in the range from 0.1 to 1 stepped 0.1. The seventh column of Table 2 represents the results of MLND with fixed parameters α = 0.5, β = 0.5.
For Toy 1, the average AUC value of MLND is 0.9589 when tuning parameters α, β via grid search and is 0.9492 when α = 0.5, β = 0.5. For Toy 2, the average AUC value of MLND is 0.9314 when tuning parameters α, β via grid search and is 0.9249 when α = 1, β = 1. The average AUC value of Fig. 4 The performance with different parameter k in MLND. Left: the curve between the AUC value and the parameter k; right: the curve between the accuracy and the parameter k Fig. 5 The illustration of toy datasets. In a, the samples from class 1, 2, and 3 are denoted as pluses, stars, and x-marks, respectively; the novelties are denoted as circles. In b, there are two normal classes in which the samples are denoted as pluses and stars, respectively; the circles are novelties MLND is higher than KNFST, Local KNFST, and NK3ML even the parameters are directly set as α = 0.5, β = 0.5. For Toy 1, the average accuracy of MLND is 96.71% when tuning parameters α, β via grid search and is 95.17% when α = 0.5, β = 0.5. For Toy 2, the average accuracy of MLND is 93.47% when tuning parameters α, β via grid search and is 93.28% when α = 0.5, β = 0.5. The average accuracy of MLND is higher than KNFST, Local KNFST, and NK3ML even the parameters are directly set as α = 0.5, β = 0.5 as well.
This is because MLND considers both global information and local structure in class. The ROC curves of Toy 1 and Toy 2 are shown in Fig. 6.
From Fig. 6, we can obtain the same conclusion that is from AUC value and accuracy for Toy 1 and Toy 2.

Experiments on benchmark datasets
In this subsection, we will compare MLND with KNFST, Local KNFST, and NK3ML on several benchmark dataset which are collected from UCI repository and Libsvm website [32]. The details of these datasets are listed in Table 3.
These datasets are reorganized to suit for evaluating multi-class supervised novelty detection. For DNA, protein, satimage, and shuttle, we remove a class from the training set and add the samples from this class into a test set for testing. For pendigits poker, SVHN, and usps, we remove five classes from the training set and add the samples from these classes into the test set for testing. The parameters in MLND is directly set as α = 0.5, β = 0.5 and k = 20. The AUC value and accuracy are reported in Tables 4 and 5, respectively.
In Tables 4 and 5, the last row is the win-loss-tie (W-L-T) of AUC value and accuracy, respectively. The MLND is used as a based method. From Table 4, it can be found that the AUC value of MLND is higher than that of KNFST on eight datasets, Local KNFST on eight datasets, and NK3ML on seven datasets. From Table 5, it can be found that the accuracy of MLND is higher than that of KNFST on eight datasets, Local KNFST on eight datasets, and NK3ML on six datasets. The MLND is superior to KNFST, Local KNFST, and NK3ML on most of these benchmark datasets.

Discussions and conclusion
In this paper, we propose a manifold learning-based novelty detection method. The manifold learning novelty detection (MLND) can be regarded as an improvement of kernel null W-L-T 0-8-0 0-8-0 2-6-0 space Foley-Sammon transformation (KNFST). In MLND, first we introduce a manifold into within-class scatter and total scatter to depict the local geometrical structure in class; then we map the samples from the same class into a single point via null projection directions. Compared with KNFST, MLND considers both global information and local geometrical structure in the class. Therefore, MLND can overcome the weakness of KNFST caused by ignoring local geometrical structure in the class. We evaluate MLND on an EMG Gesture dataset, two toy dataset and eight benchmark datasets. The experimental results demonstrate MLND is superior to KNFST and its two improved methods: Local KNFST and NK3ML.