Skip to content

Instantly share code, notes, and snippets.

Avatar

Ricardo Guerrero Gómez-Olmedo ricgu8086

View GitHub Profile
View Debug Jupyter Notebook.py
from IPython.core.debugger import Tracer;
# Place this call wherever you want to start debugging
Tracer()()
"""
Some PDB Debuger commands:
n(ext) line and run this one
c(ontinue) running until next breakpoint
@ricgu8086
ricgu8086 / readme.md
Created Oct 16, 2016 — forked from baraldilorenzo/readme.md
VGG-16 pre-trained model for Keras
View readme.md

##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
View gist:1775ad401ff2b4a97cddb4d40acfdbb8

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

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

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@ricgu8086
ricgu8086 / plot_nulls.py
Last active Jun 23, 2019
A function to plot percentage of nulls in a dataframe (using seaborn and matplotlib)
View plot_nulls.py
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)
ax.xaxis.set_ticks_position('top')
View diversity_percentage.py
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:
View matplotlib_aws_emr.py
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
@ricgu8086
ricgu8086 / xor_keras.py
Created Sep 16, 2016 — forked from cburgdorf/xor_keras.py
Comparing XOR between tensorflow and keras
View xor_keras.py
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'))