Skip to content

Instantly share code, notes, and snippets.

Richard Weiss ririw

Block or report user

Report or block ririw

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
@ririw
ririw / install-gpu.sh
Last active Dec 26, 2017
Quick script to set up a GPU env on my desktop machine
View install-gpu.sh
# Thanks Fast.AI
# Based on their apache-2.0 licensed script
# https://github.com/fastai/courses/blob/master/setup/install-gpu.sh
#
set -e
# This script is designed to work with ubuntu 16.04 LTS
# ensure system is updated and has basic build tools
sudo apt-get update
sudo apt-get --assume-yes upgrade
@ririw
ririw / ztp.py
Created Oct 18, 2017
PYMC3 Zero truncated poisson distribution
View ztp.py
import pymc3 as pm
from pymc3.distributions.dist_math import bound, logpow, factln
from pymc3.distributions import draw_values, generate_samples
import theano.tensor as tt
import numpy as np
import scipy.stats.distributions
class ZTP(pm.Discrete):
def __init__(self, mu, *args, **kwargs):
super().__init__(*args, **kwargs)
@ririw
ririw / main.cpp
Created Oct 9, 2017
Rebecca code
View main.cpp
#include "Arduino.h"
#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach(0);
Serial.begin(9600);
}
void loop()
@ririw
ririw / RWA.py
Created Apr 16, 2017
Recurrent Weighted Average RNN in pytorch
View RWA.py
# An implementation of "Machine Learning on Sequential Data Using a Recurrent Weighted Average" using pytorch
# https://arxiv.org/pdf/1703.01253.pdf
#
#
# This is a RNN (recurrent neural network) type that uses a weighted average of values seen in the past, rather
# than a separate running state.
#
# Check the test code at the bottom for an example of usage, where you can compare it's performance
# against LSTM and GRU, at a classification task from the paper. It handily beats both the LSTM and
# GRU :)
@ririw
ririw / repeater.py
Last active Jun 16, 2016
A repeat layer for lasagne
View repeater.py
## THIS IS WRONG, it'll return the wrong shape. I'll need
## to tweak it to make it work
#class Repeat(lasagne.layers.Layer):
# def __init__(self, incoming, n, **kwargs):
# super(Repeat, self).__init__(incoming, **kwargs)
# self.n = n
#
# def get_output_shape_for(self, input_shape):
# return tuple([self.n] + list(input_shape))
#
View example.py
def new_folder(folder_name, content_type, parentID, key=None, read_only=False, allow_children=True):
if key is None:
key = folder_name
View gist:38c58f62ce345c251046
interface Functor {
fmap: (any) => any;
}
interface Monad extends Functor {
bind: (any) => Monad;
}
interface Maybe extends Monad {
}
@ririw
ririw / Compilation and running
Last active Jan 1, 2016
New version of reader code
View Compilation and running
ghc -O2 -rtsopts -threaded -prof -fprof-auto -fforce-recomp reader.hs
time ./reader +RTS -K1G -sstderr -pa -A3M
@ririw
ririw / Compilation & running
Last active Jan 1, 2016
Space inefficient program
View Compilation & running
ghc -O2 -rtsopts -threaded -prof -fprof-auto -fforce-recomp reader.hs
time ./reader +RTS -K1G -sstderr -pa -A3M
You can’t perform that action at this time.