Skip to content

Instantly share code, notes, and snippets.

View kkweon's full-sized avatar

Mo Kweon kkweon

View GitHub Profile
@kkweon
kkweon / DDPG.py
Last active April 26, 2018 18:52
Continuous control with deep reinforcement learning (DDPG) https://arxiv.org/abs/1509.02971
"""
Deep Deterministic Policy Gradients (DDPG)
https://arxiv.org/pdf/1509.02971.pdf
TODO: Batch Normalization Bug
"""
import argparse
import random
import numpy as np
import gym
@kkweon
kkweon / policy_gradient.ipynb
Created June 2, 2017 23:01
Policy Gradient Notes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kkweon
kkweon / PAAC.py
Last active June 1, 2017 07:20
Simple PAAC Implementation
"""
Simple implemntation of
"Efficient Parallel Methods for Deep Reinforcement Learning"
https://arxiv.org/abs/1705.04862
"""
import argparse
import tensorflow as tf
import numpy as np
import gym
@kkweon
kkweon / secant.R
Created May 25, 2017 04:51
R secant method
library(ggplot2)
secant <- function(fn) {
a <- -100
b <- 100
for (i in 1:1000) {
numerator <- b * fn(a) - a * fn(b)
denominator <- fn(a) - fn(b) + 1e-9
x <- numerator / denominator
a <- b
@kkweon
kkweon / tensorboard_logging.py
Created May 22, 2017 09:03 — forked from gyglim/tensorboard_logging.py
Logging to tensorboard with manually generated summaries (not relying on summary ops)
"""Simple example on how to log scalars and images to tensorboard without tensor ops."""
__author__ = "Michael Gygli"
import tensorflow as tf
from StringIO import StringIO
import matplotlib.pyplot as plt
import numpy as np
class Logger(object):
"""Logging in tensorboard without tensorflow ops."""
@kkweon
kkweon / simple_a3c.py
Created May 21, 2017 21:41
Simple A3C (distributed tensorflow version is preferred over threading)
import tensorflow as tf
import numpy as np
import threading
import gym
import os
from scipy.misc import imresize
def copy_src_to_dst(from_scope, to_scope):
"""Creates a copy variable weights operation
@kkweon
kkweon / make_gif
Last active May 22, 2017 20:33
Convert video to a high quality gif file using FFMPEG and Bash
#!/usr/bin/env bash
input_video=$1
echo "Input Video: $input_video"
if [ -z "$1" ]; then
read input_video
fi
echo "Skip Second: "
@kkweon
kkweon / policy_gradient.py
Created May 18, 2017 07:17
Keras Policy Gradient Example
"""
Simple policy gradient in Keras
"""
import gym
import numpy as np
from keras import layers
from keras.models import Model
from keras import backend as K
@kkweon
kkweon / sort.cc
Created May 7, 2017 04:34
Sorting 손풀기 연습
#include <iostream>
using namespace std;
int* testCaseGenerator(int n) {
int* result = new int[n];
for(int i = 0; i < n; ++i) {
result[i] = std::rand() % 99;
}
@kkweon
kkweon / jupyter_magic.ipynb
Created May 2, 2017 03:09 — forked from anonymous/jupyter_magic.ipynb
jupyter_magic.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.