Skip to content

Instantly share code, notes, and snippets.

View danielkelshaw's full-sized avatar
:octocat:
Approximating the Posterior

Daniel Kelshaw danielkelshaw

:octocat:
Approximating the Posterior
View GitHub Profile
import enum
import torch
import torch.nn as nn
import numpy as np
import einops
import opt_einsum as oe
import itertools as it
import h5py
import enum
import torch
import numpy as np
import einops
import opt_einsum
import operator

Basic example of using C++ for a HT simulation.

PSO Introduction

Particle Swarm Optimisation (PSO) is a fairly simple population-based, gradient-free, optimisation technique which can be used on a variety of problems. This Gist serves as a basic introduction to the topic.

Qualitative Overview

Imagine that you and 49 friends are lost in a mountain range. Your objective is to try and reach the lowest point - however there are a few challenges:

Python | IDE Guide

When developing Python you need an editor to work within. There are many different options but the one I would recommend is PyCharm.

As a student you can get access to PyCharm Professional, otherwise you can just download the standard PyCharm Community Edition - once you've done this you're ready to start.

Setting up PyCharm

Python | Jupyter Lab Guide

Jupyter Lab is an excellent tool which allows you to develop Python code interactively. This is a great way to learn the language as you can test short snippets of code and see the output immediately.

Assuming you have python installed, installing Jupyter Lab should be as easy fairly easy.

This guide provides a great overview - take a look at this if the steps below don't work for you.

Python Virtual Environments

When developing code it is important to know which versions of libraries you are using. This is not only helpful for yourself but ensures that everyone working on a project is working with exactly the same toolset. Although it may seem like a headache at first it saves a lot of pain further down the road so it's good to get accustomed to the process.

As you may have installed Python through Anaconda or PyEnv, I will provide two sets of instructions that will allow you to make an environment for each one.

@danielkelshaw
danielkelshaw / kdtree.h
Last active February 12, 2020 16:02
KdTree Implementation
#include <vector>
#include <cmath>
struct Node {
std::vector<float> point;
int id;
Node* left;
Node* right;