Reinforcement Learning 101
RL has become popular in the AI community, but most people still don’t know what it is about. Come and read, no matter your background!
If you work in technology, and even more so in AI/Machine Learning (ML), you are probably used to people not understanding what you do for a living.
#ai #reinforcement-learning #machine learning
The Association of Data Scientists (AdaSci), a global professional body of data science and ML practitioners, is holding a full-day workshop on building games using reinforcement learning on Saturday, February 20.
Artificial intelligence systems are outperforming humans at many tasks, starting from driving cars, recognising images and objects, generating voices to imitating art, predicting weather, playing chess etc. AlphaGo, DOTA2, StarCraft II etc are a study in reinforcement learning.
Reinforcement learning enables the agent to learn and perform a task under uncertainty in a complex environment. The machine learning paradigm is currently applied to various fields like robotics, pattern recognition, personalised medical treatment, drug discovery, speech recognition, and more.
With an increase in the exciting applications of reinforcement learning across the industries, the demand for RL experts has soared. Taking the cue, the Association of Data Scientists, in collaboration with Analytics India Magazine, is bringing an extensive workshop on reinforcement learning aimed at developers and machine learning practitioners.
#ai workshops #deep reinforcement learning workshop #future of deep reinforcement learning #reinforcement learning #workshop on a saturday #workshop on deep reinforcement learning
Reinforcement learning (RL) is surely a rising field, with the huge influence from the performance of AlphaZero (the best chess engine as of now). RL is a subfield of machine learning that teaches agents to perform in an environment to maximize rewards overtime.
Among RL’s model-free methods is temporal difference (TD) learning, with SARSA and Q-learning (QL) being two of the most used algorithms. I chose to explore SARSA and QL to highlight a subtle difference between on-policy learning and off-learning, which we will discuss later in the post.
This post assumes you have basic knowledge of the agent, environment, action, and rewards within RL’s scope. A brief introduction can be found here.
The outline of this post include:
We will compare these two algorithms via the CartPole game implementation. This post’s code can be found here :QL code ,SARSA code , and the fully functioning code . (the fully-functioning code has both algorithms implemented and trained on cart pole game)
The TD learning will be a bit mathematical, but feel free to skim through and jump directly to QL and SARSA.
#reinforcement-learning #artificial-intelligence #machine-learning #deep-learning #learning
Although the field of deep learning is evolving extremely fast, unique research with the potential to get us closer to Artificial General Intelligence (AGI) is rare and hard to find. One exception to this rule can be found in the field of meta-learning. Recently, meta-learning has also been applied to Reinforcement Learning (RL) with some success. The paper “Discovering Reinforcement Learning Agents” by Oh et al. from DeepMind provides a new and refreshing look at the application of meta-learning to RL.
**Traditionally, RL relied on hand-crafted algorithms **such as Temporal Difference learning (TD-learning) and Monte Carlo learning, various Policy Gradient methods, or combinations thereof such as Actor-Critic models. These RL algorithms are usually finely adjusted to train models for a very specific task such as playing Go or Dota. One reason for this is that multiple hyperparameters such as the discount factor γ and the bootstrapping parameter λ need to be tuned for stable training. Furthermore, the very update rules as well as the choice of predictors such as value functions need to be chosen diligently to ensure good performance of the model. The entire process has to be performed manually and is often tedious and time-consuming.
DeepMind is trying to change this with their latest publication. In the paper, the authors propose a new meta-learning approach that discovers the learning objective as well as the exploration procedure by interacting with a set of simple environments. They call the approach the Learned Policy Gradient (LPG). The most appealing result of the paper is that the algorithm is able to effectively generalize to more complex environments, suggesting the potential to discover novel RL frameworks purely by interaction.
In this post, I will try to explain the paper in detail and provide additional explanation where I had problems with understanding. Hereby, I will stay close to the structure of the paper in order to allow you to find the relevant parts in the original text if you want to get additional details. Let’s dive in!
#meta-learning #reinforcement-learning #machine-learning #ai #deep-learning #deep learning
In this post, we will investigate how easily we can train a Deep Q-Network (DQN) agent (Mnih et al., 2015) for Atari 2600 games using the Google reinforcement learning library Dopamine. While many RL libraries exist, this library is specifically designed with four essential features in mind:
_We believe these principles makes __Dopamine _one of the best RL learning environment available today. Additionally, we even got the library to work on Windows, which we think is quite a feat!
In my view, the visualization of any trained RL agent is an absolute must in reinforcement learning! Therefore, we will (of course) include this for our own trained agent at the very end!
We will go through all the pieces of code required (which is** minimal compared to other libraries**), but you can also find all scripts needed in the following Github repo.
The general premise of deep reinforcement learning is to
“derive efficient representations of the environment from high-dimensional sensory inputs, and use these to generalize past experience to new situations.”
- Mnih et al. (2015)
As stated earlier, we will implement the DQN model by Deepmind, which only uses raw pixels and game score as input. The raw pixels are processed using convolutional neural networks similar to image classification. The primary difference lies in the objective function, which for the DQN agent is called the optimal action-value function
where_ rₜ is the maximum sum of rewards at time t discounted by γ, obtained using a behavior policy π = P(a_∣_s)_ for each observation-action pair.
There are relatively many details to Deep Q-Learning, such as Experience Replay (Lin, 1993) and an _iterative update rule. _Thus, we refer the reader to the original paper for an excellent walk-through of the mathematical details.
One key benefit of DQN compared to previous approaches at the time (2015) was the ability to outperform existing methods for Atari 2600 games using the same set of hyperparameters and only pixel values and game score as input, clearly a tremendous achievement.
This post does not include instructions for installing Tensorflow, but we do want to stress that you can use both the CPU and GPU versions.
Nevertheless, assuming you are using
Python 3.7.x, these are the libraries you need to install (which can all be installed via
tensorflow-gpu=1.15 (or tensorflow==1.15 for CPU version) cmake dopamine-rl atari-py matplotlib pygame seaborn pandas
#reinforcement-learning #q-learning #games #machine-learning #deep-learning #deep learning
You’re getting bore stuck in lockdown, you decided to play computer games to pass your time.
You launched Chess and chose to play against the computer, and you lost!
But how did that happen? How can you lose against a machine that came into existence like 50 years ago?
This is the magic of** Reinforcement learning.**
**Reinforcement learning lies under the umbrella of Machine Learning. **They aim at developing intelligent behavior in a complex dynamic environment. Nowadays since the range of AI is expanding enormously, we can easily locate their importance around us. From _Autonomous Driving, Recommender Search Engines, Computer games to Robot skills, _AI is playing a vital role.
When we think about AI, we have a perception of thinking about the future, but our idea takes us back in the late 19th century, Ivan Pavlov, a Russian physiologist was studying the salivation effect in dogs. He was interested in knowing how much dogs salivate when they see food, but, while conducting the experiment, he noticed that dogs were even salivating before seeing any food. After his conclusions on that experiment, Pavlov would ring a bell before feeding them and as expected they again started salivating. The reason behind their behavior can be their ability to learn** because they had learned that after the bell, they’ll be fed**. Another thing to ponder is, the dog doesn’t salivate because the bell is ringing but because given past experiences he had learned that food will follow the bell.
#deep-learning #artificial-intelligence #reinforcement-learning #data-science #machine-learning #deep learning