Skip to content

Instantly share code, notes, and snippets.

View srepho's full-sized avatar

Stephen Oates srepho

  • Allianz
  • Australia
View GitHub Profile

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@srepho
srepho / imdb_cnn_kim_small_embedding.py
Created January 20, 2016 12:06 — forked from entron/imdb_cnn_kim_small_embedding.py
Keras implementation of Kim's paper "Convolutional Neural Networks for Sentence Classification" with a very small embedding size.
'''This scripts implements Kim's paper "Convolutional Neural Networks for Sentence Classification"
with a very small embedding size (20) than the commonly used values (100 - 300) as it gives better
result with much less parameters.
Run on GPU: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python imdb_cnn.py
Get to 0.853 test accuracy after 5 epochs. 13s/epoch on Nvidia GTX980 GPU.
'''
from __future__ import print_function
@srepho
srepho / chainer_lstm.ipynb
Last active August 29, 2015 14:26 — forked from w0nk0/chainer_lstm.ipynb
Beefed up Chainer LSTM example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@srepho
srepho / balltrack.py
Last active August 29, 2015 14:14 — forked from xamox/balltrack.py
'''
This is how to track a white ball example using SimpleCV
The parameters may need to be adjusted to match the RGB color
of your object.
The demo video can be found at:
http://www.youtube.com/watch?v=jihxqg3kr-g
'''
print __doc__
@srepho
srepho / code.R
Created January 22, 2014 01:01 — forked from timelyportfolio/code.R
#do some quick exploration with R
#to see how many years
#the S&P 500 has gone all year
#without going below the first day of the year
require(quantmod)
require(plyr)
require(rCharts)
getSymbols("^GSPC",from = "1950-01-01")
@srepho
srepho / gist:8334782
Last active January 2, 2016 17:09
Men's vs Women's Age when winning first Tennis Grand Slam
{
"metadata": {
"name": "mensvswomensageatfirstgswin.ipynb"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
# -*- coding: utf-8 -*-
""" Small script that shows hot to do one hot encoding
of categorical columns in a pandas DataFrame.
See:
http://scikit-learn.org/dev/modules/generated/sklearn.preprocessing.OneHotEncoder.html#sklearn.preprocessing.OneHotEncoder
http://scikit-learn.org/dev/modules/generated/sklearn.feature_extraction.DictVectorizer.html
"""
import pandas
import random
import matplotlib.pyplot as plt
import numpy as np
figsize(20,8)
#clf is a sklearn classifier e.g. clf = LogisticRegression()
#vecotorizer is a sklearn vectorizer, e.g. vectorizer = TfidfVectorizer()
#let's get the coefficients:
coef = clf.coef_.ravel()
important = np.argsort(np.abs(coef))[-100:]