Skip to content

Instantly share code, notes, and snippets.

View twolodzko's full-sized avatar

Timothy Wolodzko twolodzko

View GitHub Profile
@twolodzko
twolodzko / holt.stan
Last active March 26, 2018 06:50
Holt time-series forecasting in Stan
data {
int<lower=3> n;
vector[n] y;
int<lower=0> h;
}
parameters {
real<lower=0, upper=1> alpha;
real<lower=0, upper=1> beta;
real<lower=0> sigma;
vector[2] mu_init;
@twolodzko
twolodzko / bayesian-ab-example.R
Created March 26, 2018 14:22
Bayesian A/B testing with Bayesian updating using beta-binomial model
library(ggplot2)
set.seed(123)
# simulated data
n <- 100
nx <- ny <- 500
x <- rbinom(n, nx, 0.22)
y <- rbinom(n, ny, 0.21)
@twolodzko
twolodzko / ALS Matrix Factorization in Spark.ipynb
Last active July 1, 2023 23:33
Using ALS Matrix Factorization for Making Recommendations in Spark
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twolodzko
twolodzko / data-philly-april-2018-bayes-bandits.ipynb
Created April 4, 2018 08:03 — forked from AustinRochford/data-philly-april-2018-bayes-bandits.ipynb
Data Philly April 2018 - Two Years of Bayesian Bandits for E-Commerce
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twolodzko
twolodzko / RadialBasisFunctions.py
Last active June 12, 2018 08:53
Radial Basis Functions Features for Time-Series Data
from __future__ import print_function
import numpy as np
class RadialBasisFunctions(object):
"""Radial Basis Functions features for time-series data
Parameters
----------
@twolodzko
twolodzko / TensorFlow Recommender on The Movies Dataset.ipynb
Last active June 27, 2018 10:17
Matrix Factorization Using TensorFlow on The Modies Dataset
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twolodzko
twolodzko / popularity_encoder.py
Last active July 16, 2018 09:03
Encode words according to popularity in the reference vocabluary
from collections import Counter
class PopularityEncoder(object):
def __init__(self, vocab_size=50000):
"""Encode words according to popularity index
Parameters
----------
@twolodzko
twolodzko / hyperopt-prophet-tutorial.ipynb
Last active April 12, 2020 17:19
Hyperparameter tuning using `hyperopt` package
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twolodzko
twolodzko / prune-sklearn-tree.py
Created August 1, 2018 10:36
Prune sklearn decision tree
# source: https://github.com/scikit-learn/scikit-learn/issues/10810#issuecomment-373164104
import copy
def prune(tree):
tree = copy.deepcopy(tree)
dat = tree.tree_
nodes = range(0, dat.node_count)
ls = dat.children_left
rs = dat.children_right
@twolodzko
twolodzko / examples-from-building-autoencoders-in-keras.ipynb
Created August 2, 2018 09:04
Examples from Building Autoencoders in Keras.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.