Nearest Neighbor Classification of Binary Channel States for Secure Human Body Communication

Human body communication (HBC) is a short-range communication technique in which the human body is used as a data transmission channel. Although the HBC was originally proposed for connecting multiple mobile devices, it is also useful for quickly linking mobile and fixed devices. The latter feature can be applied to smart identification of persons. The HBC channel is formed by a capacitive coupling among the body, mobile and fixed devices, and earth. Consequently, if an outsider approaches the HBC system, that person inevitably becomes involved in the system because of the capacitive coupling. In this situation, a mobile device of the outsider accidentally transmits data signals and misidentification occurs. This is a serious problem in terms of communication system security. An effective approach for resolving this problem is to predict whether the outsider is involved in the HBC system based on signal information received by the fixed device. In this article, we present a method for correctly predicting the existence of the outsider involved in the HBC system based on channel gain features detected by the fixed device. As the problem can be viewed as a binary classification problem, we adopted <inline-formula> <tex-math notation="LaTeX">${k}$ </tex-math></inline-formula>-nearest neighbor method (<inline-formula> <tex-math notation="LaTeX">${k}$ </tex-math></inline-formula>-NN), which is a supervised machine learning algorithm, for solving it. A key to correctly execute and evaluate <inline-formula> <tex-math notation="LaTeX">${k}$ </tex-math></inline-formula>-NN is to obtain the reliable channel gain data for training and evaluation. We utilized optical devices for correctly measuring the HBC channel gain and acquired 360 samples of the channel gain data. It was demonstrated that error-free classification was possible with the <inline-formula> <tex-math notation="LaTeX">${k}$ </tex-math></inline-formula>-NN classifier for the 360 samples. We obtained three key findings for reducing classification errors. First, <inline-formula> <tex-math notation="LaTeX">${k} =$ </tex-math></inline-formula> 1 is best for the <inline-formula> <tex-math notation="LaTeX">${k}$ </tex-math></inline-formula>-NN classifiers. Second, 1-norm is better than 2-norm for calculating error functions of <inline-formula> <tex-math notation="LaTeX">${k}$ </tex-math></inline-formula>-NN classifiers. Third, the preprocessing that includes partition and normalization of channel gain data is highly effective.


I. INTRODUCTION
T HE concept of human body communication (HBC) was proposed by Zimmerman [1] in 1996. The basic idea was to use the human body as data transmission channel for linking multiple wearable devices attached to the user's body. This novel idea has received attention, especially in the community of human-interface researchers [2], [3], [4]. However, research on HBC was not widespread because wearable devices were Manuscript  not popular at that time. Furthermore, the signal transmission mechanism of the HBC channels was not well understood. At the beginning of the 21st century, Nippon Telegraph and Telephone Corporation (NTT) began full-scale research on HBC [5], [6], [7], [8], [9]. However, the target application of NTT was communication between fixed and mobile devices rather than that among wearable devices. During this period, one of the main applications of HBC technologies was the smart identification of persons, and several other Japanese companies attempted to commercialize the technologies. Several studies have been conducted to understand the signal transmission mechanism in HBC channels. It has become possible to understand the mechanism of HBC after the proposal of equivalent circuit models of HBC channels [10], [11], [12], [13], [14], [15].
However, two major problems exist from a practical perspective. One of these problems is the difficulty in obtaining the required signal-to-noise ratio (SNR) for stable communication. The main factor in SNR reduction is environmental noise. Subsequently, a method for reducing noise was proposed [16], [17]. Owing to these methods, it has become possible to obtain a reasonable SNR.
The other problem is that accidental data transmission can occur in personal identification systems that use HBC technologies. The essential principle of HBC is that data are carried by the electric fields generated around the human body. Because of this principle, the electric fields existing around a person in an HBC system are easily transmitted to nearby outsiders. Therefore, if an outsider with a mobile device unintentionally approaches HBC systems, his device may accidentally transmit data signals to a fixed device via the person, and undesired identification processes are triggered. This is a serious problem in terms of the security of communication systems. However, this serious problem has not been openly discussed in the academic community.
Consequently, we have been studying methods to address the second problem [37], [38]. Because the physical states of This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ the HBC channels change when an outsider approaches the HBC system, the frequency dependence of the channel gain G( f ) inevitably changes as well. This implies the possibility of predicting whether the outsider is involved in the HBC system based on G( f ), which can be calculated from the signals received by the fixed device. If we can predict the existence of an outsider involved in the HBC system, the second serious problem may be resolved by system-level measures.
Based on this strategy, we attempted to predict the existence of an outsider from the measured G( f ) [37], [38]. The problem of predicting whether an outsider is involved in the HBC system can be viewed as a binary classification problem. We adopted a machine learning approach to solve the classification problem. Our preliminary studies have shown that this strategy is feasible and that machine learning is effective for prediction. However, in previous studies, the prediction error could not be reduced to less than 10%. Furthermore, only outlines of our studies are briefly reported in [37] and [38].
In this article, we detail our studies for detecting outsiders included in HBC systems. The original features of this study are as follows: First, we calculated G( f ) from the equivalent circuit models of the HBC systems and compared them with the measured results. It was shown that although G( f ) measured without the outsider coincided well with the circuit model, G( f ) measured with the outsider did not agree with the model. Second, we adopted the k-nearest neighbor (k-NN) method as the machine learning algorithm and analyzed the performance of k-NN in detail. Third, we proposed an appropriate procedure for preprocessing the training data to predict the existence of the outsider. Fourth, we found the best parameters for executing k-NN and accomplished an error-free prediction of the existence of the outsider by adopting the parameters and preprocessing.
In Section II, HBC channel models, with and without the outsider, are introduced and G( f ) is calculated from the models. The calculated results were compared with the typical measurement results. In Section III, the details of G( f ) are explained. In addition, the experimental system, conditions, and results were described in detail in this section. In Section IV, the performance of k-NN classifiers is thoroughly investigated and the preprocessing procedure is described. It is revealed that the 1-norm is better than the 2-norm for calculating error functions. Furthermore, we can see that the best classifier is the 1-NN classifier, that is k = 1.

A. Signal Transmission Models of HBC Channels
The basic concept of HBC is illustrated in Fig. 1. In this study, we focus on the uplink channel, where data are sent from a mobile transmitter (M-TX) to a fixed receiver (F-RX). A pair of mobile electrodes M+ and M− are connected to M-TX. Similarly, a pair of fixed electrodes F+ and F− are connected to F-RX. The downlink channel can be understood in a similar manner [37].
Data signals generated by M-TX are applied between M+ and M−. The human body can be regarded as a conductor covered by insulators such as skin, clothes, and shoes. As shown in Fig. 1, M− is capacitively coupled to a floor, which is regarded as earth. In other words, M− and earth form a capacitor. Therefore, when voltages are applied between M+ and M−, electric fields (displacement currents) shown by the dashed curve in Fig. 1 are generated between M− and the floor. Finally, the HBC channel is formed by a closed loop composed of conduction currents (solid red curve) and displacement currents (dashed blue curve). As shown in Fig. 3, the HBC channel can be modeled by an equivalent circuit, which is explained in Section II-B. We call the channel state represented in Fig. 1 the "ordinary state." A conceptual image of an undesirable situation, where an outsider exists in the vicinity of F+, is depicted in Fig. 2. In this situation, Person 1 without M-TX stands on F+, and an outsider equipped with M-TX exists in the vicinity of Person 1. If Person 1 were absent, the electric fields generated between M− and F+ would be extremely weak. Therefore, the signals sent from M-TX will not be delivered to F-RX. This situation is correct because the outsider is not standing on F+. However, when Person 1 is on F+, the signals transmitted from M-TX of the outsider are delivered via Person 1 to F-RX because the capacitance between M− and Person 1 increases considerably. This situation is undesirable because signals generated from an outsider who is not standing on F+ are accidentally delivered to F-RX. It should be emphasized that signals sent from a person who is not on F+ must not be delivered to F-RX.  We call the problematic channel state shown in Fig. 2 the "extraordinary state." Although the occurrence of an extraordinary state is a serious concern from the point of view of communication system security, it appears difficult to completely prevent its occurrence. A reasonable approach to address this problem is to predict the occurrence of the extraordinary state. This is due to the fact that if we can predict the occurrence of an extraordinary state, security problems may be resolved by system-level measures. As shown in Figs. 1 and 2, the HBC channels of the two states are physically different. Because the frequency dependence of the channel gain G( f ) is inevitably affected by the physical state of the HBC channels, it is possible to predict whether the current channel state is ordinary or extraordinary based on G( f ) measured by F-RX. This problem can be viewed as a binary classification of measured G( f ) into ordinary or extraordinary states. The details of the channel gain characteristics are discussed in Section II-B.

B. Analysis of Channel Models
There are two major schemes for establishing HBC systems [13], [15], [22], [26], [31]: capacitive [1], [10], [14], [16], [19] and galvanic coupling schemes [11], [29], [30]. In this study, we consider HBC systems that adopt a capacitive coupling scheme. The conceptual images shown in Figs. 1 and 2 represent the capacitive coupling scheme, where only one mobile electrode (M+) faces the human body. An advantage of this scheme is that a relatively large channel gain can be obtained. However, as shown in Fig. 2, a problematic extraordinary state is often induced. Conversely, for the galvanic coupling scheme, the channel gain becomes considerably small in comparison with that obtained with the capacitive coupling scheme [31]. Therefore, only short-range applications are available with the galvanic coupling scheme. Because the signals transmitted from the outsider are rapidly attenuated by the galvanic coupling scheme, the extraordinary state is not caused by this scheme.
In this study, we analyzed the frequency dependence of the HBC channel gain obtained using the capacitive coupling scheme. The HBC channels for this scheme can be reasonably described by circuit models [1], [10], [12], [16], [17]. Therefore, we also used circuit models to analyze the HBC channel characteristics.
The HBC channel models adopted for ordinary and extraordinary states are shown in Figs. 3 and 4, respectively. As mentioned previously, our focus was on uplink channels. In Figs. 3 and 4, the M-TX is described as a voltage source that applies the signal voltage V in between mobile electrodes M+ and M−. F-RX is described as a pair of electrodes F+ and F−. When V in is applied between M+ and M−, the received signal voltage V out is induced between F+ and F−. The electric As shown in Figs. 3 and 4, the HBC channel gains for both states depend on several parameters. The HBC channel gains can be formally written as   Table I. Because the calculated data are fairly well fit to the measured data, it is considered that the circuit model shown in Fig. 3 is quite effective.
We also plotted three examples of the measured G e ( f ) in Fig. 6. The conditions adopted for measuring G e ( f ) are shown in Fig. 10. The black curve was obtained when the M-TX was held in the outsider's palm and D = 0 m. The green    All channel gain data measured in an extraordinary state (N = 180). and D = 0.5 m. As shown by the blue and green curves, G e ( f ) tends to vary abruptly. On the other hand, as shown by the black curve, G e ( f ) sometimes becomes smooth and resembles G o ( f ). As indicated in Fig. 6, G e ( f ) exhibits  Fig. 8. The maximum, typical, and minimum cases of G o ( f ) are excerpted from measured results and they are shown by red, green, and blue curves, respectively. complex behavior. Furthermore, the abrupt variation of G e ( f ) could not be fit well by the calculated curves. This suggests that HBC systems under an extraordinary state possess some factors that cannot be expressed by the circuit model shown in Fig. 4. Although it is currently difficult to account for the origin of the abrupt variation, the remarkable feature of G e ( f ) is, however, advantageous for our purpose, that is, for

III. EVALUATION OF CHANNEL GAIN CHARACTERISTICS
In this section, we describe the evaluation of G( f ). As mentioned in Section II, an important feature of HBC systems is that fixed devices are earthed, whereas mobile devices are electrically isolated from the earth. To correctly evaluate the channel gain characteristics, these conditions must be maintained during evaluation [10], [37], [38].
The experimental setup used for evaluating G o ( f ) is shown in Fig. 7. A key point here is the use of optical devices, such as electrical-to-optical (EO)/optical-to-electrical (OE) converters. EO/OE converters make it possible to utilize useful commercial apparatus such as function generators. The electrical signals generated by the function generator are applied to the EO converter and converted into optical signals. The optical signals are then delivered to the OE converter by an optical fiber cable and reconverted into electrical signals, which are applied between M+ and M−. If the function generator is directly connected to the mobile electrodes, M− will inevitably be earthed. In this situation, it is impossible to correctly evaluate the HBC channel characteristics. Because of the isolated nature of the optical fiber cable, it is possible to imitate a battery-driven M-TX with a function generator driven by an ac power cord. Furthermore, we used a spectrum analyzer instead of F-RX. Hence, it is possible to obtain G o ( f ) by sweeping the signal frequencies of the function generator. To obtain G o ( f ) under various conditions, we measured it by changing the positions of the pair of mobile electrodes, M+ and M−, which were attached to a person standing on F+. The positions of the electrode pair are indicated by the stars in Fig. 8. The measurement of G o ( f ) was done with four different subjects wearing their own clothes and shoes.
We also evaluated G e ( f ) using the setup shown in Fig. 9. In this setup, M+ and M− are attached to the outsider. In addition to the evaluation of G o ( f ), we evaluated G e ( f ) at various positions of the electrode pair attached to the outsider. Furthermore, we measured G e ( f ) for various distances (D = 0, 0.2, 0.5, and 1.0 m), where D is the distance between the M-TX and Person 1, as shown in Fig. 10. The measurement of G e ( f ) was done with five different subjects wearing their own clothes and shoes.
All G o ( f ) and G e ( f ) curves obtained in our experiments are shown in Figs. 11 and 12, respectively. In both cases, the number of data samples N was 180. The data were obtained in the frequency range from 0.4 to 40 MHz with a frequency resolution of 0.2 MHz. Therefore, each curve of G( f ) is composed of 199 points. It is observed that G o ( f ) tends to be smooth and G e ( f ) tends to vary abruptly. Therefore, at first glance, it seems easy to correctly classify unknown .  Fig. 13 shows variation of G o ( f ) measured for different positions of the M-TX. It is observed that the channel gain variations depend on positions of the M-TX. As shown in Fig. 13(d) and (e), the variation becomes smaller when the M-TX is attached to a wrist and held with a neck strap. This is because, for these cases, the coupling between M+ and body is maintained large and that between M− and body is maintained small. On the other hand, as indicated in Fig. 13(b), the variation becomes large, especially when the M-TX is put in a pant pocket. This variation is caused by the fact that it depends on the size and position of the pockets on the user's pants. In this case, the coupling between M+ and body   Examples of channel gain features measured in ordinary and extraordinary states. As shown in this figure, the features of G e ( f ) (red curves) sometimes become quite similar to that of G o ( f ) (black curves). Therefore, it is not always easy to classify the measured G( f ) correctly into D is increased to 1.0 m, frequencies of the dips shift lower and gain below about 10 MHz tends to decrease. It is observed from Fig. 14 that the tendency of the channel gain variation depending on D is common to all positions of the M-TX.
To clearly see the relationship between D and features of G e ( f ), we plotted examples of measured G e ( f ) for each D in Fig. 15. When D = 0 m, G e ( f ) are smooth and resembling G o ( f ). As D increases, the variation of G e ( f ) becomes larger and peaky dips are often observed; however, the peaky dips do not always appear even for the larger D.
As seen in Figs. 14 and 15, G e ( f ) tends to show abrupt variation; however, it is also observed that even G e ( f ) sometimes possess smooth features and resembles G o ( f ) especially for smaller D values. To clearly show this fact, we plotted examples of measured G e ( f ) resembling G o ( f ) in Fig. 16. As shown in this figure, the features of G e ( f ) sometimes become quite similar to that of G o ( f ). In this case, it is not easy to classify the measured G( f ) correctly into G o ( f ) or G e ( f ). Therefore, the binary classification problem that must be solved is not trivial.

IV. BINARY CLASSIFICATION OF CHANNEL GAIN DATA
Our purpose was to predict the existence of an outsider based on the measured G( f ). This is equivalent to classifying the measured G( f ) into G o ( f ) or G e ( f ), which is a binary classification problem. In this section, we explain the methods and classification results in detail.
As it is well known that machine learning is effective for solving classification problems, we adopted a machine learning approach to our purpose [37], [38], [39], [40], [41], [42]. Although there are various machine learning methods, k-NN is widely known as a simple method [39]. In this study, we adopted k-NN as the machine learning method. Although k-NN is a simple method, excellent performance can be obtained by appropriately preprocessing the channel gain data.

A. k-NN Classification
In this subsection, we explain the application of k-NN to our classification problem.
Because all measured data of G o ( f ) and G e ( f ) consist of 199 components, we denote nth data of the measured G o ( f ) and G e ( f ) by 199-D vectors x n and y n , respectively. In the component representation, the data vectors x n and y n are expressed as (x n1 , x n2 , x n3 , . . . , x n199 ) (4) Y y n = (y n1 , y n2 , y n3 , . . . , y n199 ) where X and Y are data sets composed of G o ( f ) and G e ( f ) measured beforehand, respectively. Both X and Y can be considered training datasets. As explained in Section III, we experimentally obtained 180 data samples for both x n and y n . Therefore, the training datasets can be written as {y 1 , y 2 , . . . ,y 180 }.
Furthermore, we define the appropriate distance between two arbitrary vectors u and v. In this study, we adopt the p-norm to define the distance as where u i and v i are components of u and v, respectively. The k-NN classifier used in our study is considered to be a function that outputs 0 or 1 when a new unknown data vector z is input. Mathematically, the k-NN classifier can be written as follows: where N x and N y are calculated by the procedure listed below. Procedure 1: Count N x and N y , which are the numbers of elements v (i) contained in X and Y, respectively.

B. Preprocessing of Channel Gain Data
As explained above, the k-NN classifier searches vectors that resemble the input vector from the training data sets X and Y. The degree of resemblance is quantitatively evaluated using d p . To obtain correct results with k-NN, it is desirable that the input vectors obtained under an ordinary state resemble vectors contained in X. Similarly, the input vectors obtained under an extraordinary state should resemble vectors in Y. These desirable situations are, however, not always realized. Fig. 17(a) shows three examples of G( f ) obtained in our experiment. The black curve shows a typical feature of G o ( f ) and we name it x ref . Let us suppose two different test data x test and y test , which were obtained under ordinary and extraordinary states and are plotted by blue and red curves, respectively. In this case, it is obvious that an undesirable The k-NN classifier outputs incorrect results in these situations.
The preprocessing of channel gain data is required to prevent the occurrence of the undesirable situations. A simple preprocessing method is normalization, that is, offsetting a data vector with the average value of its components. In equation form, the normalization of a data vector v is expressed by the transformation where v (1) is the normalized data vector. The normalized data vectors x (1) ref , x (1) test , and y (1) test , which, respectively, correspond to x ref , x test , and x test , are plotted in Fig. 17(b). It is observed that the situation become more preferable than that in Fig. 17(a) because d p (x (1) test , Fig. 17(b). However, as seen later, even the situation shown in Fig. 17(b) is insufficient for obtaining high-performance classifiers. The following data preprocessing procedure is used to realize the desirable situation Procedure 2: 1) Choose a natural number N div .
2) Partition the components of a data vector v into N div clusters. 3) Normalize each cluster. 4) Remove the partition.
Let v (N div ) denote the data vectors transformed from v using the procedure mentioned above. Note that data vectors such as x (1) ref , x (1) test , and y (1) test are special cases of N div = 1, which indicates no partition. Furthermore, we define v (0) v, which implies that the data vector is not normalized.
The data vectors preprocessed using Procedure 2 are plotted in Fig. 17 for several values of N div . It appears that the desirable situation d p ( is obtained for N div = 16 at a glance. To confirm the validity of preprocessing, we plotted d 1 and d 2 for various N div values in Fig. 18(a) and (b), respectively. It was confirmed that the is realized for p = 1, 2 when N div ≥ 8 in the sample data shown in Fig. 17.  -NN classifiers). These figures were obtained when (a) N div = 0, (b) N div = 1, (c) N div = 2, (d) N div = 4, (a) N div = 8, and (f) N div = 16. It is observed that E e becomes minimum when k = 1 regardless of the parameters p and N div . This means that 1-NN is the best of all k-NN classifiers.

C. Performance Evaluation of k-NN Classifiers
This subsection describes the methods and results of evaluating the performance of k-NN classifiers.
To evaluate the performance of k-NN classifiers, we utilized leave-one-out cross-validation (LOOCV) [39]. As explained previously, we experimentally obtained channel gain datasets X and Y both comprising 180 samples. For simplicity, we use the symbols X and Y not only for sets composed of x i and y i but also for those composed of x (N div ) i and y (N div ) i . To execute LOOCV, we should pick up one data vector ) as a test sample from the datasets. Then, the datasets from which the picked-up data vector is excluded are used as the training datasets. In equation form, the outputs of the k-NN classifier for the input test vectors x (N div ) i and y (N div ) i are, respectively, written as Then, the error rates obtained with LOOCV for the input data of the ordinary and extraordinary states can be, respectively, written as Furthermore, the total error rate regarding all the 360 data samples is written as As shown later, 1-NN is found to be the best of all k-NN classifiers. Hence, we plotted the error rates for 1-NN classifiers, as shown in Fig. 19. As shown in Fig. 19(a), E o (1, p, N div ) reaches zero for most combinations of { p, N div } by simply applying normalization. As a result, it can be said that the classification in an ordinary state is easy. However, Fig. 19(b) shows that the detection of an extraordinary state is not easy because E e (1, p, N div ) reaches zero only for limited combinations of { p, N div }. In equation form, the condition under which E e reaches zero can be written as Although the classification of G e ( f ) is more difficult than that of G o ( f ), error-free classification was achieved with the above conditions. An important result obtained here is that the 1-norm (Manhattan distance) is more suitable than the 2-norm (Euclidean distance) for calculating the error function d p in the proposed method. Fig. 19(c) shows the total error rate E total . It is observed that E total (1, p, N div ) = E e (1, p, N div )/2 for the most combinations of { p, N div } because E o (1, p, N div ) = 0 for the combinations.
Although it was demonstrated that the classification of G e ( f ) is more difficult than that of G o ( f ), Fig. 15 implies that the difficulty of the classification depends on D. It is expected that the classification of G e ( f ) will be easy for D ≥ 0.5 m because most G e ( f ) in Fig. 15(c) and (d) do not resemble G o ( f ) in shape. On the other hand, the classification will be much more difficult for D ≤ 0.2 m because G e ( f ) in Figs. 15(a) and (b) tend to resemble G o ( f ) in shape. To clarify the concern, we plotted E e for each D value in Fig. 20. As we expected, error-free classification was achieved for most combinations of { p, N div } when D ≥ 0.5 m and it was achieved for the limited combinations of { p, N div } when D ≤ 0.2 m.
Finally, we investigated the influence of k on E e . For this, we plotted E e as a function of k in Fig. 21. It is observed that E e is an almost monotonously increasing function of k and becomes minimum when k = 1 for all combinations of { p, N div }. Therefore, it can be concluded that 1-NN is the best k-NN classifier.

V. CONCLUSION
We proposed and investigated methods for predicting the existence of an outsider in HBC systems based on channel gain features detected by a F-RX. This approach is effective in resolving the problem of HBC system security, which leads to accidental data transmission and misidentification. We experimentally obtained 360 samples of HBC-channel gain data with EO/OE converters, which are effective for correctly evaluating HBC channel characteristics. It is a binary classification problem that predicts the existence of an outsider based on channel gain information. The experimental data implies that the classification problem becomes more difficult as D, which is the distance between the outsider and rightful user, decreases. We adopted k-NN to solve the classification problem and proposed an effective method to preprocess the training data. It was revealed that 1-norm performs better than 2-norm in calculating error functions, and 1-NN is the best of all k-NN classifiers. It was demonstrated that the error rate of the binary classification reached zero even for D = 0 m with the method and parameters that we found.
In this study, we utilized a broad bandwidth of 0.4-40 MHz. However, it is preferable for the bandwidth required for classification to become narrower. Therefore, the next meaningful step is to determine the optimal frequency bands and minimum bandwidth required for high-performance classification. Machine learning technologies have become astonishingly powerful and are increasingly evolving. It might be valuable to examine the effectiveness of various machine learning methods, such as artificial neural networks, in HBC systems.