-
Agentic Soft Logical Circuits: from ReAct Chains to Structured Variational Inference
I have been spending a lot of time lately staring at agent logs.
-
The continuous Sheffer stroke is all you need
All elementary functions from a single operator
-
From brain to disk: how I built a voice-activated second brain for $0
We’ve all been there. You’re out for a walk or just about to fall asleep when a perfect idea hits. You grab your phone, record a quick voice note, and then… it just sits there. It becomes a digital fossil in your chat history that you’ll probably never listen to again.
-
Interpretations for the Kullback-Leibler divergence, or relative entropy
This page follows the structure of Six (and a half) intuitions for KL divergence by Callum McDougall (2022); equations are set for MathJax.
-
From hard to soft operators: between machine learning and statistical physics
An academic exploration of deep learning, statistical mechanics, and category theory
-
Random rooted trees, continuation free energy, and the Diligent Learner
Why these two theories should meet
-
Short-prefix soft values: a null result
Abstract
-
Recursive decomposition with a continuation policy
Abstract
-
MellowMax, Doob's h-transform, and the intensive geometry of tool-use agents
Abstract
-
Soft values, symmetry breaking, and random rooted trees
A missing local law
-
Inference-Time Steering as a Discrete Schrödinger Bridge
The limits of passive filtering
-
Category theory and PLP: keeping the theory in order
Why use category theory here?
-
PLP is inference-time approximation of free energy
Approximate sampling and inference in LLMs
-
Test-time inference, language models and energy based models
The link between autoregressive models, energy based models and probabilistic language programming
-
Scaffolding is all you need
Toward a reliability theory of AI compound systems
-
Running Claude Code via OpenRouter in Docker
AI coding agents like Claude Code are incredibly powerful, but running them directly on your host machine can feel risky. Containerizing them is the logical step, but it often leads to auth conflicts, 401 errors, or terminal freezes.
-
Unleash Claude Code CLI with OpenRouter: Free AI Coding Power!
Claude Code CLI with OpenRouter
-
Probabilistic Language Programming, turning craft into solid science
Assigning semantic meaning to probabilistic programs
-
Intelligenza Artificial Neurosimbolica
Verso l’integrazione fra AI simbolica e AI neurale
-
Introducing skfolio new online convex optimization module
Bridging online convex optimization into skfolio
-
Running LM-Studio headlessly on Ubuntu 24.04 with CUDA
Running LM-Studio Headlessly on Ubuntu 24.04 with CUDA and Systemd
-
Configuration-model Surprise for community detection
From vertex pairs to stubs
-
Unlocking the Power of DeepSeek R1 via HuggingFace's TogetherAI
In the evolving landscape of artificial intelligence, the ability to interact with intelligent APIs has become a fundamental requirement for developers and organizations alike. Today, we explore how to harness the capabilities of the DeepSeek R1 model from HuggingFace through the TogetherAI service, highlighting its practical applications and utility.
-
Prompt Chaining with Foundational models
In the rapidly evolving world of artificial intelligence and natural language processing, one of the most innovative concepts emerging is Prompt Chaining. This method optimizes the capabilities of Large Language Models (LLMs) by enabling a structured, step-by-step collaboration among multiple prompts. Let’s delve into what prompt chaining is all about, its use cases, and a practical implementation.
-
Creating the How2 Function for Natural Language Bash Commands with LLM
In today’s tech-driven world, the ability to translate natural language into executable commands is a powerful tool for developers and system administrators alike. Recently, I embarked on creating a function that bridges this gap using a Large Language Model (LLM) to interpret user queries in natural language and return the corresponding Bash terminal commands. Here’s how I constructed the
how2function that provides users with Bash commands based on their queries. The trick is to use the fantastic LLM-CLI command by Simon Wilson llm. Then one needs to wrap the calls to LLM into a specific bash function calledhow2. -
Multilabel classification with Parabel and efficient at-k metrics
The annoying gap in extreme multilabel classification
-
Installing XFormers on Mac M1/M2
XFormers
XFormersis a deep learning library to implement many complex attention operations. It focuses on providing the Memory Efficient Attention as well as many other operations. For example it also hasBlockSparseAttentionsupport or any other forms of attention where the attention bias matrix induces a complex attention pattern, like for example in the sliding window attention used in Mistral models -
How to start your Docker compose service at startup
This is how you do:
-
Calculate a file hash in Python
This code helps you calculating the SHA256 hash of a file in Python. This could be helpful for the disambiguation of different files.
-
Augmentation of documents for neural networks training
Why augmentation of documents
-
Slicing rolling expanding windows over multiple pandas objects
This is a fast way to yield a subset of rows from multiple Pandas dataframes or Series, when one needs to work on a sliding window basis over a predefined minimum and maximum number of rows. This approach is among the fastest available and is based on the
.ilocaccessor of both series and dataframes. -
Dependencies For Having Detectron2 Running On Mac Os
Python dependencies for having detectron2 running on Mac OS
-
How to enable colab for longer runtimes by keeping it active
This post is of help:
-
How to download google sheet data to Pandas
All you need is a Google Sheets file with one or more sheets and of course some data. The file needs to be set to the sharing option which allows everyone with the link to view the data.
-
Better graphics with matplotlib and seaborn
High–quality figures are not an aesthetic afterthought. In scientific communication they determine readability, reproducibility, and perceived rigor. Default matplotlib settings are optimized for quick inspection, not for publication. The configuration below standardizes typography, layout, and rendering so that figures are suitable for papers, slides, and vector export.
-
Changepoint detection on huge grouped dataframes with ruptures and PySpark
Here we describe a way to perform scalable changepoint detection on grouped time series data by using PySpark and the rupture library.
-
Rolling operations in PySpark
Have you ever wondered how to perform rolling averages in PySpark? This snippet helps you through the process
-
Sampling 10 rows per groupb in PySpark
You need to use a window partition by and let the random number do the shuffle for you.
-
Docker on MacOS
How to install Docker on MacOs
-
How to make HDBScan an inductive clustering method
There is a large difference between inductive and transductive clustering methods. While the first are more similar to supervised learning, in the sense that once trained on N examples they can generalize to M unseen new samples, transductive method instead need to see all data, but cannot generalize to new samples.
-
How to convert networkx graphs to graph-tool
How to convert networkx graphs to graph-tool
-
Finding and deleting memory hungry temporary variables in jupyter notebooks
This simple command displays the name of the variables in the current kernel in Jupyter notebooks, whichi are clogging our memory resources the most.
-
Plotly And Jupyterlab
If you have problems with empty plotly output in jupyterlab remember that you need these packages:
-
The Woodbury matrix identity
The Woodbury matrix identity is a useful identity in linear algebra. It says that you can invert the sum of a matrix plus a $k$-rank correction by doing a rank $k$-correction to the inverse of the original matrix. It is also called matrix inversion lemma or Sherman-Morrison-Woodbury formula.
-
Versioning data files for machine learning projects with DVC
DVC Tutorial
-
Prefixspan algorithm for frequent subsequences visualization
Sequential pattern mining and projections
-
Code indentation in Python with Black
A very nice code indentation tool for Python is called
Black -
How to merge Dataframes in spark as in Pandas
This is how you do it:
-
Some scala functions as exercise
Here are some very basic function with self-explanatory name, to be coded in Scala for a super beginner. Some of them are very inefficient, pay attention to use them, they are only for demonstration.
-
Installing Jupyter with a Scala + Spark kernel
Installazione SCALA + SPARK + Jupyter
-
How to remove all logging information in scala spark
Create a folder named “log4j” in the root folder of your project (the one where build.sbt stays) and then create a file named “log4j.properties” with the following content:
-
Eigenvectors from eigenvalues a numpy implementation
Simple ideas can make good numerical algorithms
-
Sampling uniform spanning forests with Wilson algorithm in Python
Stochastic ways to determine the laplacian spectrum
-
The link between machine learning and statistical physics
Reading the paper by Max Tegmark “Why does deep and cheap learning work so well” is illuminating.
-
How to expand the loopback device size
-
Quantum statistical mechanics of complex networks in networkqit
With this post I am introducing to the public my very first complete Python package
networkqit. -
Hidden Markov Models
In these notes I want to introduce Hidden Markov Model, one of the simplest but rich enough models to handle real world applications for modeling sequential models.
-
Short introduction to measure theory
In these notes, we’ll take a look at the bare essentials of modern probability theory. We’ll describe the basic ideas, but we will skip Lebesgue integration, at the moment. To do this, we need to introduce some measure theory first, to see how things emerge naturally and beatifully.
-
Low rank estimation of sparse observed ratios
Reccomender systems are a class of algorithms to deal with missing information. Given that we have some available rate about the relations of a set of objects, and these informations are specified by real numbers, how can we estimate the relations between another subset of objects that we did not observe?
-
Smooth approximation to the floor function
I need to sample random numbers distributed according to the geometric distribution. Similarly to the Box-Muller transformation, which is a method to sample normally distributed random numbers based on a uniform random generator, I have found that any probability distribution admits one-liners, i.e. deterministic transformations of the uniform distribution that allow to sample random numbers for specific distributions.
-
Visual inspection of python profiler output with gprof2dot
Ever wondered how to make a beatiful and powerful call graph from your python profiler? I have found that there is no need to install heavyweight tools like KCachegrind or even worse, buying expensive IDEs. The solution is simple.
-
Einstein summation in Numpy
Einstein summation is a convention in tensor algebra where repeated indices are implicitly summed. For example, imagine we have a matrix (a tensor of rank 2) $A_{i,j}$. To compute the trace, i.e. the sum of diagonal elements one has to compute
-
Showing brain parcellation in Python with nilearn and some hacking
In this post I would like to introduce to the nilearn user, a modified set of functions based on the
nilearn.surfacemodule, that are of great help in making beautiful surface colored pictures of brain, like the one in this figure: -
Faceting images or generic plots with Seaborn and Python matplotlib
I’ve found myself working with large
pandas dataframe. Differently from the typical usage ofpandas dataframes, in some cells I havenumpy.arrayas content, or other types of data. Here we call these non-standard columns asxandy. -
Weighted graphs from adjacency matrix in graph-tool
I was playing a bit with networks in Python. In my daily life I typically work with adjacency matrices, rather than other sparse formats for networks. Adjacency matrix is pretty good for visualization of communities, as well as to give an idea of the distribution of edge weights. It is exactly in the domain of weighted networks that I need to be able to fit stochastic block models to my observations. Doing this requires the super-cool library of Tiago Peixoto graph-tool.
-
Install latest igraph 0.7.1 for Python3 on Ubuntu
If you choose to use the igraph library with Python 2, it’s a cakewalk to get it running on a fresh install of Ubuntu 16.04:
-
How to list all tensorflow devices
This is how you do:
-
Random matrix ensemble spectral density and the average resolvent
This short blog note is covering some aspects related to interesting calculations that can be done in random matrix theory applied to the study of spectral properties of random graph models, like those shown in Figure:
-
Some considerations about the spectral entropies framework
I am illustrating some of the ideas that emerged before, during and after the conference. How to compute this quantity?
-
Dataset of biologically derived graphs
This website contains a number of interesting dataset of biologically derived graphs.
-
Why probabilistic programming matters
I recently stumbled across the idea of probabilistic programming, something I had never heard before. Indeed with the recent advances in artificial intelligence and machine learning, this field is seeing a very rapid development. The motivation why I found this research field particularly interesting is its cross-talk with the ideas I developed in one of my last works on inference within the spectral entropy framework.
-
Inequalities, traces, densities, matrices
Let us compute the following quantity:
-
An identity for zero
This identity could result useful
-
Distance matrix of the air500 complex network
The
air500network is the adjacency matrix of the largest 500 airports in the world. -
Lambda functions composition in Python 3
Introduction
-
A Graduate Course in Econometrics
Introduction to matrix econometrics
-
A Full Undergraduate Course in Econometrics
This series of notes is from the Ben Lambert’s course on econometrics, a discipline mixing calculus, linear algebra and statistics in a way that I believe is very enjoyable for a physicist-minded person. The series of courses is available at the following Youtube link:
-
The Enhanced weighted random graph model (EWRG)
The ensemble of maximally random weighted graphs with the constant average number of edges and total weight.
-
Plugging the weighted random graph into Surprise
Surprise is based on the calculation of the number of simple graphs with \(n\) nodes and \(m\) edges exactly. This null model is called \(G_{nm}\) model and it is the microcanonical version of the Erdos-Renyi model also called \(G_{np}\). To be more precise, Surprise does not compare against a fixed null model, but the null model is dependent on the partition itself. In other words, the expected fraction of intracluster edges is given by \(p_\zeta/p\) and it is clearly dependent on the partition it self. For this reason Surprise is more similar to the Constant Potts Model than to a model where intracluster density is compared to a fixed constant.
-
How to stop with CTRL C a running mex file in Matlab
This is how you do:
-
Eigenvalue spectra of modular matrix techniques and calculations
RANDOM NOTES ABOUT RANDOM GRAPHS AND EIGENVALUES, NOT TO BE TAKEN SERIOUSLY
-
How to grant specific directory access to users in linux
Negative ACLs
You can prevent a user from accessing certain parts of the filesystem by setting access control lists. For example, to ensure that the user abcd cannot access any file under /home:
-
Assigning XRDP to different users
/etc/rc.local write xrdp-sesrun 127.0.0.1 brainet neuron128 1280 1024 24
-
How to create a large swap file in Ubuntu if system runs out of memory.
Check this guide:
-
TAB is not working with XFCE4 after installation from Ubuntu for use with remote desktop
You have installed Ubuntu 14.04 or latest Ubuntu LTS 16.04 on your server and you want to make it available for remote desktop connections with the help of XRDP. You install xrdp and you connect to your server with some client, like remmina. Suddenly XFCE4 is showing up in its simplicity.
-
Matlab and CUDA gpudevice freezes on Ubuntu 14.04 with GTX 1070
In Ubuntu 14.04 with MATLAB R2016b it may happen that after an installation of CUDA8 and NVidia drivers 367, the calls to specific CUDA functions such as
gpudeviceorgpuArrayare very slow the first time you call them. This is because MATLAB R2016b it’s not built against the latest CUDA drivers so fat binaries have to be built once. In this case, MATLAB is using a CUDA toolkit (7.5) which does not support the new Pascal architecture on my Geforce GTX 1070. This operation may take some minutes to end, as nearly 400 MB have to be compiled and saved in.nv/ComputeCache. In theory this cache is built once and every successive instance of MATLAB should not take too long for first calling CUDA functions. Anyway it is the case that this is not completely true. -
Computing Euler angles from 3x3 rotation matrix in Matlab
Computing Euler angles from a rotation matrix is straightforward once you set a convention. Indeed is possible to compute an entire different set of angles that defines a rotation when you change axis. In this case I use the aeronautical notation, with pitch, yaw and roll as a plane taking off.
-
Computing hypergeometric probability efficiently in C++
Computing hypergeometric function is a slow and difficult process, often affected by overflow errors as evaluating binomial coefficient may return extremely large numbers. Fortunately, thanks to some hypergeometric identities, is possible to evaluate the hypergeometric probability quickly.
-
How to start a SSH daemon on Windows without agonizing pain
I recently needed to connect via ssh to my windows computer from a Linux server, but I couldn’t figure how to do it since ssh servers for windows are expensive and I don’t want to pay for a software that on Linux comes for free. Some of the typical ssh servers (daemon in linux terminology) are bitvise tunnelier, freesshd.
-
How to upgrade R to the latest version on Ubuntu 14.04
Follow this instruction:
-
A code for the absolute orientation problem with Umeyama algorithm in Python
A code for the absolute orientation problem solved with Umeyama algorithm. Explanations, briefly.
-
Delaunay triangulation and beautiful visual effects in Latex
Recently in the world of the Internet this very fancy coloured pattern appeared:
-
Comparing spectral densities of random graph models.
The ability of quantitatively comparing two graphs is of great importance in many scientific questions and of exceptional importance in studying brain networks. How the brain networks of healthy people differ from those of patients? What kind of alterations are present in the functional connectivity of diseased brain? To what extent two networks are structurally similar?
-
Matlab R2016a crashes on Ubuntu 16.04 with NVidia 361 drivers
For those of you who upgraded Ubuntu from 14.04 to 16.04 and have found that Matlab is crashing with errors in nvidia drivers, you have three options:
-
Fix black screen after upgrade from Ubuntu 14.04 to Ubuntu 16.04
I’ve just decided to upgrade my Ubuntu 14.04.4 to the latest Ubuntu distribution 16.04.1. To do this I’ve followed the instructions and after the installation rebooted my computer.
-
Using-VNC-persistent-sessions
In this guide I briefly explain how you can get remote persistent session on the Mattarello Linux servers from any local computer, Windows, Linux or OSX.
-
Setting up VNC sessions in Linux
Server side
-
Launching-matlab-in-background-correctly-in-linux
You want to launch Matlab for a very long script and then disconnect your remote terminal, and when back, not finding bad surprise.
-
How to install latest R on servers under proxy
It’s possible to keep your R version updated on Ubuntu 14.04 if you decide not to use the version provided by the package maintainer. In this small guide I explain how to do that especially if you are under a proxy server.
-
Get the exact print size of a PDF in inches
This is the command to do the stuff
-
Forwarding-X11-maintaining-connection-with-xpra
How to use XPRA for remote connection to the NeuralComputation Linux servers hosted in Mattarello
-
Install Google Drive for Linux
Gsync is the rsync for Google Drive. If you like me, have unlimited storage space on Google Drive, this guide that can be very useful to you. You can store your precious date on the google cloud with the warranty that they are not lost nor destroyed. Google treats data very seriously
(pun intended). -
Detecting the consensus communities in graphs
In these section we’ll address in depth an approach to making sense of the mesoscopic structure of a network by means of non-deterministic methods. We will take advantage of the methods of statistical physics and treat with ensembles of partitions to assess the statistical significance of community structure.
-
How to install Octave on OSX Yosemite
For those who have problems installing Octave on OSX Yosemite, this is a simple guide.
-
How to reset unity in Ubuntu 14.04
For those who struggle with frequent freezes of Unity, this is a short guide on how to reset Unity to default settings in Ubuntu 14.04.
-
Matlab imagesc with text values
Well. Finally got around to making a better
imagescfunction in Matlab and Octave. I’ve named itimagesctxtand it has the same arguments asimagesc.