EXPERIMENT 1
Aim: To set up the Spyder IDE for executing Python programs and running a basic Python
script.
Theory: Spyder is an open-source integrated development environment (IDE) designed for
Python, often used in data science. It allows users to write, debug, and execute Python code.
The environment supports powerful libraries and provides a user-friendly interface for beginners
and experts alike.
Output:
EXPERIMENT 2
Aim: To install Keras, TensorFlow, and PyTorch libraries and demonstrate their use in machine
learning projects.
Theory: Keras is a high-level neural networks API, written in Python and capable of running on
top of TensorFlow. TensorFlow is an open-source platform for machine learning, while PyTorch
is an open-source machine learning library based on Torch, primarily used for applications such
as natural language processing and deep learning.
Source Code:
IMPLEMENTATION CODE:
Output:
EXPERIMENT 4
Aim: To implement a Deep Q-Network (DQN) using PyTorch for reinforcement learning
tasks.
Theory: Deep Q-Network is a reinforcement learning algorithm that uses a deep neural network
to approximate the optimal action-value function. It is commonly used in environments where an
agent interacts with a dynamic environment to maximize cumulative rewards.
Source Code:
Output:
EXPERIMENT 5
Aim: To implement iterative policy evaluation and update using Python.
Theory: Iterative policy evaluation is a technique in reinforcement learning where the value
function is updated iteratively for a given policy, allowing for the improvement and optimization
of the policy based on value function approximations.
Source Code:
Output:
EXPERIMENT 3
Aim: To implement the Q-learning algorithm in pure Python and train the agent to play a game
using the OpenAI Gym environment.
Theory: Q-learning is a model-free reinforcement learning algorithm that seeks to find the best
action to take given the current state. It updates a Q-table that stores the cumulative expected
reward for each action in each state. OpenAI Gym provides a collection of environments where
agents can be trained and tested.
Source Code:
From the code and context, the game being played is FrozenLake-v1 from OpenAI Gym,
specifically with is_slippery=False. This environment simulates an agent trying to navigate
across a grid of frozen ground and holes (pits) to reach a goal.
Environment Setup and Introduction to OpenAI Gym:
Write Q learning algo and train the Agent to play the game
Watch Trained Agent play the game
Output:
WATCH THE MODEL PLAY: