Skip to content

Instantly share code, notes, and snippets.

View ceshine's full-sized avatar

CeShine Lee ceshine

View GitHub Profile
@harahu
harahu / frozen_lake_q_learning.py
Created October 10, 2016 20:04
Q-learning on the Frozen Lake domain
import gym, random
LEARNING_RATE = 0.1
DISCOUNT = 0.99
class qTable:
"""
Implements a table tracking the estimated values
for state action pairs in an MDP.
"""

Note: I'm updating this gist as I encounter new reviews, so make sure you're reading the latest revision!

Just as the previous year I collected (and keep doing so) links to various summaries and takeaways from this year's NIPS.

@sbos
sbos / HMM.jl
Created November 1, 2013 11:25
Hidden Markov Model in Julia
module HMM
using Distributions
import Distributions.rand
import Distributions.fit
immutable HiddenMarkovModel{TP, K}
theta::Vector{TP}
A::Matrix{Float64}
@superMDguy
superMDguy / add_weather.py
Last active February 24, 2018 20:47
Adds weather data to dataset for kaggle "Recruit Restaurant Visitor Forecasting" competition
train.visit_date = pd.to_datetime(train.visit_date)
test.visit_date = pd.to_datetime(test.visit_date)
def add_weather(dataset):
print('Adding weather...')
air_nearest = pd.read_csv(
'../../data/raw/weather/air_store_info_with_nearest_active_station.csv')
unique_air_store_ids = list(dataset.air_store_id.unique())
weather_dir = '../../data/raw/weather/1-1-16_5-31-17_Weathe
@ceshine
ceshine / sample.py
Created July 31, 2015 04:48
Script for Sampling from Stdin
#!/usr/bin/env python
# sample: Output lines from stdin to stdout with a given probability,
# for a given duration, and with a given delay between lines.
#
# Example usage: seq 100 | sample -r 20% -d 1000
#
# Dependency: Python 2.5
#
# Original Author: http://jeroenjanssens.com
# Original Script: https://github.com/jeroenjanssens/data-science-at-the-command-line/blob/master/tools/sample
@shgidi
shgidi / plot_loss+sample.py
Created July 12, 2017 10:30
plots loss in keras, additionally plots segmentation in image
#https://gist.github.com/stared/dfb4dfaf6d9a8501cd1cc8b8cb806d2e
class PlotLosses(keras.callbacks.Callback):
def __init__(self,imgs):
super(PlotLosses, self).__init__()
self.imgs=imgs
def on_train_begin(self, logs={}):
self.i = 0
self.x = []
@szilard
szilard / SparkR-datatable-aggr100M.txt
Last active April 3, 2019 20:58
SparkR vs data.table - aggregate 100M records
data.table vs SparkR
group-by aggregate on 100M records (1M groups)
data.table 6.5 sec (without key) / 1.3 sec (with key) - all 1 core
SparkR cached 200 sec (8 cores)
30x / 150x ( 240x / 1200x per core)
@ceshine
ceshine / python_in_visual_studio_code.md
Last active August 5, 2019 09:30
How To Develop Python Programs in Visual Studio Code

How To Develop Python Programs in Visual Studio Code

Prerequisites

You have to already have these in your system:

@ceshine
ceshine / spacy_sentencizer.ipynb
Created August 14, 2019 04:46
Customizing Spacy's Statistical Sentence Segmenter with Custom Rules
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / run_tf_glue.ipynb
Last active February 23, 2020 18:50
Train huggingface/transformers BERT model on Colab CPU with TF 2.1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.