tmux cheatsheet
As configured in my dotfiles.
start new:
tmux
start new with session name:
from multiprocessing import Pool | |
# parallelize function | |
def product(a,b): | |
print a*b | |
# auxiliary funciton to make it work | |
def product_helper(args): | |
return product(*args) |
import numpy as np | |
import theano | |
import theano.tensor as T | |
from theano import function,sandbox | |
from theano import ProfileMode | |
import warnings | |
warnings.filterwarnings("ignore") | |
# Dummy Data | |
theano.config.floatX = 'float32' # Theano needs this type of data for GPU use |
import numpy as np | |
from scipy import linalg | |
from sklearn.utils import array2d, as_float_array | |
from sklearn.base import TransformerMixin, BaseEstimator | |
class ZCA(BaseEstimator, TransformerMixin): | |
def __init__(self, regularization=10**-5, copy=False): | |
self.regularization = regularization |
As configured in my dotfiles.
start new:
tmux
start new with session name:
if __name__ == '__main__': | |
from sklearn.cross_validation import StratifiedShuffleSplit | |
# svc = LinearSVC(class_weight='auto', penalty='l1', dual=False, verbose = 15, C=0.1) | |
svc = Perceptron(penalty='l1', alpha=0.05, fit_intercept=True, n_iter = 100, shuffle=True, n_jobs=-1, class_weight='auto', verbose=15) | |
sf = StratifiedShuffleSplit(y,n_iter = 2, train_size =0.9, test_size=0.1); | |
for train,test in sf: | |
X_train, X_test = X[train], X[test] | |
y_train, y_test = y[train], y[test] | |
print 'Train set size: ', X_train.shape | |
print 'Test set size: ', X_test.shape |
#!/bin/bash | |
from bs4 import BeautifulSoup | |
import requests | |
import urllib2 | |
import os | |
import re, urlparse | |
import time | |
import pdb | |
from interruptingcow import timeout |
import pandas as pd | |
from sqlalchemy import * | |
engine = create_engine('mysql://username:pass@server_address', pool_recycle=60) | |
DF = pd.io.parsers.read_csv('csv/file/path.csv') | |
DF = DF.dropna() | |
DF.to_sql('table_name', con=engine, if_exists='replace', flavor='mysql') # replace truncates the existing table and creates a new one |
def svd_whiten(X): | |
U, s, Vt = np.linalg.svd(X) | |
# U and Vt are the singular matrices, and s contains the singular values. | |
# Since the rows of both U and Vt are orthonormal vectors, then U * Vt | |
# will be white | |
X_white = np.dot(U, Vt) | |
return X_white |
name: "sentio_full_train" | |
# N.B. input image must be in CIFAR-10 format | |
# as described at http://www.cs.toronto.edu/~kriz/cifar.html | |
layers{ | |
name: "data" | |
type: HDF5_DATA | |
top: "data" | |
top: "label" | |
hdf5_data_param { |
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:7278f115593dc43b248938b9210d9794dad8be21e1221b4b92f49716c2b633b8" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |