This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAX_ITER = 10000; | |
function getMax(arr){ | |
return arr[0]<=arr[1] ? 1 : 0; | |
} | |
function getMin(arr){ | |
return arr[0]<arr[1] ? 0 : 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |