Skip to content

Instantly share code, notes, and snippets.

View mcohen01's full-sized avatar

Michael Cohen mcohen01

View GitHub Profile
gcloud config set compute/zone us-central1-c
gcloud compute instances create tpu-demo-vm --machine-type=n1-standard-4 --boot-disk-size=500GB --image-project=ml-images --image-family=tf-1-8 --scopes=cloud-platform
gcloud beta compute tpus create demo-tpu --range=10.240.1.0/29 --version=1.13 --network=default
gcloud compute ssh tpu-demo-vm
export TPU_NAME="demo-tpu"
import json
import numpy as np
import pandas as pd
import glob
from PIL import Image
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
{'activities-heart': [{'dateTime': '2019-05-01', 'value': {'customHeartRateZones': [], 'heartRateZones': [{'caloriesOut': 101.92, 'max': 87, 'min': 30, 'minutes': 29, 'name': 'Out of Range'}, {'caloriesOut': 157.248, 'max': 122, 'min': 87, 'minutes': 29, 'name': 'Fat Burn'}, {'caloriesOut': 146.72, 'max': 148, 'min': 122, 'minutes': 13, 'name': 'Cardio'}, {'caloriesOut': 252.56, 'max': 220, 'min': 148, 'minutes': 19, 'name': 'Peak'}]}}], 'activities-heart-intraday': {'dataset': [{'time': '00:00:13', 'value': 65}, {'time': '00:00:28', 'value': 65}, {'time': '00:00:43', 'value': 65}, {'time': '00:00:58', 'value': 65}, {'time': '00:01:13', 'value': 65}, {'time': '00:01:28', 'value': 65}, {'time': '00:01:32', 'value': 65}, {'time': '00:01:47', 'value': 65}, {'time': '00:02:02', 'value': 65}, {'time': '00:02:17', 'value': 65}, {'time': '00:02:32', 'value': 65}, {'time': '00:02:47', 'value': 65}, {'time': '00:03:02', 'value': 65}, {'time': '00:03:17', 'value': 65}, {'time': '00:03:32', 'value': 65}, {'time': '00:03
main {
max-width: 38rem;
padding: 2rem;
margin: auto;
}
/*
https://jrl.ninja/etc/1/
https://jgthms.com/web-design-in-4-minutes/#centering
https://news.ycombinator.com/item?id=19607169
2018-12-17 00:00:00 22
2018-12-17 01:00:00 26
2018-12-17 02:00:00 23
2018-12-17 03:00:00 25
2018-12-17 04:00:00 201
2018-12-17 05:00:00 17
2018-12-17 06:00:00 18
2018-12-17 07:00:00 27
2018-12-17 08:00:00 54
2018-12-17 09:00:00 37
library(forecast)
hourly_boots <- read.csv('hourly_boots.csv', header = F)
names(hourly_boots) <- c('time', 'value')
ts.index <- seq(from = as.POSIXct("2018-12-17 00:00"),
to = as.POSIXct("2019-03-09 23:00"),
by="hour")
periods <- msts(hourly_boots$value, seasonal.periods = c(24, 24*7))
2018-12-17 00:00:00 22
2018-12-17 01:00:00 26
2018-12-17 02:00:00 23
2018-12-17 03:00:00 25
2018-12-17 04:00:00 201
2018-12-17 05:00:00 17
2018-12-17 06:00:00 18
2018-12-17 07:00:00 27
2018-12-17 08:00:00 54
2018-12-17 09:00:00 37
riders = {
'maverick': '''2:01.521 2:00.543 2:08.984 7:53.953 2:00.500 2:00.419 2:00.353 2:08.864 5:51.848 2:00.120 2:06.770 2:08.161 9:52.259 2:03.576 2:00.641 2:06.417 2:00.254 2:00.252 2:00.217 2:00.166 2:00.038 2:13.137 17:08.751 2:01.849 2:00.964 2:06.733 9:42.350 2:01.038 2:00.784 2:01.367 2:07.549 24:39.555 1:59.863 1:59.597 2:05.496 2:00.062 1:59.883 1:59.960 1:59.817 1:59.828 1:59.677 2:15.620 3:44:30.822 2:01.945 2:01.636 2:06.572 9:19.397 2:01.612 2:01.347 2:06.824 22:17.000 2:06.718 10:45.492 2:01.019 2:00.874 2:13.634 10:16.528 2:00.417 2:03.570 5:31.109 1:58.897 2:19.867''',
'rins': '''2:02.779 2:00.252 2:00.333 2:00.085 2:16.415 11:01.027 2:00.839 2:00.884 2:00.368 2:15.964 15:53.040 2:02.111 1:59.978 2:00.418 2:20.209 25:23.315 2:00.811 2:00.327 2:00.160 2:21.776 15:53.420 2:01.575 2:00.384 2:00.848 2:20.687 30:34.733 2:01.857 2:00.412 2:00.544 2:18.916 12:19.015 2:01.598 2:01.679 2:10.196 3:08:39.528 2:03.096 2:00.363 2:00.273 2:00.346 2:10.362 11:24.587 2:00.415 2:00.212 2:00.481 2:
filename divorce 'divorce.txt';
data divorce;
infile divorce;
input id heduc heblack mixed status time;
run;
proc lifetest data=divorce plots=s graphics;
time time * status(0);
run;
9 1 0 0 0 10.546
11 0 0 0 0 34.943
13 0 0 0 1 2.834
15 0 0 0 1 17.532
33 1 0 0 0 1.418
36 0 0 0 0 48.033
43 2 0 0 0 16.706
47 0 0 0 0 24.999
50 0 0 0 0 24.999
56 0 1 0 0 3.869