1 Introduction

In recent years, the population of elderly people has witnessed substantial increase around the world. Consequently, investigations concerning methods to determine means to care of the elderly have drawn wide attention, and different policies have been adopted. In some countries, it is the responsibility of the government to provide for the elderly. This, in turn, increases the financial pressure upon governments. In other countries, citizens from younger generation look after their parents and elderly counterparts. This, however, puts the younger generation under considerable strain. To enable the aged to live independently as well as reduce dangers to a minimum, monitoring devices are being installed in homes. In this way, activities concerning daily living, such as sleeping, cooking, and eating, could be effectively recognized by analyzing data generated by monitoring devices.

Activity recognition involves prediction of resident activity via generated data. Over the past decade, activity recognition has received increased attention from numerous research groups using different kinds of monitoring devices, and source data generated by such devices could be categorized into five types [1], three of which are generated by sensors. The first category of sensor data is generated by body-worn sensors [2]. Residents are required to wear monitoring devices, by means of which their activities are recorded in real time. Although use this method protects resident privacy, the wearable devices could be considered an extra burden. The second category of sensor data is generated by pressure sensors [3] used to detect the position of residents seated on chairs, resting in bed, and performing sit-to-stand and stand-to-sit transitions. Monitoring technologies, at present, can only detect a few simple activities. For example, Shen et al. [4] proposed an efficient multilayer authentication protocol along with a secure session key generation method for wireless body area networks. Sun et al. [5] proposed a method based on the adaptive observation matrix to reduce errors incurred and facilitate complete and accurate reconstruction of sensor response signals, thereby facilitating accurately and completely [5]. Zhang et al. [6] proposed optimum cluster-based mechanisms based on a modified multi-hop layered model for load balancing via multiple mobile sinks. The third category of sensor data is generated by ambient sensors [7] placed in different rooms. Ambient sensors generally include light, temperature, and magnetic-door sensors. When residents move or perform an activity inside a room, ambient sensors get activated. The activity being performed by the resident is recognized based on sensor events. Resident motion activates a sequence of ambient sensors; for example, “washing” activates ambient sensors installed in taps. In this regard, Zhang et al. [8] investigated how mobile sensors could be efficiently relocated to achieve k-barrier coverage. Through use of such monitoring devices, residents can avail privacy protection and are freed from wearing additional devices. The fourth category of data involves video data generated by cameras [9]. Yu et al. [10,11,12] applied multimodal technology to human pose recovery. As observed in their research, resident activities could be recognized using video analysis and processing techniques. Although camera-based approaches are criticized for privacy breach, video-processing techniques have been recently introduced to anonymize and perform recordings only under situations wherein the user may encounter potential danger. The last category of data refers to sonic data generated by residents or objects, examples of which include, the sound of dish washing or falling of an object or person [13]. However, a major limitation in the use of sonic data for activity recognition is that it may be easily interfered by stray noise.

The proposed study focuses on activity recognition using data produced by ambient sensors. A number of approaches have been proposed to improve the performance of activity-recognition systems. However, most approaches proposed in this regard have associated great importance to the development of an excellent recognition algorithm rather than adjusting the imbalance in distribution of activity classes. For instance, Wu et al. [14] proposed a mixed-kernel-based weighted extreme learning machine for inertial sensors based on human-activity recognition with an imbalanced dataset [14]. Abidine et al. [15] performed automatic recognition of activities by selecting a suitable regularization parameter C associated with the soft-support vector machines method. Abidine et al. [16] also employed cost-sensitive support vector machines with adaptive tuning of the cost parameter to analyze imbalanced data [16]. In the proposed study, numerous public datasets were investigated under the presumption that imbalanced data distributions are a common occurrence. Additionally, it has been demonstrated via experiments that presence of an imbalanced distribution of activity classes tends to degrade the performance of activity-recognition systems. Contrary to the distribution of activity classes, this study proposes use of a sample-based algorithm, which in turn, serves to improve the synthetic minority oversampling technique (SMOTE) algorithm to adjust the imbalanced distribution of activity classes. Two public datasets are used to evaluate the proposed approach. Experimental results demonstrate that use of the proposed algorithm remarkably improves the performance of activity-recognition systems.

The remainder of this paper is organized as follows. Relevant works are presented in Sect. 2; terminologies associated with activity recognition are defined in Sect. 3; the proposed improved SMOTE algorithm is presented in Sect. 4; the proposed algorithm is evaluated and corresponding results are discussed in Sect. 5; lastly, findings of this study are summarized and future endeavors are declared in Sect. 6.

2 Related Work

This section presents a brief overview on approaches considered previously to address issues concerning activity recognition and imbalanced data adjusting.

2.1 Approaches for Activity Recognition

Activity-recognition approaches can, in general, be classified into data-driven and knowledge-driven approaches. Knowledge-driven approaches lay greater emphasis on the generation of recognition rules by following a heuristic strategy. Such rules are usually represented in some logical language, such as temporal logic or description logic. Post generation of recognition rules, logical reasoning is performed to recognize individual activities. Rugnone et al. [17] utilized temporal logic that represented rules to recognize abnormal activities. Yin et al. [18] and Chen et al. [19] represented recognition rules as ontology, and Chen et al. [20] proposed an improved ontology-based approach. At the core of these approaches lies an iterative process that begins from the so-called “seed” activity models, which are created via ontological engineering, deployed, and subsequently evolved via incremental activity discovery and model updates. Kong [21] proposed a decentralized belief-propagation-based method to facilitate multi-agent task allocation. Knowledge-driven approaches possess superior robustness, since recognition rules can be used in different environments. However, raw data commonly include substantial noise and uncertain information, which are difficult to identify and adversely affect the accuracy of activity recognition.

Data-driven approaches focus on the generation of classification models. Some of these approaches use time-series models, such as the hidden Markov (HMM) or conditional random fields (CRF), to recognize activities. Kasteren et al. [22, 23] employed HMM and hierarchical HMM to realize resident-activity recognition. Tong et al. [24, 25] employed the latent-dynamic and hidden-state CRF models to facilitate recognition of abnormal activities as well as activities of single and multiple residents. A commonality of these approaches is that greater emphasis is laid on the respective orders of activities and sensor events. However, time-series models usually demonstrate poor robustness [26]. For instance, it is rather obvious that daily orders of resident activities are seldom identical. For a given activity, the order of sensor events often changes. Furthermore, the order of activities of a given resident is often different from that of another. To enhance the robustness of time-series models, researchers exploited such static classifiers for activity recognition as the Naive Bayesian (NB), Support Vector Machine (SVM), k-Nearest Neighbor (kNN), and Random Forest (RF) [27]. Cook et al. [28] employed NB to recognize daily activities. Yin et al. [29] employed one-class SVM to recognize abnormal activities on a daily basis [29]. Gu et al. [30] proposed an effective incremental support vector ordinal regression formulation based on a sum-of-margins strategy. Hevesi et al. [31] used the kNN classifier to recognize daily activities. Gu and Sheng [32] proposed use of a regularization-path algorithm for ν-support-vector-based classification. Xia et al. [33] proposed an approach wherein the kNN algorithm and locality-sensitive hash were utilized to construct a secure and efficient index. Gu et al. [34] proposed a structural minimax probability machine for constructing a margin classifier.

2.2 Approaches for Handling Imbalanced Data

Datasets often possess unequal class distributions. This problem is referred to as imbalanced classification. Imbalanced distribution of data renders classifiers prone to be biased towards the majority class and accordingly invites poor classification performance. To address this problem up to a certain extent, a number of imbalance-adjustment strategies have been proposed. These strategies can be classified into the sampling-based and algorithm-based types [35].

The algorithm-based strategy focuses on improving the learning algorithm and includes the ensemble and cost-sensitive learning techniques. In this regard, Zhou et al. [36] proposed an ensemble-learning framework, which encloses cost-sensitive neural networks and classifiers for handling imbalanced classes. Li et al. [37] proposed a cost-sensitive and hybrid attribute measure—referred to as the multi-decision tree—to maximize classification performance whilst minimizing the total misclassification cost. Cheng et al. [38] designed a balanced classifier with imbalanced-data training based on the margin distribution theory.

Contrary to the above, the sampling-based strategy focuses on adjustment of imbalanced data and includes random under-sampling (RUS), random over-sampling (ROS), and SMOTE algorithms [39]. RUS is an sampling technique, which diminishes the majority class. The basic principle underlying RUS is to randomly select and delete a certain number of majority samples whilst reducing the number of minority samples to improve the imbalance within datasets. This method, however, is unlikely to be useful during classification of the deleted sample, which in turn, could cause loss of essential data. Zhang et al. [40] combined the inverse RUS and random tree techniques to implement imbalanced learning [40]. ROS and SMOTE refer two classic over-sampling methods, which involve expansion of the minority class. The basic idea behind ROS is to randomly copy minority samples within a dataset and increase the number of such samples to reduce the imbalance within the said dataset. This method, however, is just a simple copy of the minority sample, which may undergo an over-fitting phenomenon. Zhang et al. [41] proposed a random walk over-sampling approach to balance different class samples by creating synthetic samples using randomly walking from the real data. Use of the SMOTE algorithm adds artificial samples to the minority class. However, SMOTE does not performing oversampling based on a simple sample copy; instead, it generates new minority samples beyond the original dataset, thereby avoiding over-fitting of classifiers up to a certain extent. Sáez et al. [42] introduced an iterative ensemble-based noise filter into SMOTE, thereby enabling it to overcome problems related to noisy and borderline examples of imbalanced classification. Yu et al. [43, 44] integrated deep multimodal technology and SMOTE to facilitate image retrieval and ranking. Wang et al. [45] designed a back-propagating neural-network model using solar radiation as an input parameter to establish the relationship between solar radiation and air-temperature error whilst considering all data samples [45]. Ma et al. [46] proposed an efficient detection algorithm based on structural clustering to convert the structural similarity between vertices to network weights.

3 Terminologies

Prior to presenting the proposed approach, certain terminologies must be defined in advance. For the sake of clarity, a segment of activity records has been described in Table 1.

Table 1 A stream segment of sensor events

Definition 1

For a given sensor s, sr = (d, h, m, sn, sv, al) denotes a sensor event, such that if s denotes a run, d refers to the date when s was run, h denotes the corresponding hour, and m represents the corresponding minute. Accordingly, sn denotes the name of s; sv denotes the value of s, and al denotes an explanatory activity label.

Throughout this manuscript, sr.d, sr.h, sr.m, sr.sn, sr.sv, and sr.al are used to represent the tuples d, h, m, sn, sv, and al, respectively, of a sensor event sr. The notation Ω is used to represent a set of sensor events.

For example, the expression “2011-06-15 00:25:01.892474 LS013 7 Sleep” implies that a sensor LS013 has been activated at 00:25:01.892474 on 2011-06-15 with a measured value of 7, and at the said time, the concerned resident was sleeping.

Definition 2

Given two sensor events sr1 and sr2, sr1 is considered to be the precursor of sr2 if sr1.d < sr2.d holds or (sr1.d = = sr2.d AND sr1.h < sr2.h) or (sr1.d = = sr2.d AND sr1.h = = sr2.h AND sr1.m < sr2.m) holds. The event sr2 is considered to be the successor of sr1 if sr1 is the precursor of sr2.

Throughout this manuscript, the expression sr1< sr2 indicates that sr1 is the precursor of sr2.

For example, the event {2011-06-15 00:25:01.892474 LS013 7 Sleep} is the precursor of {2011-06-15 01:05:01.622637 BATV013 9460 Sleep}. Similarly, the event {2011-06-15 01:05:01.622637 BATV013 9460 Sleep} is the successor of {2011-06-15 00:25:01.892474 LS013 7 Sleep}.

Definition 3

Given two sensor events sr1 and sr2 such that sr1< sr2 holds, sr1 is considered the direct precursor of sr2 if ¬∃ sr ∈ Ω, sr1< sr AND sr < sr2 holds. The event sr2 is said to be the direct successor of sr1 if the event sr1 is the direct precursor of sr2.

Throughout this manuscript, sr1→ sr2 indicates that the event sr1 is the direct precursor of sr2.

For example, the expression {2011-06-15 00:25:01.892474 LS013 7 Sleep} is the direct precursor of {2011-06-15 01:05:01.622637 BATV013 9460 Sleep}. Likewise, the event {2011-06-15 01:05:01.622637 BATV013 9460 Sleep} is the direct successor of {2011-06-15 00:25:01.892474 LS013 7 Sleep}.

Definition 4

Given an activity a and n sensor events sr0, sr1, sr2,…, srn, srn+1, the term SR denotes the sensor sequence of a if ∀1 ≤ i ≤ n sri.al == a AND sr0 ≠ a AND srn+1 ≠ a AND ∀2 ≤ i ≤ n − 1 sri→ sri+1 holds.

Definition 5

For an activity a and a sequence of ambient sensors sr1, sr2, …, srn of a, ar = (sr1.h, srn.h, u, SNT, a) refers to an activity record. The term u denotes the approximate duration of activity a; SNT denotes a spatial feature and can be defined as a set {(srn, T)}, where srn ∈ {sri.sn|1 ≤ i ≤ n} denotes the name of a sensor; lastly, T = |{sri|1 ≤ i ≤ nsri.sn = srn}| denotes the frequency at which sensors named srn get activated. Terms u and SNT could be solved for using Algorithm 1 described below.

figure a

For the sample sequence described in Table 1, “(0, 3, 212, {(MA021, 2), (BATV012, 1), (BATV013, 1), (LS013, 2)}, Sleep)” describes an activity record of “Sleep.” The corresponding duration u is “212” min, because the approximate duration between the start and end times of “Sleep” equals “212” min. Ambient sensors “MA021” and “LS013” were each run twice while corresponding sensors “BATV012” and “BATV013” were each run once.

4 Methodology

This section briefly describes the improved SMOTE (ISMOTE) algorithm to balance the imbalanced distribution of activity classes. As can be observed in Fig. 1, SMOTE uses linear interpolation between two points to generate a new minority-class data sample, thereby limiting the range of sample generation. To address this problem, the ISMOTE algorithm generates new synthetic minority activities in the neighborhood of remaining minority-class samples. Two specified constraints are used to control the newly synthetic samples, thereby facilitating their generated in a robust manner. Compared to SMOTE, use of the ISMOTE algorithm leads to improving the generalization ability of a far greater number of classifiers. Additionally, the ISMOTE algorithm is capable of performing a more even and reasonable distribution of positive examples after balancing. Lastly, ISMOTE can also generate samples similar to minority samples generated by the ROS and SMOTE algorithms.

Fig. 1
figure 1

Diagrams of synthetic generation using a SMOTE and b ISMOTE algorithms with k = 3

The proposed ISMOTE approach can be appropriately described by algorithms 2 and 3 as well as its schematic flowchart (Fig. 2), as described hereunder. In algorithm 2, lines 1 and 2 describe parameter initialization, whereas lines 3–8 describe the statistics associated with the number of activity records for each activity class. Subsequently, line 10 describes calculation of the degree of imbalance within each class (Im_D). The Euclidean distance was used to determine activity records of k nearest neighbors (lines 11–14). Subsequently, algorithm 3 was used to generate synthetic minority-class activity records. Line 1 in algorithm 2 involves random selection of Im_D activity records of k nearest neighbors. Subsequently, lines 2–9 in algorithm 2 correspond to generation of synthetic minority-class activity records from the high-dimensional space. In case the newly generated synthetic minority-class activity records do not meet the specified constraints, the proposed ISMOTE algorithm would regenerate a new set of minority-class activity records (lines 10–12 in algorithm 2), and the above process would be repeated. Ultimately, a balanced set of activity records would be generated through use of the ISMOTE approach.

figure b
figure c
Fig. 2
figure 2

Flowchart of proposed ISMOTE approach

5 Results and Evaluation

5.1 Datasets

To validate the proposed algorithm, two public datasets—”HH102” and “HH104”—were considered. These datasets have been published by the Washington State University [47]. Statistical information concerning the two data sets are described in Table 2. Values listed under column “Sensors” correspond to the number of sensors involved and their corresponding categories. Similarly, values listed under column “Activities” correspond to the number of activity classes involved while those listed under column “Activity Records” correspond to the number of involved activity records. Lastly, values listed under “Measurement Time” correspond to durations over which data were collected duration that data is collected.

Table 2 Statistical information concerning datasets “HH102” and “HH104.”

For the “HH102,” dataset, the following identifier categories were considered.

  1. (1)

    Identifiers starting with “BA” indicate sensor battery levels; for example, BATP013, BATP019, BATV001–BATV023, and BATV102–BATV105.

  2. (2)

    Identifiers with names starting with letter “D” indicate magnetic door sensors—D001, D002, D005, and D006.

  3. (3)

    Identifiers with names starting with “L” and “LL” indicate light switches—L001–L005, LL001, and LL005.

  4. (4)

    Identifiers with names starting with “LS” indicate light sensors—LS001–LS023.

  5. (5)

    Identifiers with names starting with “M” indicate infrared motion sensors—M001–M022.

  6. (6)

    Identifiers with names starting with “MA” indicate wide-area infrared motion sensors—MA003, MA009, MA010, MA013, MA014, MA020, and MA023.

  7. (7)

    Identifiers with names starting with “T” indicate temperature sensors—T101–T105.

Involved activities include “Sleep” (“S”), “Bathe” (“B”), “Dress” (“D”), “Eat_Breakfast” (“E_B”), “Eat_Dinner” (“E_D”), “Groom” (“G”), “Take_Medicine” (“T_M”), “Toilet” (“T”), “Wash_Breakfast_Dishes” (“W_B_D”), “Wash_Dinner_Dishes” (“W_D_D”), “Watch_TV” (“W_T”), and “Work_At_Table” (“W_A_T”). Number of samples considered for the above activity classes and corresponding degrees of imbalance are listed in Table 3.

Table 3 Activity-class distribution for “HH102” dataset

Similarly, for the “HH104,” dataset, the following identifier categories were considered.

  1. (1)

    Identifiers starting with “BA” indicate sensor battery levels; for example, BATP001–BATP006, BATP101–BATP106, BATV001–BATV026, and BATV101–BATV106.

  2. (2)

    Identifiers with names starting with “D” indicate magnetic door sensors—D001–D006.

  3. (3)

    Identifiers with names starting with “L” and “LL” indicate light switches—L001–L006.

  4. (4)

    Identifiers with names starting with “LS” indicate light sensors—LS001–LS026.

  5. (5)

    Identifiers with names starting with “M” indicate infrared motion sensors—M001–M013, M016, and M020–M026.

  6. (6)

    Identifiers with names starting with “MA” indicate wide-area infrared motion sensors—MA014, MA015, MA017–MA019, and MA022.

  7. (7)

    Identifiers with names starting with “T” indicate temperature sensors—T101–T107.

Involved activities include “Sleep_Out_Of_Bed” (“S_O_O_B”), “Evening_Meds” (“E_M”), “Dress”(“D”), “Cook_Breakfast” (“C_B”), “Cook_Dinner” (“C_D”), “Phone” (“P”), “Take_Medicine” (“T_M”), “Toilet” (“T”), “Wash_Breakfast_Dishes” (“W_B_D”), “Wash_Dinner_Dishes” (“W_D_D”), “Morning_Meds” (“M_M”), and “Work_On_Computer” (“W_O_C”). Number of samples considered for the above activity classes and corresponding degrees of imbalance are listed in Table 4.

Table 4 Activity-class distribution for “HH104” dataset

5.2 Results and Evaluation Metrics

In this study, the ISMOTE algorithm was compared against the SMOTE algorithm and “Primary” through use of four classifiers—NB, SVM, C4.5, and RF. The term “Primary” implies that individual activities are recognized through use of a classifier, which does not include any algorithm for imbalanced-data adjustment. With regards to the SMOTE and ISMOTE algorithms, k was assigned a value of 5. The used toolset employed was Weka 3.9, and a 3-fold cross validation was performed. Evaluation metrics considered included accuracy, precision, and F-measure.

Average recognition accuracies concerning the HH102 and HH104 datasets are depicted in Figs. 3 and 4. The average accuracy achieved by “Primary” was observed to be almost equal to that achieved by SMOTE, whereas the average accuracy of ISMOTE exceeded that those of both SMOTE and Primary when employing SVM, C4.5 and RF. In contrast, when using NB as a classifier, the observed accuracy of ISMOTE was lower compared to that of SMOTE and Primary. The two best accuracy values were achieved by applying the ISMOTE algorithm when using RF as the classifier.

Fig. 3
figure 3

Average accuracies of HH102 dataset using SVM, NB, C4.5, and RF as classifier

Fig. 4
figure 4

Average accuracies of HH104 dataset using SVM, NB, C4.5, and RF as classifier

Trends concerning recognition accuracy for individual activities when considering the HH102 dataset are depicted in Figs. 5, 6, 7 and 8. Corresponding trends concerning the HH104 dataset are depicted in Figs. 9, 10, 11 and 12. For the HH102 dataset, use of the ISMOTE algorithm demonstrates higher accuracies for 11, 9, 10, and 9 activities, respectively, when compared against SOMTE and Primary with SVM, NB, C4.5, and RF being used as classifiers. Correspondingly, for the HH104 dataset, ISMOTE achieved higher accuracies for 10, 8, 11, and 11 activities, respectively, in comparison to SMOTE and Primary when employing SVM, NB, C4.5, and RF as classifiers.

Fig. 5
figure 5

Recognition-accuracy trends for HH102 dataset using SVM

Fig. 6
figure 6

Recognition-accuracy trends for HH102 dataset using NB

Fig. 7
figure 7

Recognition-accuracy trends for HH102 dataset using C 4.5

Fig. 8
figure 8

Recognition-accuracy trends for HH102 dataset using RF

Fig. 9
figure 9

Recognition-accuracy trends for HH104 dataset using SVM

Fig. 10
figure 10

Recognition-accuracy trends for HH104 dataset using NB

Fig. 11
figure 11

Recognition-accuracy trends for HH104 dataset using C 4.5

Fig. 12
figure 12

Recognition-accuracy trends for HH104 dataset using RF

As depicted in Figs. 3 and 4, the average accuracy achieved by “Primary” equaled 74% and 75%, respectively, both of which correspond to the lowest accuracy of activity recognition achieved when employing the four classifiers (SVM, NB, C4.5, RF). Additionally, NB is not suitable for use as a classification algorithm for activity recognition in conjunction with the ISMOTE approach for adjustment of imbalanced data. Conversely, RF can be observed to be the most suitable classification algorithm for activity recognition when used in conjunction with the ISMOTE approach.

In addition, as depicted in Fig. 6, as regards activity-recognition accuracy concerning the HH102 dataset when using ISMOTE in conjunction with the NB classifier, 8 out of 12 activity recognitions were observed to be better compared to those by Primary and SMOTE. Similarly, for activity-recognitions accuracies concerning the HH104 dataset (Fig. 10) when using ISMOTE in conjunction with the NB classifier, 9 out of 12 activity recognitions were observed to be better compared to those by Primary and SMOTE. Additionally, for the HH104 dataset, recognition accuracy of activities with fewer occurrences, such as “Sleep_Out_Of_Bed,” “Phone,” “Take_Medicine,” and “Wash_Dinner_Dishes,” were all observed to be higher compared to those achieved by Primary and SMOTE. This demonstrates the greater ability of the proposed ISMOTE algorithm with regards to accurate recognition of not-so-frequent activities.

Average recognition precisions of the Primary, SMOTE, and ISMOTE algorithms when applied to the HH102 and HH104 datasets are depicted in Figs. 13 and 14, respectively. As can be observed, the average precision achieved by Primary nearly equals that achieved by SMOTE. For the HH102 dataset, as previously stated, the average precision achieved by ISMOTE, in general, exceeds that achieved by SMOTE and Primary when employing SVM, C 4.5, and RF as classifiers, whereas it nearly equals the average precision of SMOTE and Primary when employing the NB classifier. With regard to the HH104 dataset, the average precision achieved by ISMOTE exceeds those of SMOTE and Primary regardless of the classifier type being used. For both datasets, the best precision was achieved by applying ISMOTE algorithm with RF classifier.

Fig. 13
figure 13

Average precision values for HH102 dataset using SVM, NB, C 4.5, and RF as classifiers

Fig. 14
figure 14

Average precision values for HH104 dataset using SVM, NB, C 4.5, and RF as classifiers

Trends concerning precision of individual-activity recognition for the HH102 dataset are depicted in Figs. 15, 16, 17 and 18. Corresponding trends with regards to the HH104 dataset are depicted in Figs. 19, 20, 21 and 22. For the HH102 dataset, ISMOTE achieves higher precisions in 7, 5, 8, and 8 activities, respectively, in comparison to SMOTE and Primary when employing SVM, NB, C 4.5 and RF as classifiers. Correspondingly, for the HH104 dataset, ISMOTE achieves higher precisions in 9, 6, 12, and 11 activities, respectively, in comparison to SMOTE and Primary when employing SVM, NB, C 4.5 and RF as classifiers.

Fig. 15
figure 15

Precision of activity recognition in HH102 dataset using SVM

Fig. 16
figure 16

Precision of activity recognition in HH102 dataset using NB

Fig. 17
figure 17

Precision of activity recognition in HH102 dataset using C 4.5

Fig. 18
figure 18

Precision of activity recognition in HH102 dataset using RF

Fig. 19
figure 19

Precision of activity recognition in HH104 dataset using SVM

Fig. 20
figure 20

Precision of activity recognition in HH104 dataset using NB

Fig. 21
figure 21

Precision of activity recognition in HH104 dataset using C 4.5

Fig. 22
figure 22

Precision of activity recognition in HH104 dataset using RF

A comparison of F-measure values obtained when employing the Primary, SMOTE, and ISMOTE algorithms when applied to the HH102 and HH104 datasets are depicted in Figs. 23 and 24, respectively. In this case, performances of the Primary and SMOTE algorithms can be observed to be nearly identical. For both datasets, F-measure values achieved by ISMOTE exceed those achieved by SMOTE and Primary when employing SVM, C 4.5, and RF classifiers. However, F-measure values of ISMOTE when employing NB as classifier are lesser compared to those of SMOTE and Primary for both datasets. In both cases, best F-measure values are achieved when employing the ISMOTE algorithm in conjunction with RF.

Fig. 23
figure 23

F-measure values for HH102 dataset using SVM, NB, C 4.5, and RF as classifiers

Fig. 24
figure 24

F-measure values for HH104 dataset using SVM, NB, C 4.5, and RF as classifiers

In the proposed approach, the parameter k was used to control the scope of generated synthetic activities. During experimentation, values of k were set to 3, 5, 7, and 9, respectively, to discuss the effect of the value range of k on results reported in the revised manuscript. As observed from experimental results, use of RF as a classifier demonstrated attainment of the highest average values of accuracy, precision, and F-measure in both datasets. These results demonstrate RF as the most suitable classifier to be employed for activity recognition, in conjunction with the proposed ISMOTE algorithm. In the proposed experiment, therefore, the RF classifier was used to compare results obtained when using different k values. A comparison of average percentage accuracy and F-measure values obtained for the HH102 and HH104 datasets, respectively, when employing different values of k are depicted in Figs. 25 and 26. For the HH102 dataset, the observed highest average accuracy and F-measure values using RF corresponded to k = 5, and the same was true for the HH104 dataset, too. However, the F-measure value is higher when we set k = 5 rather than k = 7. Thus, in our experiment, we set the k = 5.

Fig. 25
figure 25

Performance of RF classifier applied to HH102 dataset with different k values

Fig. 26
figure 26

Performance of RF classifier applied to HH104 dataset with different k values

There exist two main classes of imbalance learning strategies—sampling methods and cost-sensitive techniques. In this study, use of four well-known strategies was investigated. Three of these strategies qualify as sampling methods, namely, random under-sampling (RUS), random over-sampling (ROS) and synthetic minority over-sampling technique (SMOTE). The fourth strategy qualifies as a cost-sensitive technique, referred to as the cost-matrix adjuster, wherein the cost matrix is adjusted. The above four strategies were specifically considered because they are popular and diverse. RUS refers to an under-sampling technique, wherein the size of the majority class is reduced. ROS and SMOTE are two classic over-sampling methods, wherein the minority class is expanded. The difference between them is that in ROS, duplicated samples are added to the minority class, whereas in SMOTE, artificial samples are created to be added to the minority class. Finally, the cost-matrix adjuster (CMA) is a cost-sensitive technique.

As suggested by results observed in this study, use of the RF classifier demonstrates attainment of highest average values of accuracy, precision and F-measure for both datasets considered. RF can, therefore, be considered as the most suitable classifier type for activity recognition. Thus, RF was also employed in this study to compare activity-recognition results obtained when using different imbalance learning strategies—RUS, ROS, SMOTE, and CMA. A comparison of average percentage accuracy and F-measure values obtained for the HH102 and HH104 datasets, respectively, when employing different imbalance learning strategies are depicted in Figs. 27 and 28. As observed, for both datasets, the observed highest average accuracy and F-measure values using RF corresponded to use of the ISMOTE algorithm. For the HH102 dataset, the observed accuracy of ISMOTE using RF exceeded those of the primary, CMA, RUS, ROS, and SMOTE by 7.40%, 4.65%, 21.62%, 3.45%, and 8.91%, respectively. With regard to the HH104 dataset, corresponding values equaled 7.95%, 5.56%, 93.88%, 3.26%, and 7.95%, respectively.

Fig. 27
figure 27

Performance of RF classifier applied to HH102 dataset when using different imbalance learning strategies

Fig. 28
figure 28

Performance of RF classifier applied to HH104 dataset when using different imbalance learning strategies

5.3 Discussion

In accordance with results obtained in this study, following points must be noted.

  1. (1)

    Use of the ISMOTE algorithm with RF demonstrates attainment of highest average values of accuracy, precision, and F-measure. The observed highest average accuracy value equaled 90% and 95% for the HH102 and HH104 datasets, respectively. Correspondingly, the highest average precision value equaled 90% for HH102 and 96% for HH104. Lastly, the highest average F-measure value equaled 90% for HH102 and 95% for HH104.

  2. (2)

    Use of the RF classifier demonstrated attainment of the highest average values of accuracy, precision, and F-measure for both two datasets. RF can, therefore, be considered as the best classifier type to be used for activity recognition.

  3. (3)

    In dataset HH102, there exist 8 activity classes with more than one degrees of imbalance. Table 5 lists improvements in accuracy and precision values of these activity classes obtained through use of RF. For a given activity class a, the value of “I-P” denotes the difference between accuracy (precision) of a obtained using ISMOTE and that obtained using Primary. Likewise, the value of “I-S” denotes the difference between accuracy (precision) of a obtained using ISMOTE and that obtained using SMOTE. Accuracy and precision values of 6 activity classes were observed to have been remarkably improved in this study. Correspondingly, in dataset HH104, there existed 10 such activity classes. Table 6 lists improvements in accuracy and precision values of these activity classes obtained through use of RF. Accuracies of 11 activity classes and precisions of 10 activity classes were observed to have been remarkably improved. Observed results demonstrate ISOMTE to be a promising algorithm for use in activity-recognition applications.

    Table 5 Accuracy and precision improvements achieved by applying RF to HH102 dataset
    Table 6 Accuracy and precision improvements achieved by applying RF to HH104 dataset

6 Conclusions

This paper presents the ISMOTE algorithm as a means of realizing adjustment of imbalanced activity classes with regard to activity-recognition applications. The proposed algorithm was evaluated using four classifiers on two public datasets, and results obtained in this study demonstrate the ability of the ISMOTE algorithm to dramatically improve the performance of activity-recognition systems.