Code for Keras plays catch blog post
python qlearn.py
- Generate figures
import numpy as np | |
def linear_part(x, w): | |
return x * w | |
def non_linear(x, p=0.001): | |
multi = (x > 0).astype(np.float64) | |
multi[multi == 0] = 0.001 | |
return x * multi |
pareto_principle <- function(x){ | |
return (x ^ (log(0.2)/log(0.8))) | |
} | |
sprintf("%.2f of the effort comes from %.2f of the causes", 0.99, pareto_principle(0.99)) | |
sprintf("%.2f of the effort comes from %.2f of the causes", 0.95, pareto_principle(0.95)) | |
sprintf("%.2f of the effort comes from %.2f of the causes", 0.8, pareto_principle(0.8)) | |
sprintf("%.2f of the effort comes from %.2f of the causes", 0.5, pareto_principle(0.5)) |
FROM jupyter/r-notebook | |
# docker build --rm -t jupyter/extended-notebook . | |
# docker run --rm -it -p 8888:8888 jupyter/extended-notebook | |
RUN conda install --quiet --yes -c r rstudio=1.1* | |
RUN conda install --quiet --yes -c anaconda pandas scipy gensim scikit-learn | |
# install nbrsessionproxy |
# | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
Code for Keras plays catch blog post
python qlearn.py
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img | |
from keras.models import Sequential | |
from keras.layers import Convolution2D, MaxPooling2D | |
from keras.layers import Activation, Dropout, Flatten, Dense | |
train_data_dir = 'data' | |
img_width, img_height = 150, 150 | |
train_datagen = ImageDataGenerator( |
Topic list:
dir
continue
, enumerate
)in
)get
)**kwargs
, *args
itertool
s and reading the recipes (e.g. list(itertools.chain.from_iterable(a))
)mu <- 2.5 | |
tau <- 0.5 | |
xn <- rnorm(50, mu, 1/tau) | |
# test for convergence | |
library(purrr) | |
mu_i = 0 | |
alpha = 0.01 |
# stolen from stackoverflow, based on how james and i share scripts: | |
import Tkinter, tkSimpleDialog | |
root = Tkinter.Tk() # dialog needs a root window, or will create an "ugly" one for you | |
root.withdraw() # hide the root window | |
password = tkSimpleDialog.askstring("Password", "Enter password:", show='*', parent=root) | |
root.destroy() # clean up after yourself! |
library(tidyverse) | |
data(iris) | |
func <- list(mean=mean, sd=sd, max=max, min=min) | |
fields <- c("Sepal.Length", "Sepal.Width") | |
# usage for one field | |
invoke_map(func, x=unlist(select_(iris, "Sepal.Length"))) %>% data.frame |