This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(...) %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Prepeare python | |
%pylab inline | |
import numpy as np | |
import pandas as pd | |
import statsmodels.api as sm | |
import scipy.stats as stats | |
import neurolab as nl | |
from sklearn.datasets import make_classification | |
from sklearn import neighbors, tree, svm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Autoencoder | |
################################### | |
## [1] Parameters & hyperparameters | |
################################### | |
# shape of data | |
N = shape(X)[1] # num observation | |
D = shape(X)[0] # num features (dimensionality) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
#chart { | |
/* margin-left:50%; */ | |
} | |
.circle { | |
stroke: '#fff'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
#chart { | |
} | |
.circle { | |
stroke: '#fff'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null===n?0/0:+n}function e(n){return!isNaN(n)}function r(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function u(n){return n.length}function i(n){for(var t=1;n*t%1;)t*=10;return t}function o(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function a(){this._=Object.create(null)}function c(n){return(n+="")===da||n[0]===ma?ma+n:n}function l(n){return(n+="")[0]===ma?n.slice(1):n}function s(n){return c(n)in this._}function f(n){return(n=c(n))in this._&&delete this._[n]}function h(){var n=[];for(var t in this._)n.push(l(t));return n}function g(){var n=0;for(var t in this._)++n;return n}function p(){for(var n in this._)return!1;return!0}function v(){this._=Object |
NewerOlder