This gist is an accumulation of high-quality implementations and packages useful for research in reinforcement learning.
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
from spinup.utils.run_utils import ExperimentGrid | |
from spinup import ddpg | |
import gym | |
import tensorflow as tf | |
def run_experiment(args): | |
def env_fn(): | |
import envs # registers custom envs to gym env registry | |
return gym.make(args.env_name) |
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 jaccard_metric(x, y): | |
""" | |
x: scipy.sparse CSR matrix shape (1, n) | |
y: scipy.sparse CSR matrix shape (1, n) | |
returns: jaccard similarity | |
""" | |
return x.minimum(y).sum()/x.maximum(y).sum() | |
def l2_metric(x,y): | |
""" |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Code adapted from TensorFlow source example: | |
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/learn/python/learn/datasets/mnist.py | |
class DataSet: | |
"""Base data set class | |
""" | |
def __init__(self, shuffle=True, labeled=True, **data_dict): | |
assert '_data' in data_dict | |
if labeled: |
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
// code courtesy of Toby team | |
chrome.storage.local.get("state", o => ( | |
((f, t) => { | |
let e = document.createElement("a"); | |
e.setAttribute("href", `data:text/plain;charset=utf-8,${encodeURIComponent(t)}`); | |
e.setAttribute("download", f); | |
e.click(); | |
})(`TobyBackup${Date.now()}.json`, o.state) | |
)); |
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
"""This tutorial introduces Contractive auto-encoders (cA) using Theano. | |
They are based on auto-encoders as the ones used in Bengio et | |
al. 2007. An autoencoder takes an input x and first maps it to a | |
hidden representation y = f_{\theta}(x) = s(Wx+b), parameterized by | |
\theta={W,b}. The resulting latent representation y is then mapped | |
back to a "reconstructed" vector z \in [0,1]^d in input space z = | |
g_{\theta'}(y) = s(W'y + b'). The weight matrix W' can optionally be | |
constrained such that W' = W^T, in which case the autoencoder is said | |
to have tied weights. The network is trained such that to minimize |
Shortcut | Meaning |
---|---|
\a | an ASCII bell character (07) |
\d | the date in “Weekday Month Date” format (e.g., “Tue May 26”) |
\D{format} | the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are requir |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder