Tagged "python"

Outguessing a Riffle Shuffle

Jun 24, 2026   |   18 min read   |   technical

The folklore says seven riffle shuffles are enough to randomize a deck of cards. I trained a small transformer to guess the next card after k shuffles, gave it the deck's starting order, and let it watch every card as it was dealt. One shuffle is wildly predictable; the edge shrinks fast, but a faint, statistically real signal survives all the way out to eleven shuffles.

Semantic Similarity Using Sentence Transformers

Mar 25, 2023   |   15 min read   |   technical

Sentence transformers help us identify similar sentences based on their content, topic, and implicit meaning. In this post we compare BERT and all-mpnet-base-v2, a sentence transformer that is much better suited for producing sentence embeddings that can be compared using cosine similarity.

LeetCode Trees

Mar 27, 2022   |   3 min read   |   technical

A package to provide a convenient way to manually input binary trees using LeetCode's level order traversal with None-path-termination serialization format. Also, a function to print binary trees to the terminal as ASCII characters.

3D Pose Reconstruction

Dec 12, 2018   |   3 min read   |   casual

From a single picture of a person, this application creates a three-dimensional figure with the same pose.