Efficient Occupancy Detection System Based on Neutrosophic Weighted Sensors Data Fusion

Recently, a great interest has been dedicated to improving data fusion techniques for indoor occupancy detection. Indoor occupancy detection is extensively used in various applications, such as energy consumption control, surveillance systems, and disaster management. Using environmental sensors to collect data for detecting the occupancy state has the benefit of maintaining privacy. Also, it helps in improving monitoring systems and saving money due to energy consumption control. Nevertheless, sensor data is usually incomplete and noisy, which makes it uncertain and unreliable. These problems affect the detection accuracy. This paper proposes a comprehensive occupancy detection system that depends on a new fusion technique for fusing heterogeneous sensor data, which highly improves occupancy detection efficiency. Using Neutrosophy, the proposed technique handles sensor data uncertainty. Additionally, it improves reliability by fusing multiple sensors data. As it uses only one feature generated from fusing multiple sensors data, training and testing time is reduced. Consequently, the experimental results of applying the proposed fusion technique on a public benchmark dataset exhibit a significant enhancement in binary occupancy detection accuracy. The proposed technique enhanced the worst-case accuracy from 75.1 to 81.3%, 84.7 to 90.7%, 72 to 84.2%, 73.58 to 85.1%, and 65.9 to 78% using Linear Discriminant Analysis (LDA), K-Nearest Neighbors (K-NN), Naive Bayes (NB), Support Vector Machine (SVM), and Random Forest (RF) classifiers, respectively. Using the other six performance metrics, the proposed technique results also outperform some state-of-the-art techniques.


I. INTRODUCTION
Indoor occupancy detection has a continually rising interest as an active research field due to its significant benefits in various critical applications. Examples of critical applications include building surveillance systems. Occupancy detection is used in building surveillance systems to provide additional human services, such as emergency response and decision support [1]. It also increases the security level of Intrusion Detection Systems (IDSs), which is an active research area, by detecting intruders and occupants' suspicious activities [2]. Another example is tracking space utilization, using occupancy detection techniques, which enables employees to locate colleagues and places to work in an address The associate editor coordinating the review of this manuscript and approving it for publication was Wai-Keung Fung . free environment. Lopez-de-Teruel et al. [3] proposed a localization system based on received signal strength for deploying fast occupancy services in a building.
Recently, many countries have been exerting every effort in response to climate change. Global warming is the main reason for this serious problem. Therefore, controlling energy consumption in buildings according to the occupancy state in these buildings is essential for decreasing global warming [4]. Energy consumption in buildings is about 40% of the global consumption of resources [5]. Hence, the allocation of spatiotemporal services [6] in smart buildings is another example of occupancy detection applications. Based on the occupancy state, services like air conditioning, heating, ventilating, and lighting systems can be automatically controlled, thus saving energy resources [7]. Energy consumption control is also an effective way to reduce dependency on fossil fuels and decrease CO 2 emissions. Enhancing indoor air quality and increasing occupants' comfort is another use of occupancy detection [8]. The utilizations mentioned above of occupancy detection are not the only uses that highlight its importance or rather necessity.
Risk assessment applications also use occupancy detection in many cases, such as dealing with criminal operations, environmental disasters, and indoor pollution [9]. During emergency planning (e.g., evacuation), knowing the occupancy state, the occupants' movements, and their positions can save many lives [10]. In such cases, the common real-time occupancy tracking techniques are based on camera data. There are two types of occupancy detection data sources: cameras and environmental sensors (e.g., CO 2 , temperature, motion, humidity, and light).

A. CAMERA-BASED SYSTEMS
Cameras are a common data source for building occupancy estimation and detection systems because of their high precision. Using deep learning, Tien et al. [11] suggested a vision-based method for occupancy detection. The suggested method could detect multiple occupants as well as their activities. Liu et al. [12] suggested a system for detecting occupants inside a room and at the entrance. They proposed a two-stage static technique depending on shapes and appearances for occupancy detection in a room. As for detecting occupancy at the entrance, they suggested a motion-based technique. Also, they proposed a dynamic method based on a Bayesian network to fuse detection results at entrances with those inside rooms for more accuracy.
Zou et al. [13] presented an occupancy estimation framework based on a cascade classifier to detect human heads using cameras. In the first step, a pre-classifier was applied to concentrate on head windows. After that, a Convolutional Neural Network (CNN), the primary classifier, classified the head areas. Finally, for high estimation accuracy, a clustering analyzer was applied to fuse consecutive frames. Khalifa et al. [14] presented a new database for pedestrian detection. This database contains synchronized images captured from two types of cameras: a mobile car camera and a static road camera. They also suggested a novel framework for multi-view pedestrian detection based on the presented database.
Generally, camera-based occupancy detection and estimation systems can achieve high accuracy detection and estimation. Consequently, cameras are usually used to produce the ground-truth and labeled data for other occupancy detectors [15], [16]. Even though camera-based occupancy detection systems achieve high detection accuracy, they suffer from some problems, such as illumination conditions influence, high computational complexity, privacy concerns, and costly hardware required for advanced signal processing. Moreover, a line of sight is required for camera-based systems to minimize obstructions [17].

B. ENVIRONMENTAL-SENSOR-BASED SYSTEMS
Environmental sensors, including humidity, temperature, motion, CO 2 , light, and pressure, are often existent in modern buildings, especially in lighting and Heating, Ventilation, and Air-Condition (HVAC) systems [18]. Considering that occupants' existence affects the indoor environment, environmental sensor measurements can be used as a good indication for occupancy. There exists a rich body of research on building occupancy detection systems based on environmental sensors. Some researchers used data from only one sensor type, such as dust concentrations [19], motion [20], and CO 2 data, which has shown good occupancy detection accuracy results, while others used multiple types [9], [21].
Environmental sensors are preferable to using cameras because sensor data processing requires fewer processing capabilities and smaller storage sizes. Besides, it maintains the privacy of individuals. However, uncertainty and unreliability are the main problems of using environmental sensor data because sensor data tends to be incomplete and noisy. These problems affect the detection accuracy and lead to a challenging area of research. For these reasons, this paper focuses on binary occupancy detection using only sensor data. Occupancy detection can be treated either as a binary classification problem or a multiclass one. The target of occupancy detection in the case of binary classification is predicting whether a specific place is occupied (1) or not (0). In the multiclass case, the target is the occupants' number [22], [23].
Most of the current occupancy detection researches concentrate on methods of classification [24], such as Support Vector Machines (SVMs) [15], [25], Neural Network (NN) [26], and Hidden Markov Models (HMM) [27], [28]. Dealing with the uncertainty and unreliability of data, however, is not given the required attention. Therefore, this paper proposes a new fusion technique to fuse heterogeneous sensor data based on Neutrosophic sets. Using Neutrosophy to represent a certain percentage of the data increases the data validity, providing better accuracy in detecting the occupancy state. Moreover, using a variety of sensor types increases data reliability. Fusing the training and testing phases' input features provides lower computational cost than using these features separately. These results were proved by applying the proposed technique on a public dataset for occupancy detection [29].
The remaining part of this paper is organized into five sections. Section 2 states contemporary fusion studies on sensor-based occupancy detection classified into three fusion levels, current limitations, and how we overcame these limitations in the proposed system. Section 3 introduces the proposed occupancy detection system's framework with a detailed explanation for the suggested fusion technique. Section 4 describes the conducted experiments. Section 5 discusses the experimental results of applying the suggested technique on a public dataset. Finally, Section 6 summarizes the proposed work conclusions and presents future work directions.

II. RELATED WORK
Contemporary environmental occupancy detection research can be classified based on used sensors into homogeneous sensors and heterogeneous sensors. In heterogeneous sensorbased occupancy, using a variety of sensor types for detection increases the reliability of data. Data fusion is also used to deal with heterogeneous sensor data, unlike homogeneous sensor data, which requires data aggregation. Thus, this section will be dedicated to classifying heterogeneoussensors-based researches into three fusion levels: featuresto-feature fusion (F2F), features-to-decision fusion (F2D), and decisions-to-decision fusion (D2D). In F2F, features extracted from sensors data are combined to generate one new feature. In F2D, the features are combined using a Machine Learning Algorithm (MLA) to make a decision. In D2D, decisions obtained from multiple MLAs based on individual features are fused to make a final decision. Each level has its pros and cons as summarized in Table 1. The following three subsections discuss the three fusion levels and their pros and cons in detail. Also, the related work researches were reviewed and classified, each according to the fusion level it represents.

A. FEATURES-TO-FEATURE (F2F) FUSION
Although using multi-sensor features can improve detection accuracy, it may lead to overfitting [29]. Also, using more than one feature increases time complexity. In the F2F fusion level, the features extracted from sensor data are combined to generate a new feature used as an input to a MLA for detecting the occupancy state. The main advantage of using this fusion level is that it can benefit from the correlation among multiple features. Also, only one feature will be used as input for the learning phase, therefore saving some computation time. However, the fused feature must be in the same format [30].
Chaney et al. [31] fused features derived from indoor CO 2 , temperature, and electrical power sensors using a method that depends on Dempster-Shafer theory. After that, an HMM was used for predicting the occupancy. Also, the energy consumption was fused with the occupancy state for developing a metric to assess the likelihood of the occupant participating in a demand response at various times of the day. Based on cross-validation and ground truth information, the suggested approach could predict daytime occupancy and handle missing sensor data.
Christodoulou et al. [32] combined Fuzzy Cognitive Maps (FCM) with SVM. First, the correlation between sensor data variables (Temperature, Humidity, Humidity Ratio, Light, and CO 2 ) was attained through using FCM to generate a single variable. Then, SVM took the generated variable as an input to enhance prediction accuracy. Accuracies of 97.9 and 99.45 were achieved using two testing datasets [29].
Fayed et al. [33] proposed Neutrosophic Features Fusion (NFF) method to generate the fusion equation dynamically, using the correlation of Neutrosophic data. A neutrosophic feature was produced using CO 2 , humidity, temperature, and light sensors readings from occupancy detection dataset [29]. Linear Discriminant Analysis (LDA), FUzzy GEnetic (FUGE), and Random Forest (RF) algorithms were used to prove that using the proposed method as a preprocessing step enhanced the worst-case accuracy. In the case of RF, the accuracy was enhanced from 57.51 to 88. 16. Applying LDA, the accuracy enhanced from 75.13 to 88.01. On the other hand, using FUGE enhanced the accuracy from 57.93 to 84.55. Also, their method achieved accuracy up to 99.16 for the best-case accuracy using LDA.

B. FEATURES-TO-DECISION (F2D) FUSION
Regarding the F2D fusion level, the features are combined to make a decision. In other words, it is the phase of applying an MLA on the features to detect the occupancy state [34]. Although applying MLA directly to multi-sensor features is a simple operation and can improve the detection accuracy, it may lead to overfitting. Also, using multiple features for training is time-consuming. A lot of researches used this fusion level.
Lam et al. [27] applied HMM to features produced from acoustic and CO 2 sensors data. Due to the HMM model's ability to drop small sudden changes in occupancy levels during static intervals, HMM achieved a reasonable accuracy of 80% in detecting the occupants' number. Hailemariam et al. [35] used a decision tree to fuse CO 2 , power use, motion, and sound sensors features. Using the root mean square error feature of a passive infrared motion sensor, a good accuracy of 97.9% was achieved in occupancy detection. The accuracy was increased to 98.4% by fusing multiple motion sensor features using a decision tree.
Yang et al. [36] predicted the occupants' number using the Radial Basis Function neural network with an accuracy of 87.62%. This NN used the radial basis function, which uses Euclidean distance, as the hidden layers activation function. Hence, using the radial basis function allowed converting low-dimensional inputs (linear inseparable) to high-dimensional inputs (separable). The sensors data used were humidity, light, sound, motion, CO 2 , and temperature.
Ekwevugbe et al. [37] proposed an Adaptive Neuro-Fuzzy Inference System (ANFIS) based method for predicting the occupancy. This method was suggested to combine indoor climatic measures, indoor events, and energy consumption. The suggested method was expected to increase reliability. Ekwevugbe et al. [26] used Feed-Forward NN with backpropagation learning to fuse information, including case temperature, motion, CO 2 , and sound level, for estimating the number of occupants. For feature selection, they used symmetrical uncertainty analysis. Also, they used a genetic-based search to optimize the sensor combination. They achieved an accuracy of 75% using the proposed method.
Using relative humidity, light, CO 2 , temperature, infrared, sound, door switch, and motion sensors, Yang et al. [38] used various techniques to detect occupancy in different occupancy levels. The best accuracy range, [96.0% -98.2%], was achieved using the decision-tree method. Their results showed that the proposed occupancy-based demand-response HVAC control could save 18% of electricity and 20% of gas compared to the conventional HVAC control.
Using the Auto-Regressive Hidden Markov Model (ARHMM), Ai et al. [39] estimated the occupants' number with an accuracy of 84%. The suggested method derived the ARHMM autoregressive part coefficients and analyzed wireless sensor network data. The analyzed data was from temperature, PIR, reed switches, airspeed, CO 2 , and relative humidity sensors. The results showed that ARHMM was better than HMM in estimating the occupants' number when the occupancy level was changed frequently.
Candanedo and Feldheim [29] combined temperature, light, CO 2 , and humidity sensors data using different statistical classification models: RF, Gradient Boosting Machines (GBM), LDA, and Classification and Regression Trees (CART). High accuracy of 97% was achieved by LDA using two sensors data: (light, CO 2 ), (temperature, light), (light, humidity), or (light, humidity ratio). These promising results were owing to the aforementioned combinations having good separation for occupancy status. Low accuracy of (68.63% and 32.68%) was obtained by RF using temperature, humidity, CO 2 , and humidity ratio. These poor results were due to the high correlation between variables.
Hua et al. [40] fused temperature, lights energy, working time, and solar factor using the Support Vector Regression technique. They produced the training and testing data using the thermal software EnergyPlus. The error ratio of using the 5-feature model was 0.0264, while for the 4-feature model was 0.0532. Hence, the performance of the 5-feature model was better than the 4-feature model's one because the 4-feature model suffered from under-fitting.
Tutuncu et al. [41] applied seven various NN algorithms on humidity, temperature, CO 2 , and light sensors data from the UCI dataset [29]. The seven NN algorithms were Batch Back Propagation (BBP), Levenberg-Marquardt, Conjugate Gradient Descent, Online Back Propagation, Limited Memory Quasi-Newton (LMQN), Quick Propagation, and Quasi-Newton. LMQN algorithm achieved the highest accuracy (99.06%), while the BBP algorithm achieved the lowest one (80.32%). Alghamdi [42] combined humidity rate, temperature, CO 2 , and light sensors data from the UCI dataset [29] using Naïve Bayes (NB), Ada boosting, SVM, and K-Nearest Neighbors (K-NN). The accuracy achieved by NB and SVM was 94%. The best accuracy of 99% was achieved by Ada boosting and K-NN.
For binary occupancy classification, Kraipeerapun and Amornsamankul [7] used stacking for multiclass classification. They used two outputs NN and stacking, to fuse relative humidity, temperature, light, humidity ratio, and CO 2 from the UCI dataset [29]. The multiclass classification stacking outputs were combined to obtain the binary classification. For binary classification, the accuracy of the proposed stacking method was better than classical stacking. Average accuracy of 90.27% was achieved for the five input features.
For the unsupervised occupancy detection problem, Candanedo et al. [9] applied a suggested HMM-based method on only one or two features from temperature, CO 2 , humidity ratio, light time, and humidity readings to infer occupancy schedules. The model was evaluated using a labeled dataset from UCI [29]. The suggested method was also applied to a case study for humidity ratio in building different rooms to infer occupancy schedules. There was no ground truth data, so the estimated occupancy schedules were validated with one building occupant. The best accuracy (90.24%) was achieved using the CO 2 data first order difference.
Pedersen et al. [43] suggested a rule-based method to determine the probability of occupancy. Two different sets of rules were suggested: one for PIR and noise sensors data and the other for relative humidity, air temperature, Volatile Organic Compound (VOC), and CO 2 concentration sensors data. Accuracy of 98% at most was reported for the first set. Masood et al. [16] presented two novel feature selection algorithms: Wrapper Rank-Extreme Learning Machine (WR-ELM) and Relative Information Gain-ELM (RIG-ELM). WR-ELM obtained its best accuracy using a combination of pressure, temperature, CO 2 , and humidity sensors features. On the other hand, RIG-ELM needed only CO 2 features to obtain its best accuracy. Accuracies higher than 96% were reported.
Based on occupancy status, Kim and Moon [44] suggested a new thermal comfort control algorithm. The suggested algorithm included two parts: one for occupancy status detection and the other for switching on the devices. The suggested algorithm contained a multinomial logistic regression model. On the other hand, an integrated comfort algorithm was used to operate HVAC systems upon the outdoor environmental conditions to guarantee occupant's comfort without wasting VOLUME 10, 2022 energy. The suggested algorithm obtained an accuracy of 94.9% using PIR, CO 2 concentrations, lighting electricity consumption data, and door sensors.
Koklu and Tutuncu [45] used three classification algorithms (Decision Tree, RF, and Bagging) to combine temperature, light, CO 2 , and humidity sensors data from UCI dataset [29]. The highest accuracy achieved was 99.368% using RF. Elkhoukhi et al. [46] proposed an online distributed machine learning framework to predict the occupancy state. They used a distributed version of the decision tree classifier, called Vertical Hoeffding Tree (VHT), to combine data from temperature, power consumption, CO 2 , light, and humidity sensors. An accuracy of 95% was achieved using Occupancy Detection dataset [29], while an accuracy of 80% was achieved using deployed sensors data streams.
Giri et al. [47] combined temperature, light, CO 2 , and humidity sensors data using different classification models: Classification Via Regression, RF, Multi-class Classification, Naive Bayes, Simple Logistic, and Decision Table. High accuracy of 99.0874% was achieved by Simple Logistic. Kampezidou et al. [48] proposed a Physics-Informed Pattern Recognition Machine (PI-PRM) method for occupancy detection using CO 2 and temperature sensors data. Using PI-PRM, which is a multi-layer perceptron NN, achieved an accuracy of 97%.
Wang et al. [49] presented a two-layer occupancy detection method. The first layer detects five human activities using temperature and PIR sensors data. The five activities were inside and outside door handle touch, tap and toilet usage, and motion near the door area. The second layer detect the occupancy state (1: entering, −1: leaving, and 0: no change) using RF, Decision Tree, K-NN, or SVM. Higher accuracy of 99% was achieved using RF.

C. DECISIONS-TO-DECISION (F2D) FUSION
At the D2D fusion level, occupancy states (decisions) obtained from multiple MLAs based on individual features are fused to decide the final occupancy state (the final decision). The main advantage of using the D2D fusion level is that the suitable MLA for each feature can be used. Besides, it is easy to fuse decisions that have the same representation. On the other hand, using this level has two disadvantages: failing to use the correlation among features and increasing the computation time due to multiple MLAs [30].
Chen et al. [15] presented a wrapper method depending on ELM for selecting the convenient features. They predicted an initial occupants' estimation using different models, which are SVM, K-NN, NN, LDA, ELM, and CART. Then, these estimations were fused using a particle filter algorithm. An accuracy of 93% was achieved by implementing the suggested fusion framework. Yang et al. [50] used the all-subsets regression model to select features from humidity, light, temperature, and CO 2 data. Then, they applied multiple ELM models to the selected features. After that, the resulting decisions were combined using a voting algorithm, Voting-based Weighted Extreme Learning Machine (WV-ELM). High detection accuracy of 97.32% was achieved by using light and CO 2 sensors data.
From the mentioned related works, which were summurized in Table 2, only Fayed et al. [33] dealt with the data uncertainty using the Neutrosophic approach, which can handle the problem of data uncertainty [26]. The other studies focused on handling the decision uncertainty using either the probability theory [31], [39] or the fuzzy set theory [32], [37]. Fayed et al. [33] fused Neutrosophic features using a dynamic equation. Despite achieving a good accuracy enhancement, producing the equation consumes O(n) time. Besides, the fusion equation requires alteration according to changes in the number or the type of sensors. Consequently, it limits the system's scalability. For this reason, the following section suggests a neutrosophic weighted fusion technique to achieve high accuracy while maintaining low time consumption. This technique is a F2F fusion technique, used to benefit from features correlation to handle data uncertainty in a time efficient manner as mentioned in F2F fusion section and summarized in Table 1.

III. THE EFFICIENT OCCUPANCY DETECTION SYSTEM
In this section, the stages of an efficient and comprehensive occupancy detection system using environmental sensors are discussed in detail. The proposed occupancy detection system is a binary occupancy detection system that uses environmental sensors as its source of information. To handle sensor data heterogeneity, a sensors data fusion technique is suggested. After that, the fused data is used by a classifier to make the final decision. Accordingly, a framework for an efficient occupancy detection system based on the Neutrosophic Weighted Fusion (NWF) method is proposed to handle the data uncertainty. As shown in Fig. 1, the proposed system framework consists of four stages: preprocessing, feature extraction, neutrosophic weighted fusion, and occupancy state detection stages. The main contribution of this paper is in the feature extraction and neutrosophic weighted fusion stages. In the following subsections, the four stages are described in details.

A. PREPROCESSING STAGE
Sensors data is noisy and redundant. It may also have different formats such as numeric data from simple sensors, binary or categorical data from switch-based sensors, video, images, and audio from complex sensors like cameras and microphones. Using and transmitting raw sensor data is costly and not effective. Thus, sensor data should be processed before using and transmitting it. The preprocessing stage's objective is to remove the noise and redundant data, decrease transmission cost, decrease storage requirements, and enhance usability [51]. According to its node capabilities, the preprocessing stage can be done locally on each sensor node or remotely on the sink/edge node. This stage consists of four steps, which are noise smoothing, missing values handling, sampling, and outlier removal [52].  • Missing Values Handling: Sensor data is subject to missing values because of electrical circuitry uncertainties. Data with missing values is harder to process. So, it could be handled by replacement or discarding before using it.
• Sampling: Sensor data is usually sensed at a high rate, but the actual life situations of interest do not change at that rate. Thus, sensor data at a lower rate can be more appropriate.
• Outlier Removal: Sensor data should be tested for the existence of outliers. After that, the detected outliers are replaced using mechanisms like missing value replacement. After these steps, the preprocessed sensor's data is clean and ready to be used for the feature extraction stage.

B. FEATURE EXTRACTION STAGE
Feature extraction is about generating new features that are more informative and non-redundant for subsequent fusion steps [53]. A classifier cannot give reasonable results without features having discriminant power. Examples of simple features, which are suitable for real-time extraction, are mean, median, mode, standard deviation, etc. In the feature extraction stage, this paper suggests using sensors data in its Neutrosohpic Domain representation. Neutrosophy is defined as a philosophy branch that combines logic, probability/statistics, and set theory with philosophical knowledge to handle the uncertainty problem. Data in neutrosophic logic is represented by Truth (T), Indeterminacy (I), and False (F) as a 3D space (T, I, F). Each dimension is in the range of [0, 1] [54]. The T dimension is suggested to be used after that as an input feature to the proposed neutrosophic weighted fusion stage in order to handle the uncertainty problem.
The neutrosophic features are generated using two proposed methods, sensor-based and multi-sensor-based, deduced from the method applied in [55]. Assume a sensors dataset X = {s 1 , s 2 . . . , s n }. In the first method, sensorbased, transforming sensor readings set S j to the neutrosophic domain is based only on its reading data. Equation (1) is the representation of S j in the neutrosophic domain, where 1 ≤ j ≤ n.
where ND sj is the neutrosophic representation for S j data, and i is the i th observation index in X. T sj (i), I sj (i), and F sj (i) represent Truth (T), Indeterminacy (I), and False (F) dimensions, respectively. ND is a dataset that contains the neutrosophic representation for n sensors data vectors. The Truth (T) membership values are derived using (2).
where T sj (i) is the Truth dimension for S j data, and i is the i th observation index in X and the local mean,S j (i), is computed using (3).
where W is the window size and it could be assigned an even value in the range [2:2(n-1)]. S j (m) denotes the m th measurement in the S j vector. Max (S j ) and Min (S j ) denote the maximum and the minimum values in the local mean vector,S j (i), respectively. The False (F) membership values are derived using (4).
Equation (5) is used to derive Indeterminacy (I) membership values.
where δ j (i) is the absolute value of the difference between an observation value and its local mean value and it is calculated as shown in (6). Max (δ) and Min (δ) denote the maximum and the minimum values in δ j vector, respectively.
Algorithm 1 summarizes the proposed sensor-based Features Extraction process.
In the second method, multi-sensor-based, a 2D matrix whose columns are sensors readings vectors, is used for transforming all n sensors data vectors to the neutrosophic domain at the same time. Using this method, each sensor data can be affected by the other sensors during the transformation process. As in the real-world, one observation may affect another observation. For example, a place temperature may be affected by the lighting. According to each sensor readings range, the constraint of using the multi-sensor-based method is to arrange sensor vectors, either in descending or in ascending order. This arrangement helps in preventing high sensor readings from canceling the low readings sensors effect.
In (7), ND (i,j) is a neutrosophic dataset that contains the neutrosophic representation for n sensors data vectors.
where i is the i th observation index in X, and the index j refers to S j vector. T(i,j), I(i,j), and F(i,j) represent Truth (T), Indeterminacy (I), and False (F) dimensions, respectively. The Truth (T) membership values are derived using (8).
where i is the i th observation index and j refers to the S j vector. The local mean,X (i, j), is computed, as shown in (9).
where W × W is the window size and X(m,n) is the observation at (m,n) location in X. Max (X ) and Min (X ) denote the maximum and the minimum values in the local mean matrix X , respectively. The False (F) membership values are derived using (10).
Equation (11) is used to derive Indeterminacy (I) membership values.
where δ(i,j) is the absolute value of the difference between an observation value and its local mean value and it is calculated VOLUME 10, 2022 as shown in (12). Max (δ ) and Min (δ ) denote the maximum and the minimum values in δ vector, respectively.

Algorithm 2 summarizes the proposed Multi-Sensor-Based
Features Extraction process.

C. NEUTROSOPHIC WEIGHTED FUSION STAGE
Data fusion combines data from various sources to achieve more efficient and accurate inferences than what was achieved by using a single source [34]. There are two types of information to be fused: features or decisions. One of the simplest and most used fusion methods is Linear Weighted Fusion (LWF). In LWF, the sensor information is combined linearly using sum or product operators. To fuse sensor information, a normalized weight is assigned to each sensor's information.
Common normalized weights computation methods are decimal scaling, min-max, tanh-estimators, and z score. Although min-max, decimal scaling, and z score methods are easy to compute, they are affected by outliers. In contrast, the tanh method is effective, but its parameters are estimated using training [30]. Not to mention that all of these methods do not consider the uncertainty of data. Therefore, the suggested Neutrosophic Weighted Fusion (NWF) method is used, in the fusion stage, to generate a single fused feature from multiple sensors data. Then, the fused feature is used as input for the occupancy state detection stage. Using only one feature as input for the learning phase saves some computation time. The fused feature also depends on multi-sensor features, which can improve the detection accuracy without leading to the overfitting problem. Besides, the NWF method uses neutrosophic weights as a percentage of certainty for sensors data to handle sensors data uncertainty, which in turn increases the detection accuracy. So, using NWF makes the occupancy detection system more efficient.
The proposed NWF method uses Neutrosophy to determine and adjust weights working as a percentage of the sensor's data certainty. NWF uses the T dimension from the previous stage as a weight for the original sensor data to handle the uncertainty problem. For occupancy detection, using neutrosophic weight for fusion was not used formerly. The Truth-based Weight (TW) of a sensor data is computed using two methods, sensor-based and multi-sensor-based, mentioned in the previous stage. In the first method, sensorbased weight is calculated using (13).
where TW sj (i) is the neutrosophic weights vector for the S j data, and i is the i th observation index in X. The weights matrix that contains the weights vectors for the n sensors is denoted TW. In the second method, a multisensor-based weight is a 2D weights matrix with the weights vectors corresponding to the sensors' vectors. By using this method, each sensor data can be affected by the other sensors during the process of weight computing. Equation (14) is used Algorithm 2 Multi-Sensor-Based Features Extraction Input: X; a sensors dataset where X = {s 1 , s 2 . . . , s n } Output: ND; dataset contains neutrosophic representation for X.
where TW is the weights matrix. i is the i th observation index, and j refers to the S j vector. After computing the sensor's data weights, they are used in the fusion equation (15) to increase the training and testing data's certainty.
where F is the fused feature, i refers to its i th observation in the dataset and X(i,j) is the measurement at (i, j) location. Sensors vectors are considered alternatives because each sensor vector can be used separately for occupancy detection. That is why the sum operator is used for fusing the data. Algorithm 3 shows the proposed Neutrosophic Weighted Fusion process.

Algorithm 3 Neutrosophic Weighted Fusion
Input: X; a sensors dataset where X = {s 1 , s 2 . . . , s n }, ND; dataset contains neutrosophic representation for X. Output: F; the fused feature 1.Compute the neutrosophic weights vector TW for i = 1 to length (S j ) do for j = 1 to n do TW (i, j) = ND T (i,j) end for end for 2.Compute the fused feature F for i = 1 to length (S j ) do F(i) = 0 for j = 1 to n do F(i) = F(i)+ (TW (i, j) × X (i, j)) end for end for

D. OCCUPANCY STATE DETECTION STAGE
In this stage, a classification algorithm such as K-NN, LDA, NB, RF, or SVM is used to detect the occupancy state. The input to this stage is the fused feature resulted from the fusion stage. After detecting the occupancy state, the sink/edge node controls sensors or actuators based on the occupancy state or sends the occupancy state to the cloud for further processing and decision-making. The cloud performance and security issues should be taken into consideration [56], [57].

IV. EXPERIMENTAL RESULTS
This section is divided into five subsections. The first subsection describes a public occupancy detection dataset used to evaluate the proposed fusion technique. The second subsection states the hardware and software specifications used for the experiments. The third subsection specifies the performance metrics, and the fourth one presents the experimental results. Finally, the fifth subsection discusses the experimental results.  [29].

A. DATASET DESCRIPTION
The proposed NWF technique is applied to a public dataset, which is occupancy detection [29]. The following subsection give more details about this dataset. The reasons for choosing this dataset are as follows: • It is a public dataset from a well-known data repository (UCI Machine Learning Repository) [58].
• The dataset contains three sets one for training and two for testing the classification models. The testing data with different environmental conditions (one when the door is closed as training data and the other when the door is open) which is convenient for showing the effect of our approach on dealing with data uncertainty.
• The number of the used sensor types (4 types) is acceptable for fusion.
• The data and its processing codes are available in [59], so the results comparison could be direct.
• The processing and evaluation was done using the open-source program R.

1) OCCUPANCY DETECTION DATASET
This dataset is experimental data from the UCI Machine Learning Repository [58]. The sensor readings were recorded every 14 seconds from sensors deployed in an office room with at most two occupants, then the mean of readings was calculated for each minute. The dataset is used for binary occupancy detection using environmental temperature, humidity, light, and CO 2 sensors. Every minute, a picture was taken to obtain the labels (occupancy state). The dataset contains three subsets; Training (for training), Test-ing1, and Testing2 (for testing). Table 3 summarizes the three datasets' details.
Most of the measurements in Training and Testing1 were taken with the door closed, while those of Testing2 were taken with the door opened. Each dataset contains readings of sensors: temperature (T) in Celsius, humidity (H) in percentage %, light (L) in Lux, and CO 2 in ppm labeled with the occupancy state (0: Empty, 1: occupied). Also, it contains a timestamp and derived humidity ratio (HR) in kg vapour−water /kg air , which is calculated using (16).
where p = 101.325 kPa (standard atmospheric pressure) and p w is calculated using (17).
where T(i) is the temperature in the Celsius unit.

B. HARDWARE AND SOFTWARE SPECIFICATIONS
A laptop with the following specifications was used to carry out the experiments: • Processor: x64-based processor, Intel(R) Core (TM) i7-2640M, CPU at 2.80 GHz.
• RAM: 6 GB. The open-source program R was used for implementing the Feature Extraction and Neutrosophic Weighted Fusion Stages. It is also used to evaluate and compare the occupancy detection based on the suggested technique with other stateof-the-art techniques.

C. PERFORMANCE METRICS
To evaluate the proposed fusion technique (NWF) performance, the following seven metrics were used: • Accuracy (ACC): ACC is used to evaluate the classification model capability. In other words, it is the percentage of correct results (TP or TN). Generally, ACC is calculate using (20) [60].
where TP represents true positives, TN represents true negatives, FP represents false positives, and FN represents false negatives.
• Balanced ACC: is the accuracy in case of imbalanced data. It is calculated using (21) [61].
where SPE is Specificity and SNE is Sensitivity. Both ACC and Balanced ACC were used as performance metrics in this paper. ACC was used to compare the proposed technique results with the results in [33] and with other state-of-the-art techniques, while Balanced ACC was used because the data is imbalanced. • Specificity (SPE): is the percentage of true negatives representing the classifier's ability to classify negative class patterns. It is calculated using (22) [62].
where Neg is the number of negative class patterns.
• Sensitivity (SEN) or (Recall): is the rate of true positives representing the classifier's ability to classify positive class patterns. The method can be precise without being sensitive, or it can be susceptible without being specific. SEN can be calculated using (23) [63].
where Pos is the number of positive class patterns.

• Precision or Positive Predictive Value (PPV):
is the percentage of true positive cases related to all the predicted positive patterns. It can be calculated using (24) [62].
• Area Under the Curve (AUC): it measures the ability to distinguish between classes. Also, it summarizes the Receiver Characteristic Operator (ROC) curve. ROC curve is a plot for TP rate against FP rate. A higher AUC is desirable because it means a better classifier performance at distinguishing between classes. AUC is calculated using (26) [64].

D. RESULTS
The time consumption and the previously mentioned performance metrics for the proposed technique are analyzed in this section. They are also compared with other sensor data cases using K-NN, LDA, NB, RF, and SVM as classification algorithms. The six cases for comparison are a case    for F2D fusion and five F2F fusion cases. The data used for each case are as follows: • No Fusion (NF) [29]: original sensors data vectors without fusion (F2D fusion).
• Unweighted Fusion (UWF): a fused data vector generated through fusing sensors data weighted by 1 using the sum operator which is a well-known fusion method (F2F fusion).
• Sensor-based Weighted Fusion (SWF): a fused sensor-based weighted data vector generated using the NWF method (F2F fusion).
• NS [33]: a fused data vector generated using the dynamic fusion equations mentioned in [33]. The features fused are the truth of each sensor data (F2F fusion).
The features fused are the truth of each sensor data affected by other sensors' data (F2F fusion). To evaluate the proposed technique, various classification models are used. LDA and RF were used in [29], [33]. So, they were used for comparing the proposed technique results with the results in [29], [33]. Also, K-NN, NB, and SVM are used to compare with other state-of-the-art techniques. Besides, the five algorithms are from different MLAs categories and using them provides a chance to study the effect of the proposed fusion methods on the results of different MLAs categories. RF is an ensemble algorithm while LDA is a dimensionality reduction algorithm. K-NN and SVM are instance-based algorithms while NB is a Bayesian algorithm. Table 4 shows the four sensor variables possible combinations. HR vectors were not included in the experiments since H and HR can be used alternatively. The case number is represented in the first column, while the second one is the features fused in each case. The time parameters, Week Status (WS), and Number of Seconds from Midnight (NSM) were used in the experiments since it helps enhance the accuracy of the classification algorithms [29]. The selected window size for producing the weight matrix is four because it provided better accuracy and consumed reasonable time than using 2 or 6 as the window size. Also, a unified seed was set to a random number (1234) before any of the experiments was initiated to ensure that the same results are reproduced when other researchers repeat these experiments. Using multi-sensor-based weight, the original dataset vectors were arranged in an ascending order based on sensor readings range before producing the weight matrix to prevent high sensors readings from canceling the effect of other low sensors readings.
For five cases of the dataset, Figs. 2-6 show the correlation plots. The first case is for the original dataset [29], VOLUME 10, 2022 Fig. 2. The second one is for the Sensor-based Weighted (SW) dataset, Fig. 3. The third one is for the Multi-Sensor-based Weighted (MSW) dataset, Fig. 4. The fourth case is for the NS dataset [33], Fig. 5. Finally, the fifth one is for the NS_all dataset [33], Fig. 6. Two points were observed from these correlation plots: 1) original, SW, and NS correlation plots are different for the training and testing data.
2) MSW and NS_all correlation plots are similar for the training and testing data. Although there are changes in the training and testing data values, only MSW and NS_all correlation plots show a similar correlation. That is because, for MSW, a sensor weight matrix values do not depend only on its measurements but also on the other sensors'. For NS_all, its values are the truth values, which were also calculated using other sensors' measurements. These points help in interpreting NWF results. Also, the dependency of occupancy state on the fused feature was tested using Pearson's product-moment correlation. The result of the test was p-value < 2.2e-16 with confidence level of 95%, so the occupancy state does depend on the fused feature. Since the testing data are for different conditions, the results are divided into three subsections.
The first was for the occupancy detection results when most of the measurements were taken with the door closed, Test-ing1. The second was for testing results of the occupancy detection when most of the measurements were taken with the door opened, Testing2. The third is for comparing the time consumption for different data cases and different classification techniques. VOLUME 10, 2022

1) TESTING RESULTS FOR THE CLOSED DOOR
Figs. 7-11 present the performance metrics of applying K-NN, LDA, NB, RF, and SVM classification models on the six data cases. These data are generated using the Testing1 dataset, which is similar to the Training dataset, as the readings of both datasets were taken mostly when the door closed. In Fig. 7, using NWF with multi-sensorbased weights (MSWF) and NWF with single-sensor-based weights (SWF) significantly enhanced the performance metrics compared to using the other four data cases in case of applying the K-NN model. SWF  According to the results of applying the SVM model in Fig. 11

2) TESTING RESULTS FOR THE OPENED DOOR
The performance metrics of applying K-NN, LDA, NB, RF, and SVM classification models on data generated from the Testing2 dataset are presented in Figs. 12-16. Testing2 measurements were taken mostly when the door closed. These measurements are quite different from the training dataset, which were taken mostly when the door closed. In Fig. 12

3) TIME CONSUMPTION COMPARISON
Time consumption is an essential metric for evaluating and comparing the proposed technique performance. As shown in Fig. 17, the proposed technique methods (SWF and MSWF) provided an acceptable time consumption.
For all models except LDA, using MSWF consumed the least time in the worst case. For LDA, it consumed less than one additional second compared to NF, UWF, and NS, but it is less than NS_all by about 163.8 seconds. Using SWF with the K-NN model, it consumed less time than NF, NS, and NS_all, but it consumed less than one additional second than UWF and MSWF. For LDA, it consumed less time than MSWF, NS, and NS_all, but it consumed less than one additional second compared to NF and UWF. For NB, it consumed less time than NF, UWF, and NS_all, but it consumed less than one and two additional seconds compared to MSWF and NS, respectively. According to the RF results, it consumed less time than NF and NS_all, but it consumed less than 2, 3, and 7 additional seconds compared to NS, UWF, and MSWF, VOLUME 10, 2022  respectively. Also related to SVM results, it consumed less time than UWF, NS, and NS_all, but it consumed around 4 and 10 additional seconds more than NF and MSWF, respectively.

E. DISCUSSION
In this section, the results presented in the previous section and summarized in Table 5 are discussed. Using MSWF greatly enhanced the accuracy range compared to using NF, UWF, SWF, or NS. Although using NS_all achieved better accuracy than MSWF for the worst cases (the cases from the eleven cases that achieved lowest accuracy), using MSWF was more efficient than using NS_all regarding time consumption. Using NS_all achieved better accuracy than MSWF for the worst cases because in Testing 2 most of the measurements were taken with the door opened while most of the Training measurements were taken with the door closed. Hence, using a dynamic fusion equation (NS and NS_all) is preferable when the place environment is dynamic, but using a static fusion equation (SWF and MWF) is preferable when the place environment is not very dynamic.
The good results of MSWF are logical since only MSW has similar correlation plots for the training and testing sets, which means a stable correlation among the four variables. Hence, using MSWF improved the ranges of the eleven cases accuracy, notably the lower bound. Although the five algorithms (K-NN, LDA, NB, RF, and SVM) are from different MLAs categories, MSWF had the same positive effect on the accuracy results of them with different detection accuracy ranges. So, the proposed technique is not biased to a specific MLAs category. On applying K-NN, using MSWF raised the minimum bound of balanced accuracy from 76.73 to 85.13, while applying LDA raised it from 64.64 to 71.88. Applying NB raised the minimum bound from 75.23 to 86.15 while applying RF raised it from 64.63 to 73.47. As for applying SVM, it was raised from 63.54 to 71.32.
MWF provided an acceptable accuracy percentage using a static fusion equation, which requires zero time for production. On the other hand, NS_all provided higher accuracy; however, the dynamic equation's production has O(n) time complexity. Besides, the fusion equation of NWF, using either SWF or MSWF, does not require to be altered according to changes made in the number or the type of the sensors. Consequently, it does not limit the system's scalability. Contrariwise, the dynamic equation (NS and NS_all), which is based on the sensors' correlation, requires reproduction.
Using SWF and NS, they provided lower improvement in detection accuracy for K-NN, NB, and RF. However, for LDA, they showed degraded accuracy for cases 5, 7, and 11. As mentioned in Table 2, these cases include using CO2 without Light, and the correlation between CO2 and Light differed significantly between Training and Testing2 datasets (Figures 3 and 5). The worst case is 11, where CO2 was used with humidity as the correlation between CO2 and Humidity differed extremely between Training and Testing2 datasets. This problem did not appear for MSWF and NS_all because they have similar correlation plots of the training and testing sets. Moreover, LDA is a parametric machine learning algorithm. The data characteristics' changes affected the LDA estimated parameters (mean and covariance) calculated in the training phase. Hence, these issues affected the accuracy of detection.
Using UWF did not enhance detection accuracy, and the worst case is case 8 (Temperature and Humidity) for the same reasons. In this case, the SPE is NA (Not Available) and is replaced by zero for plotting, Figure 8-c. SPE is NA when a classifier cannot recognize negative class patterns and, in turn, Balanced ACC, which is the average of SPE and SEN, is NA [65]. The Balanced accuracy of 62.86 is the lowest accuracy, excluding case 8. In the case of SVM, UWF, SWF, and NS have the same problem in case 8. SVM could not recognize the negative class patterns.
According to the previous discussion and Table 6, which compares performance metrics between NF and MSWF, it could be concluded that using MSWF is a good compromise between high accuracy and low time consumption. Hence, using MSWF can provide an efficient occupancy detection system.

V. CONCLUSION
Environmental sensor-based occupancy detection systems are beneficial in many essential applications because sensor data processing requires fewer processing capabilities and a smaller storage size. Besides, it maintains the privacy of individuals. However, uncertainty and unreliability are the main problems of using environmental sensor data because sensor data tends to be incomplete and noisy. NWF, the proposed technique, is a linear weighted fusion technique based on neutrosophy. By using neutrosophy, the proposed method handled the sensor's data uncertainty. As a result, occupancy detection accuracy is enhanced. Also, using multiple types of sensors increased the reliability by using a variety of sensor types. Moreover, it minimizes the detection time by using only one feature for training and testing, which saves some energy. Additionally, using a predefined fusion equation instead of a dynamic one consumes no time to produce the equation. The equation is also not limited to a specific number or type of features, which does not limit the system scalability. Accordingly, the experimental results proved enhancement in accuracy ranges and time consumption using NWF. Thus, using NWF makes the occupancy detection system more efficient. For future works, more investigation is required for the proposed technique effect on multiclass classification problems such as occupancy estimation. In occupancy estimation, classes represent the number of occupants or occupancy level. Also, the applicability of using the proposed technique to fuse more heterogeneous resources such as images, audios, and videos is suggested for occupancy detection and other different applications.