Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View thomaspinder's full-sized avatar

Thomas Pinder thomaspinder

View GitHub Profile
@thomaspinder
thomaspinder / slack_notifier.py
Created November 1, 2018 09:48
Slack notifier
"""
If you place this script at the bottom of your Python work, then it'll send you a notification on Slack once your code has finished running. Potentially useful if your code takes several hours to run as it saves having to check on its progress.
To run, you'll need to install the following two libraries:
slackclient==1.2.1
slacker==0.9.65
And then sign up for a Slack API key. Once these two steps have been done you can run the following code, replacing the name and key values with your own.
"""
@thomaspinder
thomaspinder / big_o_complexity.R
Created January 15, 2019 21:38
Using gganimate to visualise the chainging computational complexity as n increases.
library(gganimate)
library(ggplot2)
library(dplyr)
library(reshape2)
# Get base n values
n <- 50
base <- data.frame(idx = seq(2, n, by = 0.01))
# Compute relative runtimes
@thomaspinder
thomaspinder / bbvi-julia.jl
Created February 11, 2019 17:57
Black-Box Variational Inference in Julia (Work in Progress!), based upon https://github.com/daeilkim/bbvi
using Distributions, Random, LinearAlgebra, Plots, StatPlots
Random.seed!(123);
dims = 2
precision_prior = 4
cov_prior = Matrix{Float64}(I, dims, dims)
pre_prior = precision_prior*cov_prior
mu_prior = [-2, -4]
precision_t = 0.5
@thomaspinder
thomaspinder / control_variates.ipynb
Last active July 11, 2019 12:46
Control variates for Monte-Carlo integration in Julia
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomaspinder
thomaspinder / .vimrc
Created September 7, 2020 14:37
Personal vimrc file
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
@thomaspinder
thomaspinder / .tmux.conf
Last active November 3, 2021 16:35
Personal tmux config file
# switch prefix to control-a, unmap b, allow double-a to go through
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# -r repeat time (Default 500 millis)
set -g repeat-time 2000
# colors
set -g default-terminal "screen-256color"
@thomaspinder
thomaspinder / SparseSpectrumGPFlow2
Created November 27, 2020 19:37
Sparse spectrum Gaussian process inmplemented in GPFlow 2.0
import gpflow
import tensorflow as tf
import matplotlib.pyplot as plt
from gpflow.models import GPModel, InternalDataTrainingLossMixin, GPR
from gpflow.kernels import SquaredExponential, Kernel
from gpflow.likelihoods import Gaussian
from gpflow.mean_functions import Zero
from gpflow.base import Parameter
from time import time
from gpflow.utilities import print_summary
figure.figsize: 5.5, 2.5
figure.constrained_layout.use: True
figure.autolayout: False
savefig.bbox: tight
figure.dpi: 120
# Axes
axes.spines.left: True # display axis spines
axes.spines.bottom: True
axes.spines.top: False