Skip to content

Instantly share code, notes, and snippets.

@standarderror
standarderror / Autoencoder.py
Last active September 26, 2016 03:36
20150715 Autoencoder
### Autoencoder
###################################
## [1] Parameters & hyperparameters
###################################
# shape of data
N = shape(X)[1] # num observation
D = shape(X)[0] # num features (dimensionality)
# choose images & plot the first one
im = allX[102:103]
plt.axis('off')
plt.imshow(im[0].astype('uint8'))
plt.gcf().set_size_inches(2, 2)
# run images through 1st conv layer
m2 = tflearn.DNN(conv_1, session=model.session)
yhat = m2.predict(im)
@standarderror
standarderror / SQL to R.txt
Created April 8, 2017 10:26
SQL equivalents in R
SELECT ... FROM a JOIN b WHERE ... GROUP BY ... HAVING ... ORDER BY ...
is equivalent to a chain of R commands involving
a %>%
select(...) %>%
filter(...) %>%
inner_join(b, ...) %>%
group_by(...) %>%
summarise(...) %>%
@standarderror
standarderror / smear.sql
Created August 29, 2017 23:55
Smearing start-end date data
Imagine you have some start-end data:
create table PRD_CAA_CRE_DDWSP_PI6_DPOL.TBL_DATA_1 as (
select ACCT_ID
, START_DATE
, END_DATE
, CURR_CRDT_LIM_AMT
from PRD_ADS_IL_VR.VR_S_ACCT_CRDT_CRD_RAW
sample 1000)
with data;
"""
Based on the tflearn CIFAR-10 example at:
https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_cifar10.py
"""
from __future__ import division, print_function, absolute_import
from skimage import color, io
from scipy.misc import imresize
import numpy as np
@standarderror
standarderror / index.html
Last active September 22, 2020 03:22
20141222 Dewey Decimal treemap
<!DOCTYPE html>
<meta charset="utf-8">
<title>DDC zoomable treemap</title>
<style>
#chart1 {
width: 960px;
height: 500px;
background: #ddd;
/* centre SVG horizontally */
@standarderror
standarderror / 20161112_Neural_Style_TensorFlow.py
Created November 12, 2016 04:26
20161112_Neural_Style_TensorFlow
import os
import numpy as np
import scipy.misc
import scipy.io
import math
import tensorflow as tf
from sys import stderr
from functools import reduce
import time