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
module purge -f | |
module load compilers/gcc/4.8.5 compilers/java/1.8 apps/buildtools cuda/7.5 libs/cuDNN/5 compilers/swig apps/git apps/bazel/0.4.3 apps/python/3.5.0 | |
source source ~/pythonenvs/python3/bin/activate # My python 3 env | |
OPWD=$(pwd) | |
TF_COMPILE_PATH=/tmp/${USER}_$(date +'%s') | |
BAZEL_ROOT_PATH=$TF_COMPILE_PATH/bazel | |
mkdir -p $TF_COMPILE_PATH; cd $TF_COMPILE_PATH |
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
from sklearn.datasets import fetch_mldata | |
from matplotlib import pyplot as plt | |
from sklearn.decomposition import PCA | |
from sklearn.model_selection import train_test_split | |
from sklearn.neighbors import KNeighborsClassifier | |
from sklearn.metrics import classification_report | |
if __name__ == "__main__": | |
mnist = fetch_mldata('MNIST original') |
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
def cumsum(softmax): | |
values = tf.split(1, softmax.get_shape()[1], softmax) | |
out = [] | |
prev = tf.zeros_like(values[0]) | |
for val in values: | |
s = prev + val | |
out.append(s) | |
prev = s | |
cumsum = tf.concat(1, out) | |
return cumsum |
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
linear = MLP([Identity(), Identity()], [2, 10, 2], weights_init=Constant(1), biases_init=Constant(2)) | |
x = tensor.matrix('x') | |
y_hat = linear.apply(x) | |
cost = .... | |
cg = ComputationGraph(y) | |
weights = VariableFilter(roles=[WEIGHTS])(cg.variables) | |
cg = apply_dropout(cg, weights, 0.5) | |
target_cost = cg.outputs[0] | |
algorithm = GradientDescent(cost=target_cost, params=cg.parameters,...) |