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 |
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)) |
View RandomForestRegressor.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View BashPS1.md
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 |
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: |
View Tensorflow Tutorial.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 -> |
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): | |
""" |
View spinup_run_script.py
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) |
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) | |
)); |
OlderNewer