Author name: kostas

How to use bnlearn to learn causal structures

This article on causal machine learning covers a practical example of how to learn structural causal models (SCM) directly from data. We will use bnlearn, which is an open-source library for learning the graphical structure of Bayesian networks in Python. Check out my Github repo for additional code examples. For other frameworks, checkout my page …

How to use bnlearn to learn causal structures Read More »

Yummy 3D plots

Very nice interactive 3D plots with Plotly. import plotly.graph_objects as go import numpy as np import pandas as pd # Read data from a csv Z = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv').values # Actually not necessary to provide X and Y… X = np.linspace(0, 1000, Z.shape[0]) Y = np.linspace(0, 1000, Z.shape[1]) fig = go.Figure(data=[go.Surface(x=X, y=Y, z=Z)]) fig.update_layout(title='Mt Bruno Elevation', …

Yummy 3D plots Read More »

How to create a versioned table from a crud table in Postgres with triggers

Example You have a user table in Postgres: CREATE SCHEMA tutorial; CREATE TABLE tutorial.crud_users ( id INT NOT NULL, username VARCHAR NOT NULL, CONSTRAINT crud_table_pkey PRIMARY KEY (id) ); You insert new users and update usernames for existing users. Update is a destructive operation that overwrites data, so how do you keep track of what …

How to create a versioned table from a crud table in Postgres with triggers Read More »

Comparing the Corona outbreak in Scandinavia and South/South-East Asia

I have read the WHO’s sitreps on CoViD-19 daily since the end of January 2020, where I was visiting Viet Nam. I now live in Denmark (a Scandinavian country) where the Corona virus has shut down society and many people have tested positive. When I compare the numbers for Scandinavia (Denmark, Norway, Sweden) with a …

Comparing the Corona outbreak in Scandinavia and South/South-East Asia Read More »