Skip to content

Instantly share code, notes, and snippets.

View yrevar's full-sized avatar

yrevar

View GitHub Profile
import os
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import matplotlib as mpl
# plot title
mpl.rcParams['axes.titlesize'] = 18
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yrevar
yrevar / matplotlib_cheat_sheet.ipynb
Last active April 11, 2019 21:35
Matplotlib Cheat Sheet. Adapted from: Hilpisch, Y. (2012).
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@extrospective
extrospective / gist:0f4fe69304184d813f982035d9684452
Last active October 28, 2020 18:13
Seaborn stacked bar chart (extending Randy Zwitch approach)
def stacked_bar_chart(pivoted_df, stack_vals, level_values_field, chart_title, x_label, y_label, filename, color1, color2):
#
# stacked_bar_chart: draws and saves a barchart figure to filename
#
# pivoted_df: dataframe which has been pivoted so columns correspond to the values to be plotted
# stack_vals: the column names in pivoted_df to plot
# level_values_field: column in the dataframe which has the values to be plotted along the x axis (typically time dimension)
# chart_title: how to title chart
# x_label: label for x axis
# y_label: label for y axis
@kukuruza
kukuruza / gist_cifar10_train.py
Last active March 4, 2021 01:58
Tensorflow: visualize convolutional filters (conv1) in Cifar10 model
from math import sqrt
def put_kernels_on_grid (kernel, pad = 1):
'''Visualize conv. filters as an image (mostly for the 1st layer).
Arranges filters into a grid, with some paddings between adjacent filters.
Args:
kernel: tensor of shape [Y, X, NumChannels, NumKernels]
pad: number of black pixels around each filter (between them)
@baraldilorenzo
baraldilorenzo / readme.md
Last active May 24, 2024 22:09
VGG-16 pre-trained model for Keras

##VGG16 model for Keras

This is the Keras model of the 16-layer network used by the VGG team in the ILSVRC-2014 competition.

It has been obtained by directly converting the Caffe model provived by the authors.

Details about the network architecture can be found in the following arXiv paper:

Very Deep Convolutional Networks for Large-Scale Image Recognition

K. Simonyan, A. Zisserman

@karpathy
karpathy / min-char-rnn.py
Last active May 30, 2024 23:33
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)