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 theano | |
from theano.tensor.io import send, recv, mpi_cmps | |
import theano.sandbox.linalg as linalg | |
from theano.gof.sched import sort_schedule_fn | |
from time import time | |
dot = theano.tensor.dot | |
dtype = 'float32' | |
n = 500 | |
run = 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
/** | |
* Disables BuddyPress' registration process and fallsback to WordPress' one. | |
*/ | |
function my_disable_bp_registration() { | |
remove_action( 'bp_init', 'bp_core_wpsignup_redirect' ); | |
remove_action( 'bp_screens', 'bp_core_screen_signup' ); | |
} | |
add_action( 'bp_loaded', 'my_disable_bp_registration' ); |
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 theano | |
from pylearn2.models import mlp | |
from pylearn2.training_algorithms import sgd | |
from pylearn2.termination_criteria import EpochCounter | |
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix | |
import numpy as np | |
from random import randint | |
class XOR(DenseDesignMatrix): |
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
""" | |
A deep neural network with or w/o dropout in one file. | |
License: Do What The Fuck You Want to Public License http://www.wtfpl.net/ | |
""" | |
import numpy, theano, sys, math | |
from theano import tensor as T | |
from theano import shared | |
from theano.tensor.shared_randomstreams import RandomStreams |
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
#!/usr/bin/env python2 | |
# coding: utf-8 | |
from __future__ import print_function | |
import sys | |
import re | |
import json | |
import urllib | |
from colorama import init, Fore, Back, Style | |
URL = 'http://csearch.naver.com/dcontent/spellchecker.nhn' |
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 networkx as nx | |
from IPython.display import display, HTML | |
def d3_graph(G): | |
text_edges = '' | |
edges = G.edges() | |
length = len(edges) | |
for index, edge in enumerate(edges): | |
text = '{"source":"'+edge[0]+'","target":"'+edge[1]+'"}' | |
if index == length-1: | |
text_edges = text_edges + text |
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
# Working example for my blog post at: | |
# http://danijar.com/variable-sequence-lengths-in-tensorflow/ | |
import functools | |
import sets | |
import tensorflow as tf | |
from tensorflow.models.rnn import rnn_cell | |
from tensorflow.models.rnn import rnn | |
def lazy_property(function): |
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
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
# hyperparameters | |
H = 200 # number of hidden layer neurons | |
batch_size = 10 # every how many episodes to do a param update? | |
learning_rate = 1e-4 | |
gamma = 0.99 # discount factor for reward |