Book Image

Smart Internet of Things Projects

By : Agus Kurniawan
Book Image

Smart Internet of Things Projects

By: Agus Kurniawan

Overview of this book

Internet of Things (IoT) is a groundbreaking technology that involves connecting numerous physical devices to the Internet and controlling them. Creating basic IoT projects is common, but imagine building smart IoT projects that can extract data from physical devices, thereby making decisions by themselves. Our book overcomes the challenge of analyzing data from physical devices and accomplishes all that your imagination can dream up by teaching you how to build smart IoT projects. Basic statistics and various applied algorithms in data science and machine learning are introduced to accelerate your knowledge of how to integrate a decision system into a physical device. This book contains IoT projects such as building a smart temperature controller, creating your own vision machine project, building an autonomous mobile robot car, controlling IoT projects through voice commands, building IoT applications utilizing cloud technology and data science, and many more. We will also leverage a small yet powerful IoT chip, Raspberry Pi with Arduino, in order to integrate a smart decision-making system in the IoT projects.
Table of Contents (13 chapters)
Smart Internet of Things Projects
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Building a simple decision system-based Bayesian theory


In this section, we build a simple decision system using Bayesian theory. A smart water system is a smart system that controls water. In general, you can see the system architecture in the following figure:

After using a sensing process on water to obtain the water quality, you can make a decision. If the water quality is good, we can transfer the water to customers. Otherwise, we purify the water.

To implement a decision system-based Bayesian theory, firstly we define the state of nature. In this case, we define two states of nature:

  • ω1: water is ready for drinking

  • ω2: water should be cleaned (kotor)

For inputs, we can declare x1 and x1 as negative and positive as the observation results.

We define prior values and class conditional probabilities as follows:

To build a decision, we should make a loss function The following is a loss function for our program:

Now you can write the complete scripts for the program.

# decision action
# d1 = distribute...