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
import matplotlib.pyplot as plt | |
def plot_polygon(vertices): | |
plt.figure() | |
for i in range(len(vertices)-1): | |
vertex_set = [ vertices[i] ] + [ vertices[i+1] ] | |
x, y = zip(*vertex_set) | |
plt.plot(x,y) | |
vertex_set = [ vertices[0] ] + [ vertices[-1] ] |
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
Show hidden characters
[ | |
//makes go to lines easier | |
{ "keys": ["super+;"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, | |
// makes bookmarking easier | |
{ "keys": ["f5"], "command": "toggle_bookmark" }, | |
{ "keys": ["f6"], "command": "next_bookmark" }, | |
{ "keys": ["super+f6"], "command": "prev_bookmark" } | |
] |
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
# Load the data streamer: | |
ds = IOutils.data_streamer(num_sets='all') | |
# obtains the unique rows in a dataset | |
def unique_rows(data): | |
uniq = np.unique(data.view(data.dtype.descr * data.shape[1])) | |
return uniq.view(data.dtype).reshape(-1, data.shape[1]) | |
X, Y = ds.next() | |
Y = np.array(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 polar functions dr/dt and d\[Theta]/dt here: | |
field = {r (1 - r^2) (4 - r^2), 2 - r^2}; | |
# Creates the stream plot | |
StreamPlot[ | |
Evaluate@TransformedField["Polar" -> "Cartesian", | |
field, {r, \[Theta]} -> {x, y}], {x, -3, 3}, {y, -3, 3}] |
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
apt-get update | |
apt-get install -y git | |
apt-get install -y tmux | |
apt-get install -y python-pip | |
apt-get install -y python-numpy python-scipy | |
apt-get install -y python-matplotlib | |
apt-get install -y python-pandas | |
pip install scikit-learn | |
apt-get install -y ipython | |
pip install -e git+https://github.com/Theano/Theano.git@15c90dd3#egg=Theano==0.8.git |
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
# time_values is a signal of shape: (time, n_channels) | |
# window data tensor is of shape: (time, window_size, n_channels) | |
# where window_size just holds all the data for the T-window_size data. | |
window_data_tensor = np.zeros((time_values.shape[0], window_size, time_values.shape[1])) | |
for t in range(1, time_values.shape[0]): | |
if t <= window_size: | |
window_data_tensor[t, :, :] = np.pad(time_values[:t, :], ((0, window_size-t), (0,0)), mode='constant') | |
elif t > window_size and t < time_values.shape[0]-window_size+1: |
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
var q = require('q'); | |
var request = require('request'); | |
var context = { | |
query: 'hello how are you?' | |
} // global context to be mutated by all "plugins" | |
function hello_plugin(context){ | |
var query = context.query | |
var contains_hello = false; |
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
import numpy as np | |
import time | |
# the population: | |
global population | |
population = np.random.normal(-10,10, size=(10**6, 3)) | |
def sample(args): | |
centre, radii = args | |
# print centre, radii |
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
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
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
target | friend | strength | class | state | |
---|---|---|---|---|---|
0 | 19 | 1 | SCI1 | 0 | |
1 | 85 | 1 | HUM1 | 0 | |
1 | 62 | 1 | HUM1 | 0 | |
1 | 38 | 1 | HUM1 | 0 | |
1 | 72 | 1 | HUM1 | 0 | |
2 | 61 | 1 | SCI1 | 0 | |
2 | 79 | 1 | SCI1 | 0 | |
2 | 48 | 1 | SCI1 | 0 | |
4 | 39 | 1 | HUM1 | 0 |
OlderNewer