Skip to content

Instantly share code, notes, and snippets.

@jangirrishabh
Created June 14, 2018 11:42
Show Gist options
  • Save jangirrishabh/bc17c06a07ea3b915827e89f3c13a2ae to your computer and use it in GitHub Desktop.
Save jangirrishabh/bc17c06a07ea3b915827e89f3c13a2ae to your computer and use it in GitHub Desktop.
Snippet for toyCarIRL, blog usage, not executable
def getRLAgentFE(self, W, i): #get the feature expectations of a new poliicy using RL agent
IRL_helper(W, self.behavior, self.num_frames, i) # train the agent and save the model in a file used below
saved_model = 'saved-models_'+self.behavior+str(i)+'/164-150-100-50000-'+str(self.num_frames)+'.h5' # use the saved model to get the FE
model = neural_net(self.num_states, [164, 150], saved_model)
return play(model, W)#return feature expectations by executing the learned policy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment