Skip to content

Instantly share code, notes, and snippets.

View Kaixhin's full-sized avatar
⚗️

Kai Arulkumaran Kaixhin

⚗️
View GitHub Profile
@Kaixhin
Kaixhin / guidelines.md
Last active May 12, 2022 05:29
Student Projects

I supervise undergraduate/postgraduate/UROP projects as part of BICV. The PI, Dr Anil Bharath, has a nice set of FAQs for prospective research students, which should give you an idea of what our group specialises in. My topic of research is deep reinforcement learning, which is less focused on computer vision and more on general machine learning or even artificial intelligence. Note that I only supervise students at Imperial College London, so please do not contact me about supervision otherwise.

I expect students to be a) highly motivated and b) technically proficient.

a) Projects that I supervise revolve around cutting-edge research, and specifically deep learning. Projects can, and have in the past, relied on research released during the course of the project. Some parts of machine learning can be found in optional modules in bioengineering courses, but (modern) deep learning is currently not taught at Imperial (as far as I am aware). I usually give crash

@Kaixhin
Kaixhin / lstms.py
Last active June 18, 2021 01:35
Collection of LSTMs
# Collection of LSTM cells (including forget gates)
# https://en.wikipedia.org/w/index.php?title=Long_short-term_memory&oldid=784163987
import torch
from torch import nn
from torch.nn import Parameter
from torch.nn import functional as F
from torch.nn.modules.utils import _pair
from torch.autograd import Variable
@Kaixhin
Kaixhin / transformer.py
Created April 7, 2018 21:34
The Annotated Transformer
"""
The Annotated Transformer
http://nlp.seas.harvard.edu/2018/04/03/attention.html
Note: Only includes basic example, not real world example or multi-GPU training
"""
import numpy as np
import torch
import torch.nn as nn
@Kaixhin
Kaixhin / plot.py
Last active March 26, 2020 16:26
Tensor plotting functions
from matplotlib import pyplot as plt
from mpl_toolkits import mplot3d
def scatter(X, Y, c=None, ax=None):
ax = plt.axes() if ax is None else ax
ax.scatter(X.numpy(), Y.numpy(), c=None if c is None else c.numpy())
return ax
def contour(X, Y, Z, levels=None, ax=None):
ax = plt.axes() if ax is None else ax
@Kaixhin
Kaixhin / library.md
Last active March 24, 2019 20:44
Manga Vol. 1 Library

Description

I collect the first volumes (and first volumes only) of various manga series (in English) in new condition.

Wishlist

I have an Amazon wishlist, but volumes from other series that I do not have are also welcome. New books only please.

Library

@Kaixhin
Kaixhin / prob-notation.md
Last active November 15, 2018 11:25
Probability notation

Probability notation

Note: Great refresher/glossary on probability/statistics and related topics here

Notation Definition
X Random variable
P(X) Probability distribution over random variable X
X ~ P(X) Random variable X follows (~) the probability distribution P(X) *
@Kaixhin
Kaixhin / acn.py
Created November 5, 2018 18:46
Associative Compression Networks
import os
import torch
from torch import nn, optim
from torch.nn import functional as F
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from torchvision.utils import save_image
class Encoder(nn.Module):
@Kaixhin
Kaixhin / mcts.py
Last active May 23, 2018 22:53
Introduction to Monte Carlo Tree Search
"""
Introduction to Monte Carlo Tree Search
http://jeffbradberry.com/posts/2015/09/intro-to-monte-carlo-tree-search/
"""
from copy import deepcopy
import datetime
from math import log, sqrt
from random import choice
@Kaixhin
Kaixhin / stochasticprocesses.lua
Created November 29, 2016 16:39
Random walks down Wall Street, Stochastic Processes in Python
--[[
-- Random walks down Wall Street, Stochastic Processes in Python
-- http://www.turingfinance.com/random-walks-down-wall-street-stochastic-processes-in-python/
--]]
local gnuplot = require 'gnuplot'
local model_parameters = {
all_s0 = 1000, -- Starting asset value
all_time = 800, -- Amount of time to simulate for
@Kaixhin
Kaixhin / main.py
Last active October 20, 2017 20:19
Device-agnostic PyTorch code
import torch
def cast(cuda):
if cuda:
return lambda x: x.cuda()
else:
return lambda x: x