{{ message }}

Instantly share code, notes, and snippets.

💻

# Krishnan Srinivasan krishpop

💻
Last active Dec 25, 2015
View RandomForest.py
 import numpy as np import matplotlib.pyplot as plt def basic_linear_reg(x, y): # linear reg on 2 axes length = len(x) sum_x = sum(x) sum_y = sum(y) sum_xsq = sum(map(lambda a: a * a, x)) sum_xy = sum(map(lambda a, b: a * b, x, y))
Created Dec 26, 2015
View RandomForestRegressor.ipynb
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active Apr 12, 2016
View BashPS1.md
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
Created Nov 28, 2016
Contractive Autoencoder (http://deeplearning.net/tutorial/code/cA.py)
View cA.py
 """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
Last active Feb 28, 2021
Export Toby
View export-toby.js
 // 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) ));
Last active Aug 8, 2017
Tensorflow dataset class
View dataset.py
 # 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:
Last active Nov 21, 2017
TF Tutorial
View Tensorflow Tutorial.ipynb
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active Jul 29, 2018
automatic update by http://atom.io/packages/sync-settings
View init.coffee
 # 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 ->
Last active Apr 1, 2021
RL Packages and Implementations
View rl-packages.md

# RL Packages and Implementations

This gist is an accumulation of high-quality implementations and packages useful for research in reinforcement learning.

## TensorFlow

Created Apr 16, 2019
Similarity metrics for Sparse Matrices
View similarity.py
 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): """