Category AI

AI and Work: Five Scenarios, Ordered by Severity

What could happen to European societies, including the one I live in, if current AI impact trends continue under different labor-market scenarios? Everyone has an opinion, but what do economists say? This post organizes economists’ views on AI and work…

Agent Code Generation Part 1: Augment Code

Automate a Causal Inference Python Repo from Scratch with Augment Code If you’ve ever wanted to build a clean Python repository for implementing methods from Causal Inference for the Brave and True but didn’t want to do all the setup…

How to call OpenAI’s ChatGPT API

Here is how you can call OpenAI’s ChatGPT API, given that you have an API key. Follow these instructions to get one. import openai openai.api_key = 'FILL IN YOUR OWN' openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful…

How to scrape images from the web

I’m interested in object detection and other computer vision tasks. For example, I’m working on a teddy-bear detector with my son. So, how do you quickly download images for a certain category? You can use this approach that I learned…

How to sample from softmax with temperature

Here is how to sample from a softmax probability vector at different temperatures. import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import seaborn as sns mpl.rcParams[‘figure.dpi’]= 144 trials = 1000 softmax = [0.1, 0.3, 0.6] def…

How to do backpropagation in Numpy

I have adapted an example neural net written in Python to illustrate how the back-propagation algorithm works on a small toy example. My modifications include printing, a learning rate and using the leaky ReLU activation function instead of sigmoid. import…

No one in ad tech needs to know your name

I work in the ad tech industry, which means that I track people online for a living. Mainly, I do it because the industry has interesting computer science problems and because the job pays well. I will not defend ad…