Skip to content

Instantly share code, notes, and snippets.

View jskDr's full-sized avatar

Sungjin Kim jskDr

View GitHub Profile
@jskDr
jskDr / tictactoe.py
Last active March 15, 2020 05:42
TieTacToe game agent using a kind of reinforcement learning algorithms
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import pickle
# TicTacToe game has nine stateus with nine actions. An user can put his ston on any postion in the borad except
def set_state_inplace(S, action, P_no):
''' S is numpy array.'''
assert S[action] == 0, 'position should be empty to put a new stone'
@jskDr
jskDr / single_linkedlist.py
Created January 25, 2020 15:31
Single LinkedList - Testing for inserting and deleting
class LinkedList:
def __init__(self, d):
self.d = d
self.r = None
def append(self, d):
self.r = LinkedList(d)
def print_list(alist):
@jskDr
jskDr / minimal_AC_RL.ipynb
Last active November 23, 2019 09:32
High-level implementation of ActorCritic with minimal typing (General implementation)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jskDr
jskDr / pg_both_tf2_torch.ipynb
Last active October 26, 2019 16:20
Comparion policy gradient codes implemented by TF 2.0 and PyTorch based on https://medium.com/@hamza.emra/reinforcement-learning-with-tensorflow-2-0-cca33fead626
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jskDr
jskDr / Actor-Crtic_no_detached_pytorch.ipynb
Created October 3, 2019 15:11
Acotor Critic witout using detached() in PyTorch - It leads one loss function for both actor and critic networks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jskDr
jskDr / Actor-Crtic_detached_pytorch.ipynb
Last active October 3, 2019 15:04
Actor-Critic implemented by PyTorch, separated loss formulations are used for actor and critic agents.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jskDr
jskDr / policy_gradient_by_pytorch.ipynb
Last active October 3, 2019 14:08
Policy gradient code written by PyTorch where the number of batches is larger than one
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jskDr
jskDr / pg_james.ipynb
Created September 29, 2019 13:36
Policy Gradient with PyTorch and Python Class Structure
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jskDr
jskDr / GPR_ex_in_sklearn.ipynb
Created June 8, 2018 17:57
GP Regression Example in Sklearn Document
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
#AlexNet with batch normalization in Keras
#input image is 224x224
model = Sequential()
model.add(Convolution2D(64, 3, 11, 11, border_mode='full'))