JavaScript function
A function is a block of code that performs a task. It can be called and reused multiple times. You can pass information to a function and it can send information back.
A function is a block of code that performs a task. It can be called and reused multiple times. You can pass information to a function and it can send information back.
Table of Contents break continue break and labeled blocks break will stop the loop and move on to the code below the loop. continue will stop the current iteration and move back to the top of the loop, checking the condition (or in the case of a for loop, performing the statement and then checking the condition). break In the following code, we […]
An introductory tutorial about various looping techniques in JavaScript.
Introduction to conditional statements in JavaScript.
They are like a dictionary in Python. This tutorial covers basic of JavaScript objects and how they go together with arrays.
A simple webpage about arrays and related function in JavaScript.
An article about the basics of object oriented programming in JavaScript.
This article covers classes, objects, methods, prototypes etc.
Solving the Acrobot problem with the help of Actor-Critic algorithm.
The blog about the CNN functions in PyTorch and other assisting functions generally used with Convolution Neural Networks.
In double DQNs, we use a separate network to estimate the target rather than the prediction network. The separate network has the same structure as the prediction network. And its weights are fixed for every T episode (T is a hyperparameter we can tune), which means they are only updated after every T episode. The update is simply done by […]
Function Approximation For problems with very large number of states it will not be feasible for our agent to use table to record the value of all the action for each state and make its policy accordingly. In Function approximation agent learns a function which will approxmately give it best action for particular state. In this example we will use […]
We will use SARSA algorithm to find the optimal policy so that our agent can navigate in windy world. SARSA State–action–reward–state–action (SARSA) is an algorithm for learning a Markov decision process policy, used in the reinforcement learning area of machine learning. SARSA focuses on state-action values. It updates the Q-function based on the following equation: Q(s,a) = Q(s,a) + α (r + γ Q(s’,a’) – Q(s,a)) Here s’ […]
The policy gradient algorithm trains an agent by taking small steps and updating the weight based on the rewards associated with those steps at the end of an episode. The technique of having the agent run through an entire episode and then updating the policy based on the rewards obtained is called Monte Carlo policy gradient. The action is selected […]
Introduction There are four designated locations in the grid world indicated by R(ed), G(reen), Y(ellow), and B(lue). When the episode starts, the taxi starts off at a random square and the passenger is at a random location. The taxi drives to the passenger’s location, picks up the passenger, drives to the passenger’s destination (another one of the four specified locations), […]
A colony of bees knows a garden of roses nearby. This garden is their primary source of nectar and pollen. There might be another garden far from their hive which might contain a variety of flowers. Going to that garden demands a lot of time and energy. Should this colony of bees continue bringing nectar and pollen from nearby rose […]
The Frozen Lake This lake has a 4×4 grid of total 16 states. # Frozen Lake Gridworld: It is highly stochastic environment (33.33% action success, 66.66% split evenly in right angles) It contains 4×4 grid, 16 states (0-15) The agent gets +1 for landing in state 15 (right bottom corner) 0 otherwise The states 5, 7, 11, and 12 are […]
The data Importing the Library and loading the data Crosstab Basic Selection with .loc and .iloc Using basic function with cross tab Margins are for total Normalizing Results Aggregate function Sorting Unique values Visualization Plotting
Load the Data Converting each column data to numpy array From numpy array to pytorch tensor Plotting the data Using the GPU Defining the neural network Putting neural network on GPU Loss function Setting ADAM as an optimizer Defining accuracy The main loop Plotting Loss Plotting accuracy After one epoch Plots to show performance of neural network over epochs
Making a simple neural network with a single hidden layer and four neurons in hidden layer. Schema of our Neural Network Import necessary libraries Inputs and outputs Converting basic python array to PyTorch tensors Code to use GPU if available Putting our variable to GPU Defining neural network instantiate neural network Weights of different layers Loss function Only one forward […]