*4.3. Experiment*

The final selected parameters are shown in Table 3. The final accuracy result is 86.78% with about 36,000 sensors data from the eight PIRs and the contact sensors for 14 days.



Some examples of the parameter selections are reported next: the first example is the selection of the Refresh Stage Duration. We took values from 1 to 30 min and tested the data from the dataset and obtained the result in Table 4. It can be noticed that when the Refresh Stage Duration is 5 min, the algorithm can reach the highest accuracy of 91.78%, with acceptable values of the other indicators, such as *Entropy* and *ChangeCost*.

**Table 4.** Parameter Selection of Refresh Stage Duration.


The next example concerns the selection of the Max Branch Number. Similarly, several values were tested to find out the best value. The results of the tests are shown in Table 5. From the table, we can see that when the Max Branch Number is set to 30, the algorithm obtains the best result.


**Table 5.** Parameter Selection of Max Branch Number.

Several ablation studies of the algorithm have been undertaken to compare the performance with different methods and settings.

First of all, the validation dataset has been tested without the multi-branch inference method, i.e., only one inference engine has been used to infer the status of the smart environment. As shown in Table 6, we can see that the multi-branch method has less *Entropy* and *ChangeCost* than the single-branch method, which means that the estimated result of the former method is more stable. Moreover, the *Accuracy* of the multi-branch method is higher than the single-branch method, by over 10%. Thus, the proposed multibranch inference method plays an important role in our algorithm.

**Table 6.** Comparison of multi-branch method and single-branch method.


In the proposed algorithm, overlap events can be detected and this message can be used as information to help the inference engine infer the house status. By using this event detector, the shortcomings of PIR sensors can be remedied. To prove this, an ablation experiment has been conducted and the result is shown in Table 7. Additionally, the detection of door actions, including the 'go in' and 'go out' events, have also been taken into account. From Table 7, we can see that without detecting the 'Overlap' event, the algorithm obtained a worse result than the proposed method in all the indicators. The former method regards the false overlapping case of the PIR sensors as real activation signals, which leads to an incorrect inference of the house status. If the 'Door Action' event detector was forbidden, the algorithm failed to make a correct estimation because the door action is important for the house status inference.

**Table 7.** Ablation Study on Event Detection.


### *4.4. Limitations of the Method*

It is worth noting that to detect the right number of people in the apartment, the following conditions must hold:

1. The number of people in the apartment is lower than the number *n* of rooms with a PIR sensor (or to the number of PIR sensors that cover separate areas). If this is not thecase,thealgorithmwillidentifyanumberofpeoplethatisatmostequalto*n*.


The proposed methodology is general and without any specific needs, excluding those reported above; the rooms are those of a typical apartment (kitchen, bedroom, bathroom, etc.), and the limitations are derived from the number of the rooms and their connections. A studio apartment, for example, is an environment that does not allow, in a non-intrusive way, to draw much information about the number of people (except for special 'private' events, such as the use of the bathroom). Although it is out of the scope of this article, in some real cases we have been faced with, by increasing the PIR densities in some specific rooms, they had a 'complex' characterization. For example, in an apartment with an openspace living area gathering, where there is a kitchen, dining table, living room, etc., the area has been virtually partitioned into sub-units in order to infer where people are moving and the type of activity they are doing. In these cases (with the limits reported above), it is also possible to estimate the number of people.
