Uncategorized

Hackerakademi Øvelsesoperation på Mac med Apple Silicon hardware

Der er ingen spoilers i denne vejledning. Den er udelukkende skrevet så du kan starte FE’s øvelsesoperation på en Mac med Apple Silicon hardware. Den officielle vejledning virker nemlig ikke til den type computer. Her er hvordan jeg fik det til at virke. Læs mere om øvelsen her: https://hackerakademi.dk/challenge Start VM på en Mac med […]

Hackerakademi Øvelsesoperation på Mac med Apple Silicon hardware Read More »

How to Draw an Owl

Taken from lecture 1 of Statistical Rethinking course (around the 44 minute mark). The course material is also on Github. How to draw an "owl" version 1: Create generative simulation (GS) Write an estimator Validate estimator using simulated data Analyze real data: … Reuse 1 to compute hypothetical interventions How to draw an "owl" version

How to Draw an Owl Read More »

How to call an API from PySpark (in workers)

Tested in Databricks import pyspark.sql.functions as F import requests # create dataframe pokenumbers = [(i,) for i in range(100)] cols = ["pokenum"] df_pokenums = spark.createDataFrame(data=pokenumbers, schema=cols) # call API def get_name(rows): # take the first item in list (API doesn't support batch) first = rows[0] url = f'https://pokeapi.co/api/v2/pokemon-form/{first.pokenum}' try: resp = requests.get(url) name = resp.json()['pokemon']['name']

How to call an API from PySpark (in workers) Read More »

Good Book, Bad Program

Programming is like writing a book. Both programs and books are written in a language, e.g. Datalog or Tagalog, but the similarity goes deeper than that. Imagine that you must write a book with the subject "a man walks his dog". There are endless ways to write that book, but only a few of them

Good Book, Bad Program Read More »

Create a European city map with population density

Datasets: – Urban morphological zones 2000 (EU): https://www.eea.europa.eu/data-and-maps/data/urban-morphological-zones-2000-2 – Population count (World): http://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-count-rev10/ – Administrative regions (World): http://gadm.org/ The map is European since the “urban” data from the European Environmental Agency (EEA) only covers Europe. Caveats The UMZ data ended up in PostGIS with srid 900914. You can use prj2epsg.org to convert the contents of

Create a European city map with population density Read More »