Skip to content

Instantly share code, notes, and snippets.

View rave78's full-sized avatar

Federico Raue rave78

View GitHub Profile
@rave78
rave78 / matplot_parameters.py
Last active August 29, 2015 14:19
Matplotlib parameters in order to generate figures with qualitfy for scientific papers
params = {'backend': 'ps',
'axes.labelsize': 24, # fontsize for x and y labels (was 10)
'axes.titlesize': 24,
'text.fontsize': 24, # was 10
'legend.fontsize': 24, # was 10
'xtick.labelsize': 24,
'ytick.labelsize': 24,
'text.usetex': True,
'figure.figsize': [fig_width,fig_height],
'font.family': 'serif',
@rave78
rave78 / insert_blank_box.tex
Created April 15, 2015 15:14
Insert a frame or blank box as a figure in latex
\begin{figure}
\centering
\fbox{
\begin{minipage}{1in}
\hfill\vspace{1in}
\end{minipage}
}
\caption{Caption}
\end{figure}
@rave78
rave78 / cluster.sh
Created April 21, 2015 13:22
Running a script at the cluster service
bsub -n 1 -R "span[hosts=1]" -R "rusage[mem=19000,tmp=10000]" -R "select[model==XEON_E5_2670]" -We 240:00 -J "./mlp_mnist_1_01.sh"
@rave78
rave78 / latex header
Created October 1, 2015 08:15
useful packages for latex
\DeclareGraphicsExtensions{.png,.pdf}
\graphicspath{{figures/}}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{multirow}
\usepackage{todonotes}
\usepackage{changes}
\definechangesauthor[color=blue]{fr}
@rave78
rave78 / draw_neural_net.py
Created November 29, 2015 08:26 — forked from craffel/draw_neural_net.py
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])
@rave78
rave78 / update.sh
Created February 28, 2018 20:26
Update all installed python packages
#Link https://hackernoon.com/a-pip-hack-to-upgrade-all-your-python-packages-492658c49681
sudo pip2 freeze — local | grep -v ‘^\-e’ | cut -d = -f 1 | xargs -n1 sudo pip2 install -U
@rave78
rave78 / example_sacred.py
Created May 7, 2019 15:03
Minimal example of sacred with pytorch
#!/usr/bin/python
# -*- coding: utf-8 -*-
import random
import math
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
import pickle