Skip to content

Instantly share code, notes, and snippets.

View krishpop's full-sized avatar
💻

Krishnan Srinivasan krishpop

💻
  • United States
View GitHub Profile
@krishpop
krishpop / spinup_run_script.py
Created June 28, 2019 00:38
Minimal example of Spinup Experiment (DDPG)
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)
@krishpop
krishpop / similarity.py
Created April 16, 2019 03:40
Similarity metrics for Sparse Matrices
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):
"""
@krishpop
krishpop / rl-packages.md
Last active April 1, 2021 07:49
RL Packages and Implementations
# 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 ->
@krishpop
krishpop / Tensorflow Tutorial.ipynb
Last active November 21, 2017 23:00
TF Tutorial
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@krishpop
krishpop / dataset.py
Last active August 8, 2017 18:10
Tensorflow dataset class
# 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:
@krishpop
krishpop / export-toby.js
Last active March 21, 2024 22:12
Export Toby
// 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 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.