Temporal stability of Wi-Fi CSI data from ESP32 microcontrollers

This section tries to determine the stability over time of the CSI data collected using ESP32 microcontrollers. This aims to confirm or discard the identified factor (4) as the cause of the poor results in Localized HAR based on Wi-Fi CSI.

Plotly loading issue

This page contains Plotly interactive figures. Sometimes, the figures might not load properly and show a blank image. Reloading the page might solve the loading issue.

Results

Code
import os 
import numpy as np

from libs.chapter5.analysis.visualization import plot_confusion_matrix
from libs.common.utils import load_json

REPORT_PATH = os.path.join('data', 'chapter5', 'model-reports', 'lodo-dataset', 'reports.json')
PREDICTION_TARGET = 'Activity'
LABELS = ['03/28', '03/29', '03/30', '03/31', '04/01']

lodo_reports = load_json(REPORT_PATH)

Figure 14.1 shows the confusion matrix obtained from the LODO procedure. The matrix shows different patterns for the samples collected on different days:

  • \(03/28\): its samples were mainly classified into the next day, although a significant amount of them (\(31.7\%\)) were classified into \(04/01\).
  • \(03/29\): more than \(90\%\) of its samples were classified into the next two days. Few samples were classified into the previous day.
  • \(03/30\): the \(33.8\%\) and \(43.8\%\) of its samples were classified into its previous and next day. The remaining samples were classified into \(03/28\) (\(12.8\%\)) and \(04/01\) (\(9.6\%\)).
  • \(03/31\): more than the \(75\%\) of its samples were classified into the previous day and a \(14.9\%\) into \(03/29\). Few samples were classified into the next day.
  • \(04/01\): as in \(03/31\), around \(75\%\) and \(16\%\) of the samples were classified into the two previous days. Few samples were classified into the remaining days.
Code
def plot_combined_confusion_matrix(reports):
    combined_cf = np.zeros((5, 5))
    for report in reports:
        report_cf = np.array(report['confusion_matrix'])
        combined_cf += report_cf

    return plot_confusion_matrix({'accuracy': 0, 'confusion_matrix': combined_cf}, 'Day', LABELS)


plot_combined_confusion_matrix(lodo_reports)
Figure 14.1: Confusion matrix of the LODO procedure.

Summary

While a clear pattern cannot be seen across all days, the samples of each day tend to be classified into the adjacent days. The main exception is the day \(03/28\), whose \(30\%\) of samples are classified into the most distant day. Notwithstanding, the results indicate that the CSI data from one day is more similar to the adjacent days than to other days. Consequently, these results would indicate that the collected CSI data is not stable over time, confirming factor (4).

Code reference

Tip

The documentation of the Python functions employed in this section can be found in Chapter 5 reference: