Algorithms

Double Machine Learning for Dummies as explained by ChatGPT

I asked ChatGPT to: explain double machine learning for dummies Here is the answer: Double machine learning (DML) is a statistical method used to estimate treatment effects in the presence of high-dimensional controls. To put it simply, it’s a way to answer questions about cause and effect using data and machine learning, even when there […]

Double Machine Learning for Dummies as explained by ChatGPT Read More »

How to sort numbers with an evolutionary algorithm (CMA-ES)

Yes, this is clearly nonsense. Sorting is not a hard problem and standard algorithms such as quicksort and mergesort have O(x^2) and O(n log(n)) complexity. But let me scratch this itch of sorting numbers using an evolutionary algorithm, specifically Covariance matrix adaptation evolution strategy (CMA-ES). Technically, we will use what I think is the original

How to sort numbers with an evolutionary algorithm (CMA-ES) Read More »

Cosine similarity in Python

Cosine similarity is the normalised dot product between two vectors. I guess it is called “cosine” similarity because the dot product is the product of Euclidean magnitudes of the two vectors and the cosine of the angle between them. If you want, read more about cosine similarity and dot products on Wikipedia. Here is how

Cosine similarity in Python Read More »

Running LP-solver in Postgres

Having reinstalled PostgreSQL with support for Python and pointing at my non-system python, it is time to test whether I can use the convex optimizer library I’ve installed in my Python 2.7 (pip install cvxopt). Install PL/Python if not already installed — if not already installed. Doesn’t hurt. create extension plpythonu; Create a function that

Running LP-solver in Postgres Read More »

Clustering in Python

In a project I’m going to use clustering algorithms implemented in Python, such as k-means. Clustering http://stackoverflow.com/questions/1545606/python-k-means-algorithm scipy.cluster has been reported to have some problems, so for now I’ll use PyCluster (following advice given on stackoverflow). Install PyCluster: pip install PyCluster

Clustering in Python Read More »