## 3 Proposed Architecture
### The Imbalanced Dataset  
Imbalanced data typically refers to a classification problem in which the number of samples per class is not equally distributed. The usual phenomena in an imbalanced dataset are one of the sample classes has a very high number of samples, which is also known as the majority class, while there are classes in which the number of samples is much lower than the majority class. The training process using a high imbalanced dataset can be a challenge, as most of the metrics used to evaluate model performance assume that the dataset is well distributed.  
In the OPPORTUNITY dataset, the majority of the classes were found to be 40 times larger than the minority classes. This strong difference in class distribution led to the model learning the representation of the majority classes well, but not that of the minority classes. However, there is a need to train and develop the model to identify minority classes, which  
\begin{table}
\begin{tabular}{c c} \hline
**Elements** & **Details** \\ \hline Type & The activity of daily living \\ \hline Participants & 4 \\ \hline Sampling rate & 32 Hz \\ \hline Activity recorded & 16 \\ \hline No. of raw data generated & 701,366 \\ \hline Sensors in used & Accelerometer, gyroscope, magnetometer, object, and ambient sensor \\ \hline \end{tabular}
\end{table}
Table 1: Details of the OPPORTUNITY dataset for human activity recognition.  
\begin{table}
\begin{tabular}{c c c c} \hline
**Class** & **Label** & **Class** & **Label** \\ \hline
0 & NULL (no activity) & 9 & Open Drawer 1 \\ \hline
1 & Open Door 1 & 10 & Close Drawer 1 \\ \hline
2 & Open Door 2 & 11 & Open Drawer 2 \\ \hline
3 & Close Door 1 & 12 & Close Drawer 2 \\ \hline
4 & Close Door 2 & 13 & Open Drawer 3 \\ \hline
5 & Open Fridge & 14 & Close Drawer 3 \\ \hline
6 & Close Fridge & 15 & Clean Table \\ \hline
7 & Open Dishwasher & 16 & Drink from Cup \\ \hline
8 & Close Dishwasher & 17 & Toggle Switch \\ \hline \end{tabular}
\end{table}
Table 2: Activity classes of the OPPORTUNITY dataset.  
\begin{table}
\begin{tabular}{c c c} \hline
**Training Set** & **Validation Set** & **Test Set** \\ \hline S1-Drill & S1-ADL5 & S2-ADL4 \\ \hline S1-ADL1 & & S2-ADL5 \\ \hline S1-ADL2 & & S3-ADL4 \\ \hline S1-ADL3 & & S3-ADL5 \\ \hline S1-ADL4 & & \\ \hline S2-Drill & & \\ \hline S2-ADL1 & & \\ \hline S2-ADL2 & & \\ \hline S3-Drill & & \\ \hline \end{tabular}
\end{table}
Table 3: The training, validation and test set in model development using OPPORTUNITY dataset.  
are the activities aside from NULL (no activity) stated in Table 2 which represent real-life scenarios; hence, further feature engineering and handling strategies are needed to work on this dataset before the model is trained.  
To address the problem of the imbalanced dataset, a resampling approach was applied to the OPPORTUNITY dataset. The undersampling method was used to reduce the size of the majority class, which is the NULL class in the OPPORTUNITY dataset. In order to apply undersampling, firstly the NULL class data were segmented out from the original dataset. Then, part of the NULL class data of each subject was randomly selected and combined with the training dataset before feeding them into the training pipeline. In the experiment, for each subject, 10% of the original NULL-class data was selected from the dataset.  
In addition, a focal loss function [37] was used to address the issue of the class imbalance problem without the resampling method. It can transfer between the object detection domain to the sensor classification domain. This approach can reduce the relative loss toward well classified examples in the majority class and draw attention to model optimization in hard, misclassified examples in the minority classes.