Research Article  Open Access
Tran Anh Khoa, Cao Hoang Phuc, Pham Duc Lam, Le Mai Bao Nhu, Nguyen Minh Trong, Nguyen Thi Hoang Phuong, Nguyen Van Dung, Nguyen TanY, Hoang Nam Nguyen, Dang Ngoc Minh Duc, "Waste Management System Using IoTBased Machine Learning in University", Wireless Communications and Mobile Computing, vol. 2020, Article ID 6138637, 13 pages, 2020. https://doi.org/10.1155/2020/6138637
Waste Management System Using IoTBased Machine Learning in University
Abstract
Along with the development of the Internet of Things (IoT), waste management has appeared as a serious issue. Waste management is a daily task in urban areas, which requires a large amount of labour resources and affects natural, budgetary, efficiency, and social aspects. Many approaches have been proposed to optimize waste management, such as using the nearest neighbour search, colony optimization, genetic algorithm, and particle swarm optimization methods. However, the results are still too vague and cannot be applied in real systems, such as in universities or cities. Recently, there has been a trend of combining optimal waste management strategies with lowcost IoT architectures. In this paper, we propose a novel method that vigorously and efficiently achieves waste management by predicting the probability of the waste level in trash bins. By using machine learning and graph theory, the system can optimize the collection of waste with the shortest path. This article presents an investigation case implemented at the real campus of Ton Duc Thang University (Vietnam) to evaluate the performance and practicability of the system’s implementation. We examine data transfer on the LoRa module and demonstrate the advantages of the proposed system, which is implemented through a simple circuit designed with low cost, ease of use, and replace ability. Our system saves time by finding the best route in the management of waste collection.
1. Introduction
The Internet of Things (IoT) is a new and promising technology, which has the potential to globally change human life in a positive way, thanks to its diverse connectivity. IoT provides exchange and linkage between lowenergy devices and interactions through the Internet. Many applications around the world have been implementing different operations, based on the background of IoT, to offer novel services for smart cities [1–3] and optimize energetic efficiency. For examples, energy efficiency was considered in [4, 5], cars were connected by IoT methods in [6–8], and water management in smart agriculture was investigated in [9–13], among a long list of other IoT application areas.
One important application is that IoT technology has become a practical and efficient tool to build smart cities. According to [14], a critical issue for a smart city is the increase of waste generation with accelerated population growth in cities. Two significant challenges for waste management are waste collection and path collection. First, waste collection is a daily task in urban areas entailing the planning of waste truck routes, in which environmental, economic, and social factors must be considered. Second, the path length should be shortened, in order to avoid high fuel costs and reduce the work amount, by applying graph theory [14–17]. Some solutions have introduced the use of IoT devices to estimate the fill level of inboxes and send this data over the Internet to a server for decisionmaking [18–23].
Machine learning (ML) provides effective solutions, such as regression, classification, clustering, and correlation rules perception [24, 25], for IoTbased waste management. There are three main reasons for this: firstly, in IoT applications, all of the devices are connected, and an immense amount of data is collected every day. Furthermore, they may be programmed to trigger some events, based either on some predefined conditions or exciting feedback from the collected data. Secondly, computer systems can learn to perform certain tasks, such as classification, clustering, predictions, and pattern recognition. Furthermore, these systems are trained using numerous algorithms and statistical models to analyze sample data. Thirdly, measurable characteristics (called features) usually characterize the sample data; some ML algorithms attempt to find correlations between the features and some output values (called labels). The information obtained through training is then used to identify patterns or make decisions based on new data.
However, human intervention is typically required to analyze the collected data, extract meaningful information, and create smart applications. IoT devices must not only collect data and transfer it to other devices but also be selfsufficient. They must be able to make contextbased decisions and learn from their collected data [25]. Hence, waste management systems using IoTbased machine learning should consider more variables for task prediction. On the other hand, regression is a mathematical model which can represent or recognize the connection between two or more variables. The dependent or response variable is the system’s output. By applying a regression model to a system, the relationships between the dependent variables and the independent ones can be detected. Logistic regression (LR) is a kind of regression analysis used to explain the connection between a dependent variable and one or more independent variables. LR is appropriate when the dependent variable takes binary values. As such, it is suitable for prediction tasks in ML and IoT application [24–29].
IoTbased waste management models perform a vital function in improving the standard of living and human wellbeing by increasing energyefficiency, enhancing governance, and reducing cost. In Vietnam, Ton Duc Thang University has set a goal to become an elite research university in the world’s top 500 universities. With the successful model and dream of a top Vietnamese university, the application of IoT technology to waste management is one aspect of this model.
This article presents a novel platform for smart trash control at the university, which is able to keep the university clean at low cost, requiring low labour resources. A novel microcontroller system is designed with a sensor module for measuring the filling height of garbage using ultrasound and geolocation of collected data based on LoRa technology. Furthermore, the paper presents a new method for predicting the probability of the filling level of each trash bin by applying LR in ML; furthermore, a graph theorybased optimization solution is proposed to compute the paths of waste collection with different time schedules in order to minimize the environmental and socioeconomic impacts, as well as supporting the workers of the university.
The contributions of our work are:(i)Previous articles have mostly evaluated results on a test board; our work introduces the design of a single microcontroller board, which is of low cost and straightforward, with an ultrasound sensor which can measure the filling height of a garbage can and send information using LoRa E32 technology.(ii)We present a novel IoTbased machine learning method, which is employed to predict the probability of collecting waste in the real environment based on the historical input data.(iii)Our article is the first to propose the use of the sigmoid function for predicting the probability of waste collection and to apply Dijkstra’s algorithm to optimize the path for waste collection from trash bins.(iv)The critical success of our article is in testing the performance of our system in the realistic environment of Ton Duc Thang University (Vietnam). Therefore, the advantages of employing smart trash bins for the trash collection task can be illustrated. Our algorithm has applied the results to implementing various filling height thresholds for determining the assembly of a garbage can, increasing profits, and optimizing the number of workers to be used.
The paper is organized as follows: Section 2 summarizes the related literature. Section 3 presents all components and hardware design. Section 4 explains the developed algorithm. Section 5 tests the prototype in a real environment to perform different operations. Finally, Section 6 concludes and estimates future works.
2. Related Works
Considering the advantages of IoT technologies, many researchers have investigated and developed new applications for smart cities, especially for waste management. To save power consumption and maximize operational time, a simple system that identifies the fullness of trash bins was presented, which collected data and delivered it through a wireless mesh network [5]. However, the idea has still some ambiguous problems in the system. To improve waste management, platform software for smart cities has been introduced in [14]; however, they only concentrated on the collection of data, and their platforms were comprised of technologies from other companies.
On the other hand, some approaches have developed waste management strategies based on the optimization to achieve an efficient system. In [15], the authors presented a waste control and management stage to be applied in rural areas using LoRaWAN technology and route optimization. Additionally, an implementation based on IoT was set up, but the system did not provide clarity about communication and optimization for all trash bins in the system. Based on logistic regression (LR) and genetic algorithm (GA) methods, the authors in [16] presented a new method to check the status of smart trash bins and select a collection path in Philadelphia, USA. Moreover, they did not provide any technologies for the transmission of data from the trash bin to the other devices in the system. In particular, optimization algorithms have been clearly defined for IoTbased waste management, such as the nearest neighbour search, colony optimization, genetic algorithm, and particle swarm optimization methods [17, 18]. In [19], the authors proposed a solution to manage a garbage system integrated with IoT technology, which was an autonomous linefollowing vehicle with a robotic hand for garbage collection, in which they did not apply any algorithms to optimize the waste collection. In [20], an IoT platform for an automated waste collection system provided by the project allowed realtime monitoring and interface with the system. However, the aim of this paper was to present an IoT cloud solution combining device connection, data processing, and control, rather than the design and optimization of waste collection. A food waste collection method was presented in [21], where the information was collected using radio frequency identification (RFID) technology and transmitted using a wireless mesh network. However, the disadvantages of this technology were severe in the long range, especially considering the aim of the smart city is management with a large area. Finally, the results of the optimization algorithm became too vague and could not be applied to a real system, such as a city.
For practical waste management, an impressive architecture was proposed for a sensor node in [22, 23], which used a microcontroller (ATMega328P), an ultrasonic sensor (SRF05), and a LORA E32 TTL—100 433 MHz module [30–32]. Nonetheless, they only tested the test board as a platform to provide sensor nodes and did not apply any methods for waste management in a smart city, such as optimized waste collection. While the target of this article was to propose an IoT application, with their design, the microcontroller board was very complicated; moreover, certain performances and functionalities are needed for each particular application. Our article applies machine learning and graph theory to optimize the waste collection processes, avoid overfilled bins, and reduce the work load.
In this paper, we consider algorithms, based on heuristic models or graph theory, from which we can find ways to minimize the distance of waste collection. The primary purpose is to reduce the total cost of transport, transfer, save labour, and reduce the dependency on used vehicles, while maximizing service quality, as well as improving general quality of life. The other algorithm optimizes waste collection, instead of considering low cost and energy savings, and supports the university’s waste management network to perform with high efficiency by applying ML and graph theory methods. We summarize the features of algorithms considered in this part and compare them with our proposal, as shown in Table 1.

3. System Architecture
The system under consideration consists of smart trash bins with a realtime monitoring system which integrates multichoices, such as ultrasound distance, along with a LoRa E32 TTL100 433 MHz transmission module. Low energy use was considered throughout the design process. Each node is consequently supposed to be powered by multiple sources; for instance, solar energy or batteries. For flexibility, we have designed hardware that can use either energy source, as trash bins are often put in places where direct sunlight is not available. Selection of the best electronic components for their interconnection and for energy efficiency strategies during the employment of the methods was considered. Furthermore, technical solutions will enable turning off nodes (or parts of them) when they do not work. Once principal components of the node had been chosen, the overall design was targeted at their integration. The proposed system architecture is shown in Figure 1, where the data collected are sent using LoRa to a server, where they are stored and processed. The data are used to track and predict the status of the trash over each period. Furthermore, they will be used to calculate the optimal path, accordingly. The predicted state of each trash bin can be examined, based on assigned training data. It is, then, reviewed to refresh the appropriate waste fill level, which is an essential input parameter of the optimal path algorithm.
Besides these main targets, lowcost containment and high efficiency were secondarily considered. One feature of smart cities is that the requirements of low power consumption imply that there is no connection to the electrical network. The most critical component affecting the energy spread of a sensor node is the transmitting module. So, the design of such architecture must focus on not only the structure of the sensor node, but also the meaning of the system structure. Finally, the description of efficient information transfer technology in large areas should be considered adequately. Contrarily, an IoT node can estimate the volume data of trash bins, and then, the proper sensor to perform this analysis must be determined. Therefore, the selection of a sensor which considers the weight of trash bins was not considered, as a high weight does not imply a high trash level, for the following reasons: first, metallic materials can be weighty, yet leave the trash bin mostly empty, while a large quantity of paper can load the trash bin but weigh little [23]. Second, the authors in [16] recommended that, in some cases, the weight to the trash bin should not be considered, but, instead, the volume data and weight need to be combined. After all of the abovementioned specifications, the best selection solution for the ultrasound sensor was decided to be the SRF05 [30].
LoRa is designed to work in the appropriate band for each country or region because of licensefree bands in each different country. The LoRa module depending on the physical layer used can be classified as in the 433, 868, or 915 MHz frequency bands [33]. In Asia, only the 433 MHz bands can be used [34]. We used LoRa E32 TTL100 433 MHz module which aims at providing communication in the range of up to 2 km, low latency, mobility support, multilayer battery life, AES 128bit shared key encryption support, and a data rate up to 167 kbit/s [35]. The LoRaWAN is defined as the MAC layer protocol and network system architecture based on the LoRa technology. The topology of LoRaWAN network architecture is star, where the end devices can only communicate with LoRaWAN gateways and not directly with each other [33]. The LoRaWAN gateways are used to respond to forwarding raw data packets from end nodes towards the network server. In our network architecture, we use the LoRaWAN MAC layer, class A, that provides the medium access control mechanism that enables the communication between multiple devices and the LoRaWAN gateway.
Based on previous solutions, in our proposal, firstly, the IoT node architecture, shown in Figure 2(a), is composed of three types of components: ATmega328P, LoRa E32 TTL100 433 MHz module, and SRF05. Energy specifications of main active components of the board are listed in Table 2, along with the price (which is below $20) for each IoT node. Secondly, the communication between the IoT gateway node using LoRa E32 TTL100 433 MHz and the ESP8266 module is shown in Figure 2(b). Regarding the LoRa module and ESP8266, data collected from the commercial IoT node will be assigned timestamps and sent to the cloud. The progression description in Figure 3 summarizes the main interactions by stepbystep construction. Moreover, the IoT nodes are connected directly to a gateway through the LoRa MAC protocol that forwards their data. Then, the IoT gateways consist of the transmission communication modules, which not only send the data to the server by applying FireBase API/Host for ESP8266 but also send to users/application. The IoT gateway node is responsible for establishing communications with all the nodes in 24 hours. Its hardware requirements are actually simple, since it only has to be able to host and send the data for the server and offer a communication interface with the node. Besides the hardware previously mentioned, the most important is the power system. For flexibility, the system can be chosen to power the nodes with Liion 18650 batteries or solar energy, as shown in Table 3, such that the input voltage is within an acceptable range for operating the LoRa E32 TTL100 433 MHz module.
(a)
(b)


Considering the capacity of four Liion 18650 batteries or a battery and solar panel kit, with settings as in Tables 2 and 3, we can estimate of the lifetime of the batteries aswhere is the lifetime, is the power throughout the node (W/h or W/day), and is the total power (W/h or W/day), which is calculated by equation , with being power and time duration (s) for the ON and SLEEP mode, respectively. The lifetime approximately corresponds to 39 days for the Liion 18650 batteries and 13 days for solar panel and battery kit. Moreover, as the average cost of one node is around $20, it is very relevant in the university setting.
After reviewing the components of the system, they were embedded in a board and tested in a real environment to perform different experiments (see the next section).
4. Optimal Path Planning Algorithm for Waste Collection
In this section, we discuss the waste collection data, along with their states, positions, and system design, and test real data to verify the output result. First, the obtained information is transmitted through the communication link to the server, where data are processed, saved, and forwarded to the cloud, as studied in the next section. Second, we apply Algorithm 1 to predict the status and route of each trash bin daily, which will be explained in Section 4.3. Note that we consider the location of the aggregate waste collection location of each building, instead of each small trash bin on each floor of the university campus; furthermore, the system will enable a node that does not work to be turned off.

4.1. Data Collection
To collect the dataset of waste, we observed several classes for all buildings within working hours (from 6:50 A.M. to 21:00 P.M. from Monday to Sunday) according to the Ton Duc Thang University academic calendar in the second semester of the year 20182019 for 4 months. The obtained dataset is shown in Table 4. For instance, on Monday, at building A (node A), there are 91 classes with study hours. Additionally, the weight of waste is increased in case of more students in classes. We conclude that the dataset of waste is depended by the number of students. Therefore, we put one large waste bin on the ground floor to handle 13 buildings (nodes) in the university campus area.

4.2. Logistic Regression Model
A description of logistic regression can start with an expression of the regular logistic function used for classification problems. It is a predictive analysis algorithm, based on the idea of probability. The logistic function is a sigmoid function, with and an output between (0,1) for any value. The function, called , is given by
In this subsection, Figure 4(a) describes the relationship between classes and the status of the trash bin. The green line indicates the direction of the trash bin’s level. Taking into consideration the classes, if the green line is near to the state 1, that level of the trash bin will update to 1. Figure 4(b) displays the key algorithm employed in this article, logistic regression.
(a)
(b)
The primary reason we decided to use this model is due to its excellent characteristics:(i)The yellow line is performing linear regression, which fails to represent the true state as it could have a value greater than 1 or less than 0, which is not possible, as per the hypothesis of logistic regression. This is a not sensible choice for our solution.(ii)The red line (naturally separate from the perceptron learning algorithm’s (PLA’s) activation function, in which the two classes are 0 and 1, instead of 1 and 1) is the hard threshold. The PLA does not work in this problem, as the data is not linearly separable.(iii)The blue and green lines fit our problem better and have some of the following essential properties:(a)The function is a continuous real value, with range (0,1).(b)Assuming that the point considered is equal to 0.5 as the threshold, the closer the point is to the left, the closer it is to 0; and the closer the point is to the right, the closer it is to 1. This is in accordance with the observation that the more the classes are, the more the students will be able to collect waste and vice versa.
4.3. Optimal Path Planning Algorithm for Waste Collection
The collection paths are the moving sequences, including all of the trash bins within the Tan Phong campus, Ton Duc Thang University. The optimization of specific sequences is a combinatorial optimization problem. Considering several paths, we use Dijkstra’s algorithm [36], which is active in implementing nearoptimal clarifications. As the employees need time to check all of the trash bin, it is very joyful if the percentage filling level of waste is predicted. Therefore, the next prediction, the system is going to suggest which one should be collected to check the overload appearance. In this article, the LR algorithm is used to predict the status of each trash bin, based on its actual data. The overall system is presented in Algorithm 1, and the settings are described in Table 5. For each hour t in a working day, an LR algorithm is applied to predict the status of each bin. If the probability status of each trash bin is higher than a given threshold , the filling height of the trash bin is checked by the ultrasonic sensor. If the filling level is higher than 50%, the status is updated as 1. Then, Dijkstra’s algorithm is applied to find the shortest distance for collecting waste from all full trash bins, turning back to the offices. Consequently, the system detects the optimal paths within the university, which helps the employees to get the collected waste more efficiently.

5. Operation Tests
Our proposal was tested at Ton Duc Thang University with three following considerations. First, we provide and test the algorithm to find the shortest distance in the simulation. Second, we show that these coefficients are entered into the logistic regression equation to predict the probability of collecting the waste in the trash bins. Finally, we design a mobile application to show the effectiveness of the sensor for analysis of the filling level with the data by a wireless communication link. The mobile application also shows the probability prediction and optimal path collection.
5.1. Testing of the Algorithm to Find the Shortest Distance
To generate the nodes as uniformlydistributed points, the three steps mentioned below are used, as generating points using a distance uniformly distributed between and , and using an angle with uniform distribution from to causes the points to be more dense closer to the origin.
Step 1. Generate a random position inside the circle with radius (where is the coverage of the LoRa channel and the coordinate of the center is ) with polar coordinates ().where denotes a uniformly distributed random variable from 0 to 1.
Step 2. The point with polar coordinates () is converted to Cartesian coordinates by
Step 3. Go to Step 1 to define the next node position.
After the distributed node positions were generated, the optimal routes are found using Dijkstra’s algorithm, based on the filling level and coordinates of trash bins. To understanding the operation of Dijkstra’s algorithm, we give an example under the assumption in Table 6 with 6 nodes and 11 edges. The considering numbers are distances between two sensor nodes. The relationship between sensor nodes is drawn in Figure 5. Consider that the source node is node 1 and the destination node is node 2, as shown in Figure 5. There are any ways from node 1 to node 2. However, under minimizing the distance path between node 1 and node 2, the shortest path from node 1 to node 2 is 1 ⟶ 6 ⟶ 2. To achieve the fast path, Dijkstra’s algorithm is used. The operation is shown in Table 7.


5.2. Predicted Probabilities of Each Node
The considered problem is to build a model to assess the ability of garbage collection, based on the number of classes used during the day in different buildings. The relationship between the number of classes per day at each building in the university campus is depicted in Table 4. From the table, it can be seen that the more the classes were used, the higher the number of students was and, consequently, the more likely it was that the accumulated waste would lead to increased waste collection, although there were some cases where the class was abundant and the waste was below the threshold. Nonetheless, there was no threshold on the number of classes which accurately distinguished waste collection, and so, the threshold was set as 0.5. Therefore, we can predict the probability of waste collection based on the number of classes.
Considering Table 4, the number of classes in each building had a corresponding status for the trash bins as collected (1) or not collected (0). The LR model was chosen as the predictive modelling algorithm to be applied, as the output variable was a binary classification; that is, the status of the trash bin: collected (1) or not collected (0). We aimed to define a mathematical equation which can be utilized to predict the probability of the case collected (1). Once the equation is estimated, it can be applied to predict the output variables when only the data are known. The sigmoid function is shown in equation (2).
Applying equations (2) and (A.11) in Appendix A, the solution of the logistic regression was . The output indicates that classes are significantly associated with the probability of collecting the waste:
Now, we apply equation (5) to Table 4. For example, for a building A, which had 91 classes on Monday, setting the value in equation (5) gives an estimated probability for waste collection of 0.91. Similarly, for building I, which had 62 classes, the estimated probability of waste collection was 0.72. Another example is building F, which had 117 classes on Tuesday, for which the estimated probability of waste collection was 0.97. In general, the higher the number of classes, the higher the chance of collecting waste. Equation (5) also indicates that the probability of waste collection increases as the number of classes increases. As sigmoid is a covariate function, Table 4 shows the probability of collecting waste for several values of numbers of classes. Based on these predicted probability values in Table 4, the threshold and false positive rate (FPR)/true positive rate (TPR) of the Receiver Operating Characteristic (ROC) curve are estimated in Table 8.

Figure 6(a) shows that the Area Under the Curve (AUC) was 0.99, using threshold = 0.5, FPR = 0.1, and TPR = 1; see Table 8. The closer the ROC curve was to 1 and the larger the AUC was, the more effective the model was. For each threshold value in 7, we thus get a pair (FPR, TPR), which represents points (FPR, TPR) on the graph for which the limit changes from 0 to 1. Note that the range of thresholds does not necessarily range from 0 to 1 in general problems, and it should be ensured that the TPR/FPR receives the largest or smallest value it can achieve. A model is effective when there is a low FPR, and a high TPR means that there exists a point on the ROC curve close to the point with coordinates (0, 1) on the graph (upper left corner).
(a)
(b)
The graph in Figure 6(b) shows the loss function; if the values of the loss function are small, then the evaluation provides useful results. In a functional classification problem, it is understandable that a few data points are misclassified. Our results in the figure are, thus, consistent with the loss function model. The loss function and its optimization are presented in Appendix A.1 and A.2, respectively.
5.3. Test in a Real Environment
This section explains the network structure that was designed and implemented in the actual campus at Ton Duc Thang University over an area of 30 hectares with buildings (see Figure 7). The number of classes of each building is described in Table 4. In each building, a centralized waste storage area was placed with a gateway and data collection. The authentic structure had three levels for each trash bin: HIGH, MIDDLE, and LOW. As the threshold was 0.5, if the trash bin’s level is HIGH (alternatively, MIDDLE), its filling level is 1; otherwise, it is 0. Based on the status, the employees require updating the optimal paths every day toward getting the highlevel bins. By applying Algorithm 1, based on the input parameters, the system can determine the probability of waste collection based on the logistic regression function and optimize the choice of moving between buildings within the campus. Figure 8 depicts the results of class data for Monday on a week of the second semester of the 20182019 academic year. We can also determine the path for waste collection with the optimal router. The color set for the percentages in the mobile application in Figure 8 is as follows: 0–20% for placegreen, 21–40% for lime, 41–60% for yellowgreen, 61–80% for ochre, and 81–100% for rust.
6. Conclusions and Future Works
In this work, an optimal algorithm combining graph theory and LR has been described, with the possibility of assessing the probability of a trash bin being fully based on the number of classes in the university. This algorithm presents many advantages, as compared with the old waste collection methods. In addition, this study also provides improvements over classical algorithms. The algorithm is integrated into the system with a lowcost design circuit and LoRa technology, enabling its application in practical usecases, in which changing the sensor components can be done quickly. This study also presented three experiments: first, a test was conducted by simulating the location of arbitrary trash bins and finding the shortest path between the trash bins. Second, the logistic regression equation was applied to estimate the probability of collecting the waste. Finally, a practicaluse case of the waste collection process at Ton Duc Thang University (Vietnam) was tested. The algorithm used the database of classes used in each university building and data received from smart buckets (e.g., occupancy rate) as input data. In summary, this system provides better operations for optimizing employee use, saving operating costs, and collecting data on time. The system can be built cheaply, simply, and effectively and will be extensively applied in all campuses of the Ton Duc Thang University, a Smart University, to unify the filling level of the trash bins by using an ultrasonic sensor. Again, machine learning will be used, in particular, using multiclassification methods.
Appendix
A. The Logistic Sigmoid Regression Model
A.1. Loss Function
With the model as an activation function , assume that the probability that the data has the first label and the last label is . Then,where represents the probability that the first label occurs, as we know the parameter model and the data input . The aim of this purpose is to find the parameter using the training data.
Denoting , equations (5) and (A.1) can be written more compactly as
This equation is equivalent to equations (5) and (A.1); since , the first component is 1. To make the model fit the data, we need to find such that the probability is to the maximum.
Consider all training data with the data matrix and with the corresponding label equivalent . Then, we need to solve the optimization
Assuming that the training data were generated independently, we can write the likelihoods of the parameters as
Note that is an equation in and . This equation is the loss function of the logistic regression. As the sign changes after taking a logarithm, we need to find the minimum value of .
A.2. Optimizing the Loss Function
The problem of optimizing the loss function in logistic regression can be solved using SGD. For each loop, will be updated to one random variable point. The loss function of logistic regression with one point and gradient is
Set . Then, we have
Assume that we need to find the function . Asequation (A.9) is equivalent to that shown on the next page, where is a constant. Choosing , we have . This is a function. Logistic regression with a function is named logistic regression or logistic .
Thus, substituting (A.8) and (A.9) into (A.7), we have
Based on Stochastic Gradient Descent (SGD), the root of the logistic regression iswhere is the learning rate.
This completes the proof.
Abbreviations
IoT:  Internet of Things 
WSN:  Wireless sensor network 
ML:  Machine learning 
AI:  Artificial intelligence 
GA:  Genetic algorithm 
LoRa:  Long range radio thirdgeneration technology 
LR:  Logistic regression 
LPWAN:  Low power wide area network 
PLA:  Perceptron learning algorithm 
SGD:  Stochastic gradient descent 
FPR:  False positive rate 
TPR:  True positive rate 
ROC:  Receiver operating characteristic 
AUC:  Area under the curve. 
Data Availability
(1) The nature of the data is collected by TDT university campus according to the number of classes and their corresponding days. (2) The survey data used to support the findings of this study are included within the supplementary information file(s). (3) There are no restrictions on data access. Requests for data, 6 months after publication of this article, will be considered by the corresponding author.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
References
 B. N. Silva, M. Khan, and K. Han, “Towards sustainable smart cities: a review of trends, architectures, components, and open challenges in smart cities,” Sustainable Cities and Society, vol. 38, pp. 697–713, 2018. View at: Publisher Site  Google Scholar
 M. AlvarezCampana, G. López, E. Vázquez, A. Villagrá, and J. Berrocal, “Smart CEI Moncloa: an IoTbased platform for people flow and environmental monitoring on a Smart University Campus,” Sensors, vol. 17, no. 12, p. 2586, 2017. View at: Publisher Site  Google Scholar
 A. Bagula, L. Castelli, and M. Zennaro, “On the design of smart parking networks in the smart cities: an optimal sensor placement model,” Sensors, vol. 15, no. 7, pp. 15443–15467, 2015. View at: Publisher Site  Google Scholar
 E. Vinagre, F. De Paz, T. Pinto, Z. Vale, M. Corchado, and O. Garcia, “Intelligent energy forecasting based on the correlation between solar radiation and consumption patterns,” in Proceedings of the 2016 IEEE Symposium Series on Computational Intelligence (SSCI), IEEE, Athens, Greece, December 2016. View at: Publisher Site  Google Scholar
 F. Folianto, Y. Low, and W. Yeow, “Smart waste management system,” in Proceedings of the IEEE 10th International Conference on Intelligent Sensors, Sensor Networks and Information Processing (ISSNIP), Singapore, April 2015. View at: Google Scholar
 T. Dinh, Y. Kim, and W. Yeow, “A comprehensive system for a novel locationcentric IoTcloud based onstreet car parking violation management system in smart cities,” Sensors, vol. 16, pp. 1–23, 2016. View at: Google Scholar
 R. Sukjaimuk, Q. N. Nguyen, and T. Sato, “A smart congestion control mechanism for the green IoT sensorenabled informationcentric networking,” Sensors, vol. 18, no. 9, p. 2889, 2018. View at: Publisher Site  Google Scholar
 S. Ahn and J. Choi, “Internet of vehicles and costeffective traffic signal control,” Sensors, vol. 19, no. 6, p. 1275, 2019. View at: Publisher Site  Google Scholar
 M. S. Munir, I. S. Bajwa, M. A. Naeem, and B. Ramzan, “Design and implementation of an IoT system for smart energy consumption and smart irrigation in tunnel farming,” Energies, vol. 11, no. 12, p. 3427, 2018. View at: Publisher Site  Google Scholar
 D. Banđur, B. Jakšić, M. Banđur, and S. Jović, “An analysis of energy efficiency in wireless sensor networks (WSNs) applied in smart agriculture,” Computers and Electronics in Agriculture, vol. 156, pp. 500–507, 2019. View at: Publisher Site  Google Scholar
 J. Muangprathub, N. Boonnam, S. Kajornkasirat, N. Lekbangpong, A. Wanichsombat, and P. Nillaor, “IoT and agriculture data analysis for smart farm,” Computers and Electronics in Agriculture, vol. 156, pp. 467–474, 2019. View at: Publisher Site  Google Scholar
 A. Goap, D. Sharma, A. Shukla, and C. Krishna, “An IoT based smart irrigation management system using machine learning and open source technologies,” Computers and Electronics in Agriculture, vol. 155, pp. 41–49, 2018. View at: Publisher Site  Google Scholar
 T. Anh Khoa, M. M. Man, T.Y. Nguyen, V. Nguyen, and N. Hoang Nam, “Smart agriculture using IoT multisensor: a novel watering management system,” Journal of Sensor and Actuator Networks, vol. 8, no. 3, p. 45, 2019. View at: Publisher Site  Google Scholar
 K. Pardini, J. Rodrigues, S. A. Kozlov, N. Kumar, and V. Furtado, “IoTbased solid waste management solutions: a survey,” Journal of Sensor and Actuator Networks, vol. 8, no. 1, p. 5, 2019. View at: Publisher Site  Google Scholar
 M.V. BuenoDelgado, J.L. RomeroGázquez, P. Jiménez, and P. PavónMariño, “Optimal path planning for selective waste collection in smart cities,” Sensors, vol. 19, no. 9, p. 1973, 2019. View at: Publisher Site  Google Scholar
 L. Álvaro, J. Caridad, J. De Paz, G. V. González, and J. Bajo, “Smart waste collection system with low consumption LoRaWAN nodes and route optimization,” Sensors, vol. 18, no. 5, pp. 1804–1282, 2018. View at: Publisher Site  Google Scholar
 D. Vu and G. Kaddoum, “A waste city management system for smart cities applications,” in Proceedings of the 2017 IEEE Advances in Wireless and Optical Communications (RTUWO), IEEE, Riga, Latvia, November 2017. View at: Publisher Site  Google Scholar
 M. Akhtar, M. A. Hannan, R. A. Begum, H. Basri, and E. Scavino, “Backtracking search algorithm in CVRP models for efficient solid waste collection and route optimization,” Waste Management, vol. 61, pp. 117–128, 2017. View at: Publisher Site  Google Scholar
 M. Hannan, M. Akhtar, R. A. Begum, H. Basri, A. Hussain, and E. Scavino, “Capacitated vehiclerouting problemmodel for scheduled solid waste collection and route optimization using PSO algorithm,” Waste Management, vol. 71, pp. 31–41, 2018. View at: Publisher Site  Google Scholar
 A. A. J. Jim, R. Kadir, M. A. A. Mamun, A.A. Nahid, and M. Y. Ali, “A noble proposal for Internet of garbage bins (IoGB),” Smart Cities, vol. 2, no. 2, pp. 214–229, 2019. View at: Publisher Site  Google Scholar
 C. Popa, G. Carutasu, C. Cotet, N. Carutasu, and T. Dobrescu, “Smart city platform development for an automated waste collection system,” Sustainability, vol. 9, no. 11, p. 2064, 2017. View at: Publisher Site  Google Scholar
 I. Hong, S. Park, B. Lee, J. Lee, D. Jeong, and S. Park, “IoTbased smart garbage system for efficient food waste management,” The Scientific World Journal, vol. 2014, Article ID 646953, 13 pages, 2014. View at: Publisher Site  Google Scholar
 A. Lundin, A. Ozkil, and J. SchuldtJensen, “Smart cities: a case study in waste monitoring and management,” in Proceedings of the 50th Hawaii International Conference on System Sciences, Waikoloa, HI, USA, January 2017. View at: Google Scholar
 M. Cerchecci, F. Luti, A. Mecocci, S. Parrino, G. Peruzzi, and A. Pozzebon, “A low power IoT sensor node architecture for waste management within smart cities context,” Sensors, vol. 18, no. 4, p. 1282, 2018. View at: Publisher Site  Google Scholar
 V. H. Tiep, “Machine learning cơ bản (The Fundamental of Machine Learning),” 2019, https://machinelearningcoban.com/. View at: Google Scholar
 F. Zantalis, F. Koulouras, S. Karabetsos, and D. Kandris, “A review of machine learning and IoT in smart transportation,” Future Internet, vol. 11, no. 4, p. 94, 2019. View at: Publisher Site  Google Scholar
 I. A. Najm, A. K. Hamoud, J. Lloret, and I. Bosch, “Machine learning prediction approach to enhance congestion control in 5G IoT environment,” Electronics, vol. 8, no. 6, p. 607, 2019. View at: Publisher Site  Google Scholar
 A. L. Diedrichs, F. Bromberg, D. Dujovne, K. BrunLaguna, and T. Watteyne, “Prediction of frost events using machine learning and IoT sensing devices,” IEEE Internet of Things Journal, vol. 5, no. 6, pp. 4589–4597, 2018. View at: Publisher Site  Google Scholar
 M. Hasan, M. Islam Milon, M. I. I. Zarif, and M. M. A. Hashem, “Attack and anomaly detection in IoT sensors in IoT sites using machine learning approaches,” Internet of Things, vol. 7, Article ID 100059, 2019. View at: Publisher Site  Google Scholar
 “Microchip. ATmega328 complete datasheet,” 2018, https://www.microchip.com/wwwproducts/en/ATmega328. View at: Google Scholar
 “SRF05—ultrasonic ranger technical specification,” 2019, https://www.robotelectronics.co.uk/htm/srf05tech.htm. View at: Google Scholar
 LoRa E32TTL1W, “Module, Ebyte SX1278 wireless module E32 series, user manual,” 2017, https://img.filipeflop.com/files/download/E32_User+Manual_EN_v1.00.pdf. View at: Google Scholar
 J. Haxhibeqiri, F. Van den Abeele, I. Moerman, and J. Hoebeke, “LoRa scalability: a simulation model based on interference measurements,” Sensors, vol. 17, no. 6, p. 1193, 2017. View at: Publisher Site  Google Scholar
 LoRaWAN, “What is it? A technical overview of LoRA and LoRaWAN,” 2019, https://loraalliance.org/. View at: Google Scholar
 A. Augustin, J. Yi, T. Clausen, and W. M. Townsley, “A study of LoRa: long range & low power networks for the internet of things,” Sensors, vol. 16, no. 9, p. 1466, 2016. View at: Publisher Site  Google Scholar
 “Dijkstra’s algorithm,” 2019, https://en.wikipedia.org/wiki/Dijkstra.algorithm. View at: Google Scholar
Copyright
Copyright © 2020 Tran Anh Khoa et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.