Skip to content

Instantly share code, notes, and snippets.

---
title: "Airport Wi-Fi"
author: ""
date: "`r sprintf('Last run: %s', format(Sys.time(), '%d %B, %Y'))`"
output:
html_document:
code_download: true
---
```{r setup, include=FALSE}
@fototo
fototo / joy.ipynb
Created July 31, 2017 00:46 — forked from sjsrey/joy.ipynb
Exploring joy plots for use in regional income inequality dynamics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fototo
fototo / joyplot.py
Created July 31, 2017 00:46 — forked from ljwolf/joyplot.py
Joyplotting in python
def joyplot(data, ax=None,
flatten = .1, #rescale the height of each distribution to avoid overlap. If large, will flatten out each of the KDEs
linecolor='k',
shadecolor='w',
alpha=1,
shade=True,
line_kws = None,
kde_kws=None,
fig_kws=None,
shade_kws=None):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Only including this file so the title of the gist isn't `.gitignore`
library(tigris)
library(tidycensus)
library(tidyverse)
library(sf)
ma_income <- get_acs(geography = "county subdivision",
variables = "B19013_001",
state = "MA")
ma_subs <- county_subdivisions(state = "MA", cb = TRUE, class = "sf") %>%

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.

# taken from https://medium.com/@pouryaayria/k-fold-target-encoding-dfe9a594874b
from sklearn import base
from sklearn.model_selection import KFold
class KFoldTargetEncoderTrain(base.BaseEstimator,
base.TransformerMixin):
def __init__(self,colnames,targetName,
n_fold=5, verbosity=True,
discardOriginal_col=False):
self.colnames = colnames
#Calibration and Holdouts periods for data split
date_start = ['2013-04-01','2014-04-01','2015-04-01','2016-04-01']
calibration_period_end = ['2015-03-31','2016-03-31','2017-03-31','2018-03-31']
date_end = ['2016-03-31','2017-03-31','2018-03-31','2019-03-31']
#Arrays where to store the results of cross validation
accuracies_1y = []
holdouts_1y = []
predictions_1y = []
@fototo
fototo / india_historical_map.R
Created July 11, 2020 17:52 — forked from tylermorganwall/india_historical_map.R
Historical Map of India with 3D elevation
library(raster)
library(rayshader)
#Load QGIS georeference image (see https://www.qgistutorials.com/en/docs/3/georeferencing_basics.html)
testindia = raster::stack("1870_southern-india_modified.tif")
#Set bounding box for final map (cut off edges without data, introduced via reprojection)
india_bb = raster::extent(c(68,92,1,20))
cropped_india = raster::crop(testindia, india_bb)
#Convert to RGB array