Category: AI

  • How to compute and plot Bollinger BandsĀ® in Python

    The aim is to produce a plot like this. The orange line is your data, the green line is the upper "bollinger" band, the blue line is the lower "bollinger" band. The red dots indicate where your data is either above or below the bands. Copy-paste this code: import pandas as pd import numpy as […]

  • 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 from a course on Udemy. In the above example, the crawler will find images in […]

  • 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 sample(softmax, temperature): EPSILON = 10e-16 # to avoid taking the log of zero #print(preds) (np.array(softmax) […]

  • 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 numpy as np # seed random numbers to make calculation # deterministic (just a good […]

  • 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 tech. Mainly because ad tech is not important enough to humanity to defend. However, I […]

  • Neural networks on GPUs: cost of DIY vs. Amazon

    I like to dabble with machine learning and specifically neural networks. However, I don’t like to wait for exorbitant amounts of time. Since my laptop does not have a graphics card that is supported by the neural network frameworks I use, I have to wait for a long time while my models git fitted. This […]

  • How AI, robotics and advanced manufacturing could impact everybody’s life on Earth

    What if everybody could live a wealthy, healthy, job-less and creative life in a post-scarcity Universe? Are we currently on a trajectory to this new reality and what are the obstacles we may face on the way? What are the important game-changing technologies? TODO: create and agenda (very tentative): 1) contrast current life circumstances with […]

  • What kind of Machine Learning person are you?

    You may ask yourself, if I’m a machine learning person then what kind am I? See for yourself in Jason Eisner’s Three Cultures of Machine Learning.

  • When to be most careful about catching the flu?

    Continuing on my blogification of Peter Norvigs excellent talk, the question is, when to watch out for the flu, e.g. if you live in Denmark? 1) Go to www.google.com/trends/ 2) Type in the word “influenza” 3) Select your geographical region (Denmark in my case) 4) See data up to year 2008, to avoid the graph […]

  • How long is a year?

    How to find out how long a year is on Earth by only analyzing text? This approach is lifted straight from an excellent and very inspiring talk by Peter Norvig. 1) Go to www.google.com/trends/ 2) Type in the word “Icecream” 3) Measure the distance between the peaks (turns out that the average is exactly the […]