Internet of Things Optimization
Key Takeaways
The video discusses optimizing electricity consumption in smart homes using reinforcement learning and Monte Carlo methods, with applications in Internet of Things (IoT) devices and smart homes. It covers Markov decision processes, Monte Carlo tree search, and model-free techniques for learning optimal policies.
Full Transcript
hello world it's Suraj and the internet-of-things it's definitely a buzzword these days but it's a real thing and I'll demonstrate how to use reinforcement learning to optimize electricity consumption amongst multiple devices in a smart home mark and driessen's quote that software is eating the world still rings true today more and more devices are coming prepackaged with internet access that wouldn't normally be that includes smart soul-shakers smart rectal thermometers smart mugs smart chairs the list goes on and because these devices have a connection to the world wide web they can communicate with the outside world and each other sharing information and even learning from one another this internet of physical things is becoming increasingly common across the globe whether it's a smart home a fleet of self-driving cars or a pipeline of assets as they are shipped across the globe having a web of interconnected physical devices has a huge range of use cases in our modern world for businesses and consumers but a major concern regarding these devices is the amount of energy they'll need to consume silicon chips need electricity and the more devices we have the higher our energy cost will be it turns out that we can use reinforcement learning to create a system that will minimize our electricity costs substantially this can apply to a whole range of industries where an interconnected system of devices is required to perform a task agriculture manufacturing and even a personal home which will be our demo google recently used RL to reduce the amount of energy they used in their data center by up to 40 percent just like a laptop generates Heat their massive racks of servers generate a lot of heat but too much heat can damage the servers so a cooling system is necessary to help maintain a certain temperature and because it's such a dynamic environment a learning system is required to set that temperature a whole host of unforeseen scenarios like changes in weather and power outages can occur also humans interact with the equipment in unexpected ways regularly probably doing the floss dance on them and each data center has a unique architecture and environment so their system needed to be able to adapt to multiple unique environments last week we introduced the fundamental way of framing the reinforcement learning problem where an agent is interacting with an environment to maximize a reward the Markov decision process the goal of an agent is to learn a policy so it knows given a state the best action to take in order to maximize a reward and in a complete Markov decision process where all of the environment variables are known we can use dynamic programming to learn an optimal policy but what if we don't know all the environment variables beforehand give up no then it'd be considered not model-based RL but model free RL in model free RL the first variable we miss is a transition model so we won't know what's going to happen after each action we take beforehand this tells us the probabilities associated with various state changes the second thing we miss is the reward function which gives the agent the reward associated with a particular state beforehand so when we don't know either of these Markovian variables dynamic programming won't work we need to instead use a different type of method called Monte Carlo Monte Carlo methods are a broad class of algorithms that rely on repeated random sampling to obtain numerical results the key word here is random Monte Carlo methods make use of randomness to solve problems which turns out to be very useful in mathematics and physics Stanislaw ulam invented it in the late 1940s while working on a nuclear bomb as part of the Manhattan Project then john von neumann decided he liked it and programmed a machine to do those same calculations they decided to name the codebase Monte Carlo as every super-secret project should be named Coulomb's uncle happened to be losing lots of money in the monte carlo casino in Monaco so that's why uncle's in fact deep mines alphago used what's called a Monte Carlo tree search to help it play against the reigning go champion resulting in move thirty seven more on that at the end of the course Monte Carlo techniques have several advantages over dynamic programming first they allow for learning optimal behavior directly from interaction with the environment without needing the transition or reward function defined beforehand second it's easy and computationally efficient to focus MC methods on a small subset of the total states and third MC can be used with simulations so let's say we have a home that consists of a bunch of Internet of Things devices we've got a smart TV a smart fridge a smart dog and a smart giant server in our room all of this equipment requires a lot of electricity to run but it also requires cooling or else my room would get too hot so I have a cooling system now let's say that we have access to our electricity usage logs thanks to partnering with a data friendly provider and our smart thermostat can set a temperature accordingly depending on the type of system we build we can imagine electricity flowing into all of these devices creating a closed loop system and this constant stream of electricity data it can definitely be utilized it's giving us the electricity price cooling demand and electricity consumption as variables using this we can construct our Markov decision process the goal of our system is to minimize our electricity bills more money for GPUs lamelle our agent will perform an action in this environment that action will be to either increase or decrease the temperature by one degree Celsius my fellow Americans most of this audience uses the metric system the state then that our agent can be in will be a measure of both how much cooling demand there is as well as the price of electricity the reward can tell us whether we are saving money or not by switching states by calculating the total electricity consumption multiplied by the price of electricity and depending on if that's greater or less than what exists at the time step before we know whether or not that is a positive or negative reward there exists an optimal policy here such that if we were to give it a state in this case that would be the cooling demand and the electricity price it would know exactly what temperature the thermostat should be set at such that we are optimally saving money on electricity by cooling our room as much as necessary when necessary our adaptive real time reward based system needs to learn this optimal policy and since we don't know the reward function or the transition function beforehand we have to compute our rewards and transitions as they happen in real time we'll want to use a model free technique like Monte Carlo to learn the optimal policy the basic idea is to calculate the value function of each state backwards with the reward received after the end of the episode there has to be an ended then the task has to be considered an episodic task for us to use Monte Carlo in our case we can say that an episode lasts a full eight hours while I'm away at my office working diligently if we move from the initial state to the terminal state according to the given policy will receive a reward at each time step we'll remember all of those rewards and when we get to the terminal state will loop back and calculate the value function of each state in the case that there are multiple episodes then Monte Carlo just averages all of the returns we know that the return is the sum of the discounted reward in the context of Monte Carlo though we switch it up to obtain the state value function we take instead the expectation of the returns not the sum we can define a state s to be a discrete random variable which can assume all the stats with a certain probability every time our agent reaches a state it's like we are picking a value for the random variable s for each state of each episode we can calculate the return and store it in a list repeating this process a lot is guaranteed to converge on the true state value function in Monte Carlo RL we are estimating the value function for each state based on the return of each episode and the more episodes we take into account the more accurate or estimation will be notice though that a possible problem could occur what if we visit the same state twice in a single episode well there are actually two types of Monte Carlo policy evaluation first visit and every visit will focus on first visit in this video first visit only recognizes the first visited state every second visit does not count the return for that state visit and the return is calculated separately for each visit Monte Carlo includes randomness because when it updates every episode depending on where it originated from it's a different result depending on which action we take in the same state because it contains these random elements Monte Carlo has a high variance when we graph a simulation of our agent solving a problem we'll see that eventually the policy will converge and then our system will know exactly what temperature to set our room based on the electricity related variables there are different kinds of Monte Carlo techniques that can do all sorts of cool things but we'll talk about those later on three points to remember from this video in model free reinforcement learning as opposed to model based we don't know the reward function and the transition function beforehand we have to learn them through experience a model free learning technique called Monte Carlo uses repeated random sampling to obtain numerical results and in first visit Monte Carlo the state value function is defined as the average of the returns following the agent's first visit to s and set of episodes please subscribe for more programming videos and for now I've got to try a new sample so thanks for watching
Original Description
The Internet of things lives! More and more devices are coming prepackaged with internet access that wouldn’t normally be. That includes everything from smart salt shakers to smart tabletops. And because these devices have a connection to the world wide web, they can communicate with the outside world and each other, sharing information and even learning from one another. In this video, I'll explain how to use a reinforcement learning technique called "Monte Carlo" to optimize electricity consumption and cooling demands for a smart home. Enjoy!
Code for this video:
https://github.com/llSourcell/Internet_of_Things_Optimization
Please Subscribe! And like. And comment. That's what keeps me going.
Want more education? Connect with me here:
Twitter: https://twitter.com/sirajraval
Facebook: https://www.facebook.com/sirajology
instagram: https://www.instagram.com/sirajraval
The School of AI:
https://www.theschool.ai
Github Syllabus:
https://github.com/llSourcell/Move_37_Syllabus
More learning resources:
https://www.kth.se/social/files/58b941d5f276542843812288/RL04-Monte-Carlo.pdf
https://courses.cs.washington.edu/courses/csep573/12au/lectures/18-rl.pdf
https://stat.ethz.ch/education/semesters/ss2016/seminar/files/slides/RL_MCM_heinzer_profumo.pdf
https://medium.com/deep-math-machine-learning-ai/ch-12-1-model-free-reinforcement-learning-algorithms-monte-carlo-sarsa-q-learning-65267cb8d1b4
http://www-edlab.cs.umass.edu/cs689/lectures/RL%20Lecture%205.pdf
https://github.com/dennybritz/reinforcement-learning/tree/master/MC
Join us in the Wizards Slack channel:
http://wizards.herokuapp.com/
And please support me on Patreon:
https://www.patreon.com/user?u=3191693
#InternetOfThings #IOT #SirajRaval
Signup for my newsletter for exciting updates in the field of AI:
https://goo.gl/FZzJ5w
Hiring? Need a Job? See our job board!:
www.theschool.ai/jobs/
Need help on a project? See our consulting group:
www.theschool.ai/consulting-group/
Hit the Join button above to sign up t
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Siraj Raval · Siraj Raval · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
What is Bitcoin?
Siraj Raval
5 Ways to Use Bitcoin
Siraj Raval
BTC Fever - Siraj [Music Video]
Siraj Raval
5 Reasons to Build Decentralized Apps
Siraj Raval
The Interplanetary File System
Siraj Raval
How to Build a Dapp in 3 min
Siraj Raval
Life Before Smartphones
Siraj Raval
4 Ways to Use Smart Contracts
Siraj Raval
3 Dapps You HAVE to See
Siraj Raval
Char's Life as a BitTorrent Engineer
Siraj Raval
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
Build a Neural Net in 4 Minutes
Siraj Raval
Sentiment Analysis in 4 Minutes
Siraj Raval
The Hackathon Life
Siraj Raval
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
Build a Chatbot - ML for Hackers #6
Siraj Raval
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
Build a Recurrent Neural Net in 5 Min
Siraj Raval
Build a Simulation in 5 Min
Siraj Raval
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
Tensorboard Explained in 5 Min
Siraj Raval
Generate Music in TensorFlow
Siraj Raval
Build a Game Bot (LIVE)
Siraj Raval
Deep Learning Frameworks Compared
Siraj Raval
Introduction - Learn Python for Data Science #1
Siraj Raval
Build a Neural Network (LIVE)
Siraj Raval
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
Pong Neural Network (LIVE)
Siraj Raval
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
Visualizing Data with D3.js (LIVE)
Siraj Raval
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
Enter Siraj [Music Video]
Siraj Raval
Build a Web Scraper (LIVE)
Siraj Raval
Why is P vs NP Important?
Siraj Raval
How to Make a Neural Network (LIVE)
Siraj Raval
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
How to Make an Amazing Video Game Bot Easily
Siraj Raval
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
The Best Way to Prepare a Dataset Easily
Siraj Raval
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval
More on: ML Maths Basics
View skill →Related Reads
📰
📰
📰
📰
It Takes 8 Tokens: Weak-to-Strong Off-Policy RL via Auxiliary Branches
ArXiv cs.AI
A Practical Guide to Implementing the REINFORCE Algorithm in Python (Part 5)
Medium · Machine Learning
Gimitest: A Comprehensive Tool for Testing Reinforcement Learning Policies
ArXiv cs.AI
RLVP: Penalize the Path, Reward the Outcome
ArXiv cs.AI
🎓
Tutor Explanation
DeepCamp AI