Skip to content

Instantly share code, notes, and snippets.

@rouseguy
rouseguy / recsys.txt
Last active September 8, 2019 03:03
List of libraries needed for rec sys workshop
absl-py==0.8.0
altair==3.2.0
annoy==1.16.0
appnope==0.1.0
asn1crypto==0.24.0
astor==0.8.0
attrs==19.1.0
backcall==0.1.0
bleach==3.1.0
blis==0.2.4
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import pandas as pd
import altair as alt
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Helper to get the labels for each class of Fashion Mnist
def fashion_mnist_label():
labels = {
X = np.zeros((int(len(data)/SEQ_LENGTH), SEQ_LENGTH, VOCAB_SIZE))
y = np.zeros((int(len(data)/SEQ_LENGTH), SEQ_LENGTH, VOCAB_SIZE))
for i in range(0, int(len(data)/SEQ_LENGTH)):
X_sequence = data[i*SEQ_LENGTH:(i+1)*SEQ_LENGTH]
X_sequence_ix = [char_to_ix[value] for value in X_sequence]
input_sequence = np.zeros((SEQ_LENGTH, VOCAB_SIZE))
for j in range(SEQ_LENGTH):
input_sequence[j][X_sequence_ix[j]] = 1.
X[i] = input_sequence
import numpy as np
def input_generate_data(data, SEQ_LENGTH=20, VOCAB_SIZE=30, char_to_ix = {}):
X = np.zeros((int(len(data)/SEQ_LENGTH), SEQ_LENGTH, VOCAB_SIZE))
y = np.zeros((int(len(data)/SEQ_LENGTH), SEQ_LENGTH, VOCAB_SIZE))
for i in range(0, int(len(data)/SEQ_LENGTH)):
X_sequence = data[i*SEQ_LENGTH:(i+1)*SEQ_LENGTH]
X_sequence_ix = [char_to_ix[value] for value in X_sequence]
import numpy as np
def input_generate_data(data, SEQ_LENGTH=SEQ_LENGTH, VOCAB_SIZE=VOCAB_SIZE, char_to_ix = char_to_ix):
X = np.zeros((int(len(data)/SEQ_LENGTH), SEQ_LENGTH, VOCAB_SIZE))
y = np.zeros((int(len(data)/SEQ_LENGTH), SEQ_LENGTH, VOCAB_SIZE))
for i in range(0, int(len(data)/SEQ_LENGTH)):
X_sequence = data[i*SEQ_LENGTH:(i+1)*SEQ_LENGTH]
X_sequence_ix = [char_to_ix[value] for value in X_sequence]
@rouseguy
rouseguy / helpers.py
Last active March 10, 2018 05:12
helper functions for the deep learning workshop
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import keras
from tensorflow.examples.tutorials.mnist import input_data
import os
# Helper to get the labels for each class of Fashion Mnist
def fashion_mnist_label():
labels = {
import numpy as np
def fizzbuzz(number):
if number % 15 == 0:
return np.array(["fizzbuzz"], dtype="object")
elif number % 5 == 0:
return np.array(["buzz"], dtype="object")
elif number % 3 == 0:
return np.array(["fizz"], dtype="object")
else:
@rouseguy
rouseguy / zshrc
Created August 9, 2017 18:56
zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/bsubrama/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
@rouseguy
rouseguy / vimrc
Created August 9, 2017 18:53
vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
syntax enable
set background=light
let g:solarized_contrast="high"
colorscheme solarized
set guifont=Hack:h20
set showmatch