Skip to content

Instantly share code, notes, and snippets.

MAX_ITER = 10000;
function getMax(arr){
return arr[0]<=arr[1] ? 1 : 0;
}
function getMin(arr){
return arr[0]<arr[1] ? 0 : 1;
}
@ZSalloum
ZSalloum / ARS.py
Created February 10, 2019 22:38
Standard_ARS_Implementation
# the standard implementation of ARS
# Importing the libraries
import datetime
import os
import numpy as np
import gym
from gym import wrappers
import pybullet_envs
@ZSalloum
ZSalloum / XOR_NeuralNetworks_with_Matrix
Last active September 24, 2022 04:26
XOR Neural Network using matrix as input
import numpy as np
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x))
def sigmoid_prime(x):
return sigmoid(x) * (1.0 - sigmoid(x))
@ZSalloum
ZSalloum / XOR_NeuralNetwork.py
Created January 19, 2019 01:31
Neural Network to train XOR function
import numpy as np
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x))
def sigmoid_prime(x):
return sigmoid(x) * (1.0 - sigmoid(x))
def dF(x):
return 2*x
a = .9
def gradient_descent_constant_alpha(th, a, epsilon):
i=1
deriv=dF(th)
print(i,",", th, ", ", a, ", ", deriv)
@ZSalloum
ZSalloum / DoubleQLearningVsQLearning.py
Last active August 13, 2022 13:11
This python shows the comparison between the performance of Double QLearning and the QLearning, in special cases where QLearning performs poorly
import numpy as np
import matplotlib.pyplot as plt
# these are the control variables, change them to customize the execution of this program
cntExperiments= 1001 # number of experiments to run, large number means longer execution time
MAX_ITER = 301 # number of episodes per experiment, large number means longer execution time
ACTIONS_FOR_B = 10 #number of actions at state B