Skip to content

Instantly share code, notes, and snippets.

View MaxHalford's full-sized avatar

Max Halford MaxHalford

View GitHub Profile
@MilesCranmer
MilesCranmer / matrix_box_notation.tex
Last active February 9, 2021 10:49
Draw boxes for matrices in equation
%Make sure to have \usepackage{tikz}
%https://tex.stackexchange.com/a/45815/140440 - for grid
%https://tex.stackexchange.com/a/381175/140440 - for alignment in equation
% This function draws a matrix.
\newcommand{\mat}[2]{% cols, rows
\vcenter{\hbox{ %Vertical alignment
\begin{tikzpicture}[scale=0.3, align=center]
@PetrochukM
PetrochukM / hyperband.py
Last active April 11, 2023 06:39
Here we implement hyperband and successive halving adaptions. We found that the original hyperband implementation was messy and not tested. We also wanted to adapt it to include model reuse.
"""
We implement additional hyperparameter optimization methods not present in
https://scikit-optimize.github.io/.
Gist: https://gist.github.com/Deepblue129/2c5fae9daf0529ed589018c6353c9f7b
"""
import math
import logging
import random
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@GaelVaroquaux
GaelVaroquaux / map_wrapper.pyx
Created October 17, 2012 10:31
Wrapping CPP map container to a dict-like Python object
"""
Uses C++ map containers for fast dict-like behavior with keys being
integers, and values float.
"""
# Author: Gael Varoquaux
# License: BSD
# XXX: this needs Cython 17.1 or later. Elsewhere you will get a C++ compilation error.
import numpy as np
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@hgmnz
hgmnz / query_planner.markdown
Created March 23, 2011 14:14
PostgreSQL query plan and SQL performance notes

Types of index scans

Indexes

Sequential Scan:

  • Read every row in the table
  • No reading of index. Reading from indexes is also expensive.