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 build_model(): | |
""" | |
""" | |
initializer = tf.truncated_normal_initializer(stddev=0.02) | |
feature_size = len(FLAGS.features) | |
source = \ | |
tf.placeholder(shape=[None, 32, 28 * feature_size], dtype=tf.float32) | |
target = \ |
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 instance_norm(flow): | |
""" | |
arXiv:1607.08022v2 | |
""" | |
with tf.variable_scope('inst_norm'): | |
depth = flow.get_shape()[3] | |
scale = tf.get_variable( | |
'scale', | |
[depth], | |
initializer=tf.random_normal_initializer(1.0, 0.02)) |
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 build_model(): | |
""" | |
""" | |
eigens = tf.placeholder(shape=[None, 32, 28, 1], dtype=tf.float32) | |
labels = tf.placeholder(shape=[None, 28], dtype=tf.float32) | |
flow = eigens | |
weights_initializer = tf.truncated_normal_initializer(stddev=0.02) |
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 linear(): | |
""" | |
""" | |
eigens = np.load('../dataset/v0_eigens.npz') | |
train_eigens = eigens['train_eigens'] | |
issue_eigens = eigens['issue_eigens'] | |
# 28 boolean a week, labels are the last week | |
# train = training, issue = testing, eigens = features |
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
# there are 32 weeks | |
weights_center = 0.5 * np.ones((32, 1)) | |
weights_offset = np.zeros_like(weights_center) | |
auc_save = 0.8 | |
auc_best = 0.0 | |
for step in range(steps): | |
# update weights | |
weights = np.clip(weights_center + weights_offset, 0.0, 1.0) |
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
// algorithm | |
template <class InputIterator, class UnaryPredicate> | |
bool all_of (InputIterator first, InputIterator last, UnaryPredicate pred); | |
template <class InputIterator, class UnaryPredicate> | |
bool any_of (InputIterator first, InputIterator last, UnaryPredicate pred); | |
template <class InputIterator, class UnaryPredicate> | |
bool none_of (InputIterator first, InputIterator last, UnaryPredicate pred); |
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
""" | |
Solve OpenAI Gym Cartpole V1 with DQN. | |
""" | |
import gym | |
import numpy as np | |
import tensorflow as tf | |
class DeepQLearningAgent(object): |
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
""" | |
Solve OpenAI Gym Cartpole V0 with DQN. | |
""" | |
import gym | |
import numpy as np | |
import tensorflow as tf | |
class DeepQLearningAgent(object): |
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
""" | |
Solve OpenAI Gym Cartpole V0 with DQN. | |
""" | |
import gym | |
import numpy as np | |
import tensorflow as tf | |
class DeepQLearningAgent(object): |