## 3 Design and Implementation
### Classification Algorithm  
An important component of the haptic authentication system is the program for classifying gesture signals into different patterns. The classification algorithm was developed using a probabilistic inference model with flow shown in Algorithm 1. The algorithm normalizes the sensor information from the acceleration sensor in five different axes: x, y, z, and two combined axes of x-z and y-z, shown in Figure 2. The system learned a total of 250 trials by 50 users for each manipulation gesture to define the normalized value in signals and the threshold probability of each gesture. Manipulation gestures are classified by how the normalized values and their probability thresholds in signal distribution on the five axes vary among the patterns. Compared with traditional pattern recognition, which only deals with one stream of signal data, our algorithm has to handle multiple data streams including position, orientation, acceleration, and movement. Figure 1: Manipulation of a prototype ID tag to generate haptic passcodes. Even though signals from the haptic gestures are acquired with a duration ranging approximately from 600 ms to 3100 ms (Table 1), the inference algorithm needs only the signals for the first 50 samplings, which last for about 1500 ms, to differentiate and classify the haptic gestures with high enough accuracy and efficiency. Users can combine these various haptic gestures to make a multiple-digit passcode with a minimum latency of 1750 ms between patterns. The minimum latency is the duration required for the processing of the first 50 samplings of signal plus the inter-pattern interval. During the first phase of the algorithm, the moving average of the \(I\)th data point for each axis is calculated as follows: if \(a_{i}\) denotes the moving average of the \((i-9)\)th through \(i\)th data points from the \(a\) axis, then  
\[a_{i}=\frac{\sum_{k=i-n-1}^{i}k-th\text{ raw data of }a-\text{axis}}{n},\,n\leq i \tag{1}\]  
where \(n\) is the minimum number of data points to calculate the moving average (the default for which is set at 10). The normalized moving average of the data for each axis is calculated as follows. Assuming that \(N_{a}\) denotes a normalized value of the \(a\)-axis data and that \(a_{i}\) denotes the moving average of the \(a\)-axis data, then  
\[N_{a}=\frac{a_{i}-\mu}{\sigma} \tag{2}\]  
where \(\mu\) denotes the average value and \(\sigma\) refers to the standard deviation during the initial \(t\) seconds (where \(t\) is set at 5). In order to detect the starting point of sampling for 50 data points, a specific data point \(N_{z}\) is used and is given through the normalization process, since the most sensitive axis of the acceleration sensor during the haptic manipulations seems to be the \(z\) axis. Figure 2: Sample moving average plots: (**a**) Plots of the raw acceleration sensor signals from five axes for the “tapping (TAP), shaking (SHK), horizontal flipping to right (HFR), horizontal flipping to left (HFL), vertical flipping at 90 degree (VF90), vertical flipping at 180 degree (VF180), turning over (TO)” sequence when the system was embedded in an ID tag; (**b**) Plots of rearranged normalized signal plots for the same seven haptic gestures. In the second phase of the classification algorithm, comparisons are made for each pattern between the acquired normalized value from each axis and the learned pattern information. The decision tree method is used to classify the patterns as follows. We assume that axis a and axis b denote arbitrary axes among the x, y, z, x-z, and y-z axes.