Skip to content

Instantly share code, notes, and snippets.

Tegg Sung tegg89

Block or report user

Report or block tegg89

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tegg89
tegg89 / dqn_fruit.py
Created Mar 5, 2019 — forked from kastnerkyle/dqn_fruit.py
Implementation of DQN, Double DQN, Bootstrap DQN, and Bootstrap DQN with Randomized Prior in PyTorch on a toy environment
View dqn_fruit.py
# extending on code from
# https://github.com/58402140/Fruit
import os
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
import copy
import time
from collections import Counter
View mnist.py
from sklearn.datasets import fetch_mldata
import urllib
import scipy
try:
mnist = fetch_mldata('MNIST original')
except urllib.error.HTTPError as ex:
print("Could not download MNIST data from mldata.org, trying alternative...")
# Alternative method to load MNIST, if mldata.org is down
@tegg89
tegg89 / estimator.md
Created Oct 18, 2018
How to use tf.estimator
View estimator.md

tf.estimator

The Estimator is a high-level API that is officially provided by TensorFlow. One of the advantages of using tf.estimator is that the code automatically builds a graph and a tensorboard itself. A user only needs to specify required arguments, such as features, optimizer, and labels, and plug into the estimator class. Just like PyTorch, the Estimator can easily switch to training, evaluation, or test modes without creating individual methods. Also, estimators are built upon the tf.keras.layers which simplifies the customization. It is preferred to know the Estimator usage because TensorFlow offers TPUEstimator which extends to the Estimator class.

The entire structure of constructing estimator model is shown below.

def model_fn(features, targets, mode, params):
View Amortized_Explaining_Away_Demo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tegg89
tegg89 / GMM.ipynb
Created Sep 11, 2018
GMM in PyTorch
View GMM.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View visualization.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View prediction_eval.py
import numpy as np
import tensorflow as tf
import os
from tensorflow.python.platform import app
from tensorflow.python.platform import flags
from prediction_input import build_tfrecord_input
from prediction_model import construct_model
View prediction_input.py
# Copyright 2016 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@tegg89
tegg89 / min-char-rnn.py
Created Jun 28, 2016 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
You can’t perform that action at this time.