Skip to content

Instantly share code, notes, and snippets.

@jangirrishabh
Created June 14, 2018 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jangirrishabh/49b602b9a3090773d492310175bb2e3f to your computer and use it in GitHub Desktop.
Save jangirrishabh/49b602b9a3090773d492310175bb2e3f to your computer and use it in GitHub Desktop.
Snippet for toyCarIRL, blog usage, not executable
class irlAgent:
def __init__(self, randomFE, expertFE, epsilon, num_states, num_frames, behavior):
self.randomPolicy = randomFE
self.expertPolicy = expertFE
self.num_states = num_states
self.num_frames = num_frames
self.behavior = behavior
self.epsilon = epsilon # termination when t < 0.1
self.randomT = np.linalg.norm(np.asarray(self.expertPolicy)-np.asarray(self.randomPolicy)) #norm of the diff in expert and random
self.policiesFE = {self.randomT:self.randomPolicy} # storing the policies and their respective t values in a dictionary
print ("Expert - Random at the Start (t) :: " , self.randomT)
self.currentT = self.randomT
self.minimumT = self.randomT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment