This file contains hidden or 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
""" | |
TreeLSTM[1] implementation in Pytorch | |
Based on dynet benchmarks : | |
https://github.com/neulab/dynet-benchmark/blob/master/dynet-py/treenn.py | |
https://github.com/neulab/dynet-benchmark/blob/master/chainer/treenn.py | |
Other References: | |
https://github.com/pytorch/examples/tree/master/word_language_model | |
https://github.com/pfnet/chainer/blob/29c67fe1f2140fa8637201505b4c5e8556fad809/chainer/functions/activation/slstm.py | |
https://github.com/stanfordnlp/treelstm |
This file contains hidden or 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 |
This file contains hidden or 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
# Author: Jean-Remi King <[email protected]> | |
""" | |
Illustrate how a hinge loss and a log loss functions | |
typically used in SVM and Logistic Regression | |
respectively focus on a variable number of samples. | |
For simplification purposes, we won't consider the | |
regularization or penalty (C) factors. | |
""" | |
import numpy as np | |
import matplotlib.animation as animation |
This file contains hidden or 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
name: "nin_imagenet" | |
input: "data" | |
input_shape { | |
dim: 10 | |
dim: 3 | |
dim: 224 | |
dim: 224 | |
} | |
layers { | |
bottom: "data" |