Skip to content

Instantly share code, notes, and snippets.


Ricardo Guerrero Gómez-Olmedo ricgu8086

View GitHub Profile
import pylab as plt
plt.plot([1,2,3,10], [1,2,3,4])
%matplot plt # Include this in the same cell as the plot
def diversity_percentage(df, columns):
This function returns the number of different elements in each column as a percentage of the total elements in the group.
A low value indicates there are many repeated elements.
Example 1: a value of 0 indicates all values are the same.
Example 2: a value of 100 indicates all values are different.
diversity = dict()
for col in columns:
ricgu8086 /
Last active Jun 23, 2019
A function to plot percentage of nulls in a dataframe (using seaborn and matplotlib)
def plot_nulls(dataframe):
def null_perc(dataframe):
return 100*dataframe.isnull().sum()/len(dataframe)
nulls = null_perc(dataframe)
plt.figure(1, figsize=(5,20)) # Customize this if needed
ax = sns.barplot(x=nulls, y=list(range(len(nulls))), orient='h', color="blue")
_ = plt.yticks(plt.yticks()[0], nulls.index)
View gist:1775ad401ff2b4a97cddb4d40acfdbb8

1. Clone your fork:

git clone

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://
git fetch upstream
View Debug Jupyter
from IPython.core.debugger import Tracer;
# Place this call wherever you want to start debugging
Some PDB Debuger commands:
n(ext) line and run this one
c(ontinue) running until next breakpoint
ricgu8086 /
Created Oct 16, 2016 — forked from baraldilorenzo/
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
ricgu8086 /
Created Sep 16, 2016 — forked from cburgdorf/
Comparing XOR between tensorflow and keras
import numpy as np
from keras.models import Sequential
from keras.layers.core import Activation, Dense
from keras.optimizers import SGD
X = np.array([[0,0],[0,1],[1,0],[1,1]], "float32")
y = np.array([[0],[1],[1],[0]], "float32")
model = Sequential()
model.add(Dense(2, input_dim=2, activation='sigmoid'))