RSSAmplifier

Blog

Emilio’s Blog

Machine learning and other stuff

e-dorigatti.github.ioRSS feed ↗10 posts

Latest posts

Simplest implementation of LDA topic modeling with collapsed Gibbs sampling

Latent Dirichlet Allocation (LDA) is a classic machine learning algorithm for topic modeling. Topic modeling is an unsupervised approach that discovers hidden topics behind a collection of documents, dividing for example sport news from food recipes and movie reviews. While the math can get complicated, the implementation is surprisingly simple. Let’s dive in!

Tensor computing from scratch part II - Advanced operations

Welcome back to the “tensor computing from scratch” series, where we re-implement pytorch from first principles! In the first part we have seen how to create a basic data container and perform two fundamental operations, namely reductions along one axis and pointwise operations between two tensors, including shape braodcasting. While what we wrote so far is already pretty freakin’ cool, if you ask…

Cooking Good: How AI Helps Chemists Spot Impurities in Drug Development

Bringing a new medicine to market is a lot like creating a new dish in a restaurant: each step needs careful planning, creativity, and teamwork. This post explains how scientists use artificial intelligence and simulations to make drug development safer and faster by finding and understanding impurities that can arise along the way.

Headless testing of Streamlit file upload

I really like the idea of testing Streamlit web applications with pytest together with the rest of the codebase. Unfortunately, the Streamlit testing framework does not offer a direct way of interacting file_uploader components, which can be a deal breaker for many developers, me included. Luckily, it only takes a bit of fiddling to get this to work. Let’s see how!

Tensor computing from scratch part I - Fundamendal operations

Squeeze, unsqueeze, view, reshape, flatten, swapaxes… Oh my! In deep learning applications, tensors can have extremely fluid shapes flowing from one operation to the next. Have you ever wondered how tensor computing libraries such as pytorch, numpy and tensorflow are able to efficiently keep track of your data, weights and activations? Then you’ve come to the right place, as we are going to…

Handling Larger-than-memory Datasets in PyTorch Lightning: A Practical Guide

In the world of deep learning, data is king. The more data we have, the better our models can learn and predict. However, this abundance of data can also pose a significant challenge. What happens when our datasets are so large that they don’t fit into our system’s RAM? This is a common issue faced by many machine learning engineers, and it’s the problem we’ll tackle in this blog post.

How to use Visual Studio Code to run and debug code on SLURM compute nodes

If you’re a developer or data scientist using SLURM to handle your compute workloads, you have surely encountered issues in debugging your code on compute nodes. In this blog post, I share a simple solution for that, allowing you to develop and debug code running directly with the compute resources you need. Although the focus is on Visual Studio Code, the same approach can be applied to other…

What is the average length of a queue of cars?

Some time ago I was driving on a twisty mountain road, stuck in a slow-moving queue of cars as it was impossible to overtake safely. Out of boredom, I was wondering how many cars were in the queue, and, more generally, what would be the average length of queues in this road. Let’s find out!

How to save locally the result of XPath queries in Firefox and Chrome

It happens relatively often that, while browsing the internet like a normal person, I want to extract some data from a webpage, save it locally, and manipulate it in some way. Since it is an one-off operation, I really do not want to bother writing a web-scraper with Python. Instead, here is a simple way of doing this through the developer console in Firefox or Chrome!

Simplest Implementation of Diffusion Models

This tutorial presents the simplest possible implementation of diffusion models in plain pytorch, following the exposition of Ho 2020, Denoising Diffusion Probabilistic Models.1 http://arxiv.org/abs/2006.11239